I would like to send a type:postback
with payload:My Message
through an HTML page defined in a web_url. I have these codes:
{
"title": "Open Hello World Popup",
"type": "web_url",
"url": "https://xxxxxxxx.xxxxxx.xxxxx/testpage.html",
"webview_height_ratio": "tall",
"webview_share_button": "hide",
"messenger_extensions": true
},
{
"title": "Send Hello World!",
"type": "postback",
"payload": "SEND_HELLO_WORLD"
},
How do I send a postback with a message payload from a link or button defined in my testpage.html
<h1>Test Page</h1>
<a href="POSTBACK_SEND_HELLO_WORLD???">Send Hello World!</a>
Is this even possible?
m.me links If the user hasn't already started a chat with you page on facebook, then you should be able to use a m.me link.
For Example: I want to send a custom payload "HELLO_USER" that will trigger after the "Get Started" Button is clicked.
m.me link that will be used on html page:
http://m.me/<YOUR_PAGE_NAME?ref=HELLO_USER
In your webhook you should receive an event after the "Get Started" button is clicked with the data ref that is passed. Retrieve the ref from the referral object in your webhook event.
Check out the docs Facebook m.me links
Also, check out the Send to Messenger Plugin if you want the webhook event to trigger without pressing the "Get Started" Button.
Hope this helps.