Reputation: 71
I have a facebook page, and a website too. I need to add a button to my website, like "SEND THIS ARTICLE ON MESSENGER". When the user clicks on it, I need to send the article data to the user on messenger.
How can I achieve that?
Upvotes: 1
Views: 4611
Reputation: 487
To achieve your goal, You must have to use SEND TO MESSENGER Button.
Ref.: https://developers.facebook.com/docs/messenger-platform/discovery/send-to-messenger-plugin/
Full process to implement: 1. Need to integrate Facebook Div in your site 2. Add Facebook script 3. Once Any User press the button than You got the webhook event from the facebook which contatin the PSID. 4. Through this PSID You can sent the messege to that id.
If you are sending message using curl than following is the code
curl -X POST -H "Content-Type: application/json" -d '{
"recipient": {
"id": "<PSID>"
},
"message": {
"text": "hello, world!"
}
}' "https://graph.facebook.com/v2.6/me/messages?access_token=<FB_PAGE_TOKEN>";
Upvotes: 3