Botões
Você pode usar botões com cada um destes tipos: call, url e node.
{
"version": "v1",
"content": {
"messages": [
{
"type": "text",
"text": "simple text",
"buttons": [
{
"type": "url",
"caption": "External link",
"url": "https://nicochat.com.br",
},
{
...Another buttons
}
]
},
{
...Another messages
}
],
"actions": [ //optional
{
"action": "add_tag",
"tag_name": "example tag"
},
{
...Another actions
}
],
"quick_replies": [ //optional
{
"type": "node",
"caption": "Quick reply text",
"target": "My Content"
},
{
...Another quick replies
}
]
}
}
{
"version": "v1",
"content": {
"messages": [
{
"type": "text",
"text": "simple text with button",
"buttons": [
{
"type": "call",
"caption": "Call me",
"phone": "+1 (555) 555-55-55"
}
]
}
],
"actions": [],
"quick_replies": []
}
}
Existem 3 opções de webview_size:
full — 100%,
medium — 75%,
compact — 50%
A propriedade "webview_size" é opcional.
{
"version": "v1",
"content": {
"messages": [
{
"type": "text",
"text": "simple text with button",
"buttons": [
{
"type": "url",
"caption": "External link",
"url": "https://nicochat.com.br",
"webview_size": "full"
}
]
}
],
"actions": [],
"quick_replies": []
}
}
{
"version": "v1",
"content": {
"messages": [
{
"type": "text",
"text": "simple text with button",
"buttons": [
{
"type": "node",
"caption": "Show",
"target": "My Content"
}
]
}
],
"actions": [],
"quick_replies": []
}
}
A chave target deve estar vinculada a um nó existente no fluxo em execução. O nome do nó aparece no cabeçalho dele; use um nome exclusivo para o nó conectado ao link. Se houver vários nós com nomes semelhantes dentro do mesmo fluxo, a transição não se comportará como o esperado. Os botões Ir para o nó não têm suporte na API pública.
As propriedades "headers" e "payload" são opcionais.
{
"version": "v1",
"content": {
"messages": [
{
"type": "text",
"text": "simple text with button",
"buttons": [
{
"type": "dynamic_block_callback",
"caption": "Dynamic content",
"url": "https://your-service.com/dynamic",
"method": "post",
"headers": {
"x-header": "value"
},
"payload": {
"key": "value"
}
}
]
}
],
"actions": [],
"quick_replies": []
}
}
O dynamic_block_callback funciona da mesma forma que o bloco dinâmico em um nó de conteúdo: ao ser clicado, envia uma solicitação ao servidor, e a resposta do servidor é enviada ao usuário. A URL do servidor externo deve usar o protocolo HTTPS.

