Cuando alguien toca el botón de postback, la plataforma de Messenger envía un evento a tu webhook de postback. Esto sirve cuando quieres invocar una acción en tu bot. Este botón se puede usar con la plantilla de botón y la plantilla genérica.
Para obtener más información sobre cómo usar el botón de postback, consulta la sección Botón de postback.
{
"type":"postback",
"title":"<BUTTON_TEXT>",
"payload":"<DEVELOPER_DEFINED_PAYLOAD>"
}
curl -X POST -H "Content-Type: application/json" -d '{
"recipient":{
"id":"<PSID>"
},
"message":{
"attachment":{
"type":"template",
"payload":{
"template_type":"button",
"text":"Try the postback button!",
"buttons":[
{
"type":"postback",
"title":"Postback Button",
"payload":"DEVELOPER_DEFINED_PAYLOAD"
}
]
}
}
}
}' "https://graph.facebook.com/v2.6/me/messages?access_token=<PAGE_ACCESS_TOKEN>"
{ "recipient_id": "1254477777772919", "message_id": "AG5Hz2Uq7tuwNEhXfYYKj8mJEM_QPpz5jdCK48PnKAjSdjfipqxqMvK8ma6AC8fplwlqLP_5cgXIbu7I3rBN0P" }
Propiedad | Tipo | Descripción |
---|---|---|
| Cadena | Tipo de botón. Debe ser |
| Cadena | Título del botón. Límite de 20 caracteres. |
| Cadena | Los datos se devolverán a tu webhook. Límite de 1.000 caracteres. |