In my facebook page, I have created a form for users to fill the values, now I want to fetch the leads through api calls using power automate, I have a api's documentation provided by facebook, but not sure how to start can some one please help ?
I think out-of-box there is Facebook connector for Power Automate, but its designed to interface with timelines and posts and not leads.
Have a look at - https://www.youtube.com/watch?v=sxIb52040xM
or you can use the HTTP action and invoke the API directly.
To be very honest, I have not explored the Facebook api much, but I hope links will point you the right direction
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
Thanks for the links, let me check those, also do let me know if you find something,
Just a question, can you check the link which I have shared shared from facebook, can you tell me how to use that with the actions of power automate(http, http webhooks, when an http request is received )
To be very honest, I am not much familiar with Facebook API.. The custom connector looked promising as it was backed up by a video tutorial..
Hi @CFernandes ,
Yeah I thought so too, but it seem @darogael has not updated it from long time, even many of the users have left comments there too,
but thanks for your help, I found a link too
@PowerUser0 I am bit under work currently but since you expressed that this is urgent, my first step recommendations would be to start with step-by-step, since there is no OOB connector currently to Facebook for your needs.
1. Simply interact first with the Facebook Graph API without any other tooling to understand the APIs you want to use: https://developers.facebook.com/tools/explorer/
2. When ready, target the relevant Facebook APIs through Postman or similar (could be even your basic JS or C# code if you are more familiar with that). The aim is to be able to authenticate and successfully retrieve the data you are looking for. https://www.postman.com/
3. When ready, time to choose your actual Tooling. HTTP connector seems like a quick win, as you just use it the same way as what you did in step 2, however you loose a lot of control (eg DLP policies). Custom Connector can be the second option - especially if your organization is more mature - however that will come down the road with maintenance costs. Either way, you will only need to reuse how you have authenticated in Step 2 and to define the endpoint you are communicating with.
Now this is the spot, where your issue is not with PowerAutomate at the moment but rather understanding your target API. I strongly suggest using PostMan as a tool to get comfortable with the API you are trying to connect first, as described above, and only start to build your final flow with chosen tooling (PowerAutomate, C#, LogicApps, ...) when that second point is given.
Can you elaborate on error message you receive when trying to call the API?
Additional "quick checks" regarding your setup:
- have you provided needed permissions to read Leads such as leads_retrieval? https://developers.facebook.com/docs/marketing-api/guides/lead-ads/retrieving
- are you using default authentication or long-lived access tokens? In your screenshot I only see App Access Token (app id and secret) but documentation says you need at least a User Access Token to read leads. Those are usually valid up to 60 minutes, but you can convert them to Long Lived Tokens to extend the time window https://developers.facebook.com/docs/facebook-login/access-tokens/refreshing/#long-lived-access-toke...
- please realign your parameters as in the above screenshot you are trying to push your client ID and secret within the body of your request, instead of being header parameters https://www.techopedia.com/definition/27178/http-header. .. Add the client_id, client_secret and grant_type (and all additional parameters) to the header and remove from the body
- use either the generic table of HTTP error codes https://docs.mashery.com/design/GUID-01FE69BD-82F3-4471-B7A8-EF00798C4168.html to understand the issue you are facing or more specific Facebook API related ones: https://developers.facebook.com/docs/marketing-api/error-reference
Hi @fordosa90 thanks a lot for your reply, I am able to get he leads using http action of power automate, but I am getting page access token from Graph API Explorer tool of fb, there I gave permissions and clicked on generate token then I extended that token, but still sometime I get error in powerautomate that your token is expired or you dnt have require access,
but from 2 days I am not getting this error, not what I am trying to do is I am getting the leads from 2 forms of fb, this info is stored inside "field_data" array after parsing json, this goes inside apply to each loop, can you help me to create a common CSV table/excel where leads from all the forms gets stored ?refer screenshots of my full flow
@fordosa90 I need help with:
1. I should pass permission from power automate http action to get the access token , I dnt want that everytime I should visit graph api explorer to get the tokens,
2. How I can create one CSV Table where leads from all the form are stored.
Let me know if some point is not clear
Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.
Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.
The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.