-1

I need to create a facebook app in which, when a user subscribes to my app i have to modify the callback url of the messenger webhook of one of its pages (the one he selects), is this possible with the facebook api?

Without knowing what I have to do yet and having spent hours in the documentation and searching, I think the steps to follow would be something like this,

1 create the app

2 get the necessary permissions and approval from facebook

3 encode facebook login in my website

4 once the user logs in, get user token

4 list the user's pages, retrieved with their token.

5 get token from page selected by the user

6 get token that does not expire from the user's page

7 get by means of the end point "/ sucribtions" modify the calback url of the messenger webhook of the page I select

is this possible programmatically?

Thanks in advance.

JG73
  • 90
  • 1
  • 10
  • 1
    Pure code-writing requests are off-topic on Stack Overflow — we expect questions here to relate to *specific* programming problems — but we will happily help you write it yourself! Tell us [what you've tried](https://stackoverflow.com/help/how-to-ask), and where you are stuck. This will also help us answer your question better. – shreyasm-dev Dec 18 '20 at 18:50
  • I do not know if I have explained myself wrong, I do not ask anyone to write me the code, I just want to know, before continuing with my development, if anyone knows if it is possible to do it, or otherwise it is not possible, modify the calback url of the webhook messenger page of a facebook user who connects to my facebook app. I would like to know if my path is correct or if not, take another one, Thank you very much for your answer. – JG73 Dec 18 '20 at 20:10

1 Answers1

0

The answer is that yes it can, the following permissions must be requested in the messenger product of your page_show_list app , page_messaging, page_manage_metadata

You have to request the facebook login product in your application

develop the login.

When a user "installs" your application on the login page, the pages he manages will appear and he will be able to select the pages he wants to be managed by your application.

It will return a code, with which you must obtain the user token, with this user token generate a long-term user token and with this long-term user token you can obtain a page token that does not expire. (it will be the one you save in your system to perform actions on behalf of the page)

once you have everything with the edge / subscribe_app, you have to send the subscribed_fields = messages parameter, it is the minimum to receive a messenger message from a facebook page,

Your webhook will be one and the pages that install your application are subscribed to it.

I still have to develop but everything already works, if it helps someone I am happy, if someone needs help I will be happy to provide it.

JG73
  • 90
  • 1
  • 10