Facebook Messenger difficulty

Good to hear PetrolHead. Were you also able to pull a screenshot with FB messenger? If yes, could you share your script?

How do you attach a local image to the Facebook messenger notification?

I’m still looking into this issue but don’t have the time. I can make a snapshot and save it locally but can’t attach it to Messenger with the payload function. Any help is appreciated!

- alias: Test Automation
  initial_state: 'on'
  hide_entity: True
  trigger:
  - platform: state
    entity_id: binary_sensor.door_window_sensor_158d00014db7b2
    from: 'off'
    to: 'on'
  action:
    - service: camera.snapshot
      data_template:
        entity_id: camera.dahua_ipc
        filename: "/config/www/snapshots/camera.dahua_ipc{{ trigger.to_state.last_changed }}.jpg"
    - service: notify.facebook
      data:
        message: 'This is a test'
        data:
          attachment:
          type: 'image'
          payload: 
                url: /config/www/snapshots/camera.dahua_ipc{{ trigger.to_state.last_changed_urlencode }}.jpg    
         target  - '+31xxxxxxxxxx'

I cannot get it to work. My number is formatted “+491…”, I am an admin on the page and my token is valid (I verify through CURL) and I am always getting Requires phone matching access fee to be paid by this page unless the recipient user is an admin, developer, or tester of the app. (Code 10)

I had this same problem - I had to add my additional users as testers. My admin user worked fine out of the box. I stopped using FB messenger because it wasn’t reliable (ended up going to HTML5 on Android and the HASS app on iOS.) I read (at the time) that the API was changing for FB messenger as well. My PH#s were formatted as +1xxxyyyzzzz

When I tried to send a message to my phone number,
I encountered the error:

2019-03-14 01:36:55 ERROR (SyncWorker_0) [homeassistant.components.notify.facebook] Error 400 : (#10) Access to the Customer Matching API and Customer Matching via the Send API is currently available in limited release. To learn more, contact your Facebook partner manager or representative. (Code 10)

I also tried to add another user as a tester, and the same error occurred when I send a message to his phone number.

The steps I took was.
1: Sign up for FB developer account.
2: Create Facebook page
3: Create App page
4: Add Messenger on App page.
5: Get Page Token
6: Use token in configuration.yaml

1 Like

Same issue with you, please share if you figureout. Thank

At this point, I just gave up and used Telegram instead. It’s simpler and it just works.

Do you have an example script of your Telegram approach?

I basically just followed the setup instructions at
https://www.home-assistant.io/components/notify.telegram

If I recall correctly, this is what I did.
1) Download Telegram
2) Sign up for telegram account
3) Message @botfather to create a bot
4) ask botfather for API key
5) Get your chat id by messaging @myidbot
6) Make sure to send you bot a message because the bot can't initiate a conversation.
7) Put this in the configuration.yaml:

telegram_bot:
  - platform: polling
    api_key: YOUR_API_KEY
    allowed_chat_ids:
      - YOUR_CHAT_ID

# Example configuration.yaml entry for the notifier
notify:
  - name: telegram
    platform: telegram
    chat_id: YOUR_CHAT_ID

8) When you need to send a notifcation, use this:
    action:
    - service: notify.telegram
      data:
        message: 'the text message'    

9) You can send photos and videos also (url or local file). Remember if you want to send a local mp4 file or jpeg, you have to whitelist that directory.

Hope this helps.
1 Like

After trying to setup the Facebook Messenger component without success, I decided to use the API below to send Text Messages and Images via Messenger.

It is super simple to use with Home Assistant.

If you want to ask me why I use Facebook messenger, the answer is → young daughter…