Yes! Now Home Assistant can easily send notifications through Facebook Messenger. You can use the official Facebook Integration (that requires a pretty complex setup) or use this easy-to-use API to send notifications, images or even commands through Messenger.
Why to use Messenger instead of WhatsApp or Telegram? Speed, Images and Commands (you can send commands from Messenger to HA)
Find below the step-by-step instructions to implement it in a few steps.
Setup:
You need to get a personal APIkey before using the API. So only you can send messages to yourself.
Just follow these simple steps:
- Start a Facebook Messenger conversation with @api.callmebot. Or click here: https://m.me/api.callmebot
- Send "create apikey" to @api.callmebot (using Facebook Messenger of course)
- The bot will generate a secure apikey for you.
- The bot will answer you with your personal apikey .
You can now start sending notifications to yourself through Facebook Messenger.
5. Enjoy
How to send a Text notification through Facebook Messenger
You need to use the following URL:
https://api.callmebot.com/facebook/send.php?apikey=[your_apikey]&text=[message]
[your_apikey]: The apikey that you received during the activation process (step 4-5 above)
[text]: Message to send (urlencoded). You can use this online converter to encode the message. (i.e. %20 for space, %0A for new lines). Facebook Messenger formatting characters are allowed (i.e "*" for bold, etc. but it will be only visible in the Web Client). Check here how to include emoticons in the message 👍.
For example, to send the text message "Alarm from HomeAssistant to inform you that the alarm has been triggered" to your Messenger account, the URL will be:
https://api.callmebot.com/facebook/send.php?apikey=your_apikey&text=Alarm+from+HomeAssistant+to+inform+you+that+the+alarm+has+been+triggered
To do that in Home Assistance is pretty easy with the REST Notify Component. (See below the Instructions).
How to send a Images through Facebook Messenger
https://api.callmebot.com/facebook/send.php?apikey=[your_apikey]&image=[image_url]
[your_apikey]: The apikey that you received during the activation process (step 4-5 above)
[image_url]: URL of the image to send. The URL has to be urlencoded. You can use this online converter to encode the message. (i.e. %20 for space
See below the instructions to create a REST Notify service to send images through Facebook Messenger.
Instructions: Using the HA REST Notify service for Text Messages and Images
0) Request an apikey (see the Setup section above)
1) Create two new "REST Notify" services in the configuration.yaml: (one for Text Messages and another for Images)
# Example configuration.yaml entry notify: - name: Facebook_text #name of the notification service to send Text Messages platform: rest resource: https://api.callmebot.com/facebook/send.php data: apikey: abc123def567ghi890jklm #enter your personal apikey type: text #as we are sending a text message
- name: Facebook_image #name of the notification service to send Images
platform: rest
resource: https://api.callmebot.com/facebook/send.php
data:
apikey: abc123def567ghi890jklm #enter your personal apikey
type: image #as we are sending an image
... action: service: notify.Facebook_text data: message: 'This+is+Home+Assistant+sending+you+a+Messenger+alert+to+you'
... action: service: notify.Facebook_image data: message: 'https://d17fnq9dkz9hgj.cloudfront.net/breed-uploads/2018/08/beagle-card-medium.jpg'
How to test the FB Messaging notification
You can easly test the new notification service using the Services Section available in the "Developer Tools".
Example to send a Text Message in HomeAssistant (for testing)
Result:
Example to send an Image using the "Developer Tools" (for testing)
Result:
Comming Soon
Problems?
If you have problems, like not receiving the Call on Telegram, or not receiving the WhatsApp messages, try to test the CallMeBot API using your Web Browser:
- Telegram Phone Calls using Web Browser: here
- Telegram Text Messages using Web Browsers: here
- WhatsApp Text Messages using Web Browser: here
You might get some errors on the screen that will help you to identify the problem. (Ex: Calls disabled in the Telegram Security Settings, WhatsApp not activated, etc.)
If you still have problems using the API, don’t hesitate to contact me in Telegram @callmebot_com or by email at [email protected]. Remember to Follow me on Twitter to get news about coming features, changes, invitations, etc.