Facebook Webhook One Url Different Payloads

Hey there,

anybody with an idea on the following problem:

I set up facebook webhooks. Its only possible to create one Callback URL, which was successful.

It was also successful to auto detect the incoming data.

The problem is now that there is only one callback but different payloads depending on what I want to receive.

For my example there is the messages webhook which has the following payload:

{
  "object": "page",
  "entry": [
    {
      "time": 1681588968806,
      "id": "0",
      "messaging": [
        {
          "sender": {
            "id": "12334"
          },
          "recipient": {
            "id": "23245"
          },
          "timestamp": "1527459824",
          "message": {
            "mid": "test_message_id",
            "text": "test_message"
          }
        }
      ]
    }
  ]
}

and there is the ratings webhook with the following payload:

{
  "entry": [
{
  "id": "0",
  "time": 1681586295,
  "changes": [
    {
      "field": "ratings",
      "value": {
        "comment_id": "44444444_444444444",
        "created_time": 1681586295,
        "item": "rating",
        "open_graph_story_id": "444444",
        "rating": 4,
        "recommendation_type": "POSITIVE",
        "review_text": "I like this!",
        "reviewer_id": "444444",
        "reviewer_name": "Test user",
        "verb": "add"
      }
    }
  ]
}
  ],
  "object": "page"
}

of course when i detect the data and I will receive other payload on another webhook i cannot work with the received “request data”

How to handle this now?

Maybe with hookdeck or something similar?

Thanks for any ideas!

I found a solution for that. For anybody looking for the same:

Its working with hookdeck. You can set routing rules or filters and depending on those you can create different api workflows with different callback urls.

How did u get hookdeck to work? I got it working in test mode with sending test webhooks, but can’t get it to work in live mode. Does it involve including a page access token or user access token.

just change the url after validation. in live mode it is the url without version-test in the url.

hello @new_developer4 ! I’m trying to get Facebook notifications for leadgen, without success

I’ve successfully verify my Bubble api endpoint in my facebook app, but after this I’m stuck. When I send a test payload to my endpoint, nothing happen in Bubble.

I tried with POST, GET, to set up parameter nothing works.

Can you please help ?

Invocating @Jici power master for API endpoint :rofl:

Did you change the url endpoint after verification? Because for verification the url must be something like: bubble.bubbleapps.io/xxx/testversion and after verification it must the url without testversion.

I dont’t know if its the correct url as I am on the phone right now, but for me its working then.

Also the facebook app has to have the verification as webhooks only work in live mode after facebook verification of your application.

What you can also do is to send a test webhook and then see whats incoming incoming at hookdeck. Then you can set up rules for linking to the correct workflow in bubble.

It’s been a while since I play with facebook API @Sarah_Esteve
There’s a couple of thing to consider:
A) Verification is done with a GET endpoint while webhook will be send to POST. Bubble (if this didn’t change, I have a request on ideaboard for that https://bubble.io/ideaboard?idea=1680266659297x549588465359781900 , bubble doesn’t support actually to have the same name for POST and GET endpoint)
B) You need to validate the endpoint for live
C) You cannot really use initialize endpoint for this kind of purpose directly from API Provider.

The first step is to initialize the webhook by sending the request in live directly or you will need to redo all the step once your ready to go live. Once it’s done, switch the endpoint to POST. What I do at this moment is to use initialize feature and send a test payload manually using Insomnia (or Postman).

2 Likes

Hi all, could you please all vote for this feature request: