How to Setup Facebook Trigger & FB App for Lead Forms?

It’s not a one time flow ! you should leave it, meta in its documentation says that sometimes it will send a verification to that end point it should answer or the link will be broken

In fact, the documentation I reviewed didn’t mention that.

After the subscription process, I’ve never required additional verifications unless the account was suspended or the tokens were altered. Given that the tokens we use in webhooks are manually set, I don’t view the initial flow as essential.

Oh well, time will tell.

@kenna wow that was awesome. Thanks a lot. I was not aware someone solved it.

I tried to implement it and was almost able to do it but I ended up with a small issue.

When I tried to test the workflow with the Test option available inside app settings webhooks leadgen, I received a response on to my n8n workflow. But when I try to test it using “Lead Ads Testing Tool” I’m not able to receive a response to my n8n workflow.

@kenna @Erick_de_Jesus How did you guys make it work?

Thanks a lot if anyone can help me with it.

@matheusmaiberg @Ameurj How did you guys make it work? was not able to tag you guys in my previous message.

Try my tutorial exactly and screenshot each part for me here and I can analyze it to help you. Cover up any tokens and personal URLs. Make sure you’re using the right tokens like I describe too.

@Anand_C good video. you are absolutely correct about the way you tested…sending that test event to the server yeilds the same error to me as well.


The real way to test is where you were using the Lead Ads Testing tool, and you are 100% correct, your appid is not listed as being subscribed - so therefore I suspect it is the lack of a correct Page Access Token
Above, I described my troubles with obtaining one - I needed to create a PHP script to get it - and I couldn’t get it properly with the Graph Explorer tool. I followed these 2 videos to get one: https://www.youtube.com/watch?v=eIeDKLCgP6A and https://www.youtube.com/watch?v=QclOnHc0PSs
hopefully the proper Page Access Token will help subscribe it correctly. Let me know if this works.

@kenna Still no luck, I got the permanent Page Access Token with all permissions using the method mentioned in the YouTube videos. But still, I’m not able to subscribe to my page on the webhook.

@kenna Do I need to have advanced permission for leads_retrieval for this app to work?

@Anand_C Yes add that permission as well. I also see what happened I think. It is in your first flow that is the problem. At 2:45 of your video you added the Page Access Token instead of “MakeUpATokenHere” under “Verify token”. This may be causing it. You only need to make up a token and NOT use the Facebook Page Access token here…I know it is a little confusing. Try making up a token there and then go back to the Facebook Lead ads testing tool and seeing if the app ID is subscribed to the webhook for leadgen now. That is definitely the problem I think.

I have noticed that if you get any error Facebook will remove the app ID and leadgen permission and the next time you go in, it will be gone. I had to do this a few times before I finally got it to stick, and I forget what caused it. Now every time I click into Webhooks in the app…I see this screen:


and you are not seeing that- yours is looking like its not subscribed at all because its removing the subscription.

Do you mean I have to type in “MakeUpATokenHere” instead of the Page Acess token inside the Verify token?

@Anand_C yes, try using a made up token there like he does here:

and double check that Respond to Webhook confirm hub.challenge is set to:
respond with Text and {{ $json.query[‘hub.challenge’] }}

when you get a confirmation that it was subscribed, go immediately into Lead Ads Testing Tool and see if the ID is there. Don’t send a test in the leadgen subscribe area.

@kenna Nope it didn’t work, is there any way to personal chat on this website

@Anand_C yes, I was able to send you a message there, let me know if you still need help. click your profile picture then the person icon at the bottom, then Activity and you’ll see the Messages to the right

@Anand_C I’m pretty sure I know now why you can’t see the app. In these directions from Facebook it says: To get your Page to install the app, have your app send a POST request to the Page’s subscribed_apps edge using the Page’s acccess token. I’m sorry I left that part out in my directions as I did it once and didn’t realize that it was necessary as well. It is a one time thing I think unless it errors and deletes itself.

You will then see the app id in the Lead Ads Testing Tool

Here’s how to do it in Graph Explorer:
image
Make sure it is set to POST, then send this with the Page Access Token in the field to the right and you will get a “success”:true:
image

Now you should be able to see the appid subscribed in the Lead Ads Testing tool. Sometimes it will delete itself out of there if you have an error so check your Executions in n8n if thats the case. Set your app to live with privacy and terms and you may also need to do it with a verified Business Manager now (not sure). I also go into here in Facebook Lead Access and click into the Page and choose Customize access:

I then can choose Assign CRMs and choose the Facebook app name, and it should show up only after you do the previous steps:

You also want to go into Facebook Apps here and choose the app you’ve made for this, and add the Facebook ads account to the app by choosing Add Assets here:

After all of that, you can start testing your second flow with the Lead Ads Testing tool, and then live traffic. Hope this helps you - please let me know if it works!

1 Like

side note: I used 113232323232332 in the POST request as an example- you really want to use the Facebook page ID there.

@kenna wow that was it, that’s what we were missing. Finally, now I can switch from Zapier to n8n Thank you again @kenna, and thanks to the n8n team.

1 Like

Hey Anand! Thanks for the excelent topic. Im trying to get the page ID but it returns my User ID. I think maybe I need the pages_show_list advanced access?

I figure it out. You must have the permission: business_management

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.