Mensagem para enviar
Objeto que representa a mensagem, possui a seguinte estrutura json
{
"messageType": "string",
"source": "string",
"message": "string",
"subject": "string",
"caption": "string",
"address": "string",
"name": "string",
"options": "string",
"fileName": "string",
"replyMessageId": "string",
"delayTyping": "int",
"expires": "datetime",
"template": "string",
"contact": "string",
"clientInstanceId":"string",
"instanceKey": "string",
"instanceSecret": "string"
}
Descrição de cada propriedade
| messageType |
string |
obrigatório |
Tipo de mensagem, retorno: TEXT, FILE, BUTTON, MEDIA, LINK,CONTACT, OPTIONLIST, BUTTONACTIONS |
| source |
string |
obrigatório |
Origem da mensagem, retorno; ACTIVE, CLIENT, CHAT, MAILING, BOT, INFO, TROCA_CHIP, SUSPENSO |
| message |
string |
obrigatório |
Conteúdo principal da mensagem |
| subject |
string |
opcional |
Representa o assunto da mensagem |
| caption |
string |
opcional |
Representa uma legenda ou uma descrição da mensagem, exemplo: descrição de um arquivo ou imagem |
| address |
string |
obrigatório |
Endereço da mensagem, exemplo: telefone, email, nickname, ou outra informação que represente um cliente |
| name |
string |
opcional |
Nome do cliente |
| options |
string |
opcional |
String com estrutura json serializada, representa tipos de botões e listas. |
| fileName |
string |
opcional |
Nome com extessão do arquivo, exemplo; arquivo.pdf |
| replyMessageId |
string |
opcional |
Indica se a mensagem é uma resposta ou citação de outra mensagem, no caso o retorno e o id da mensagem |
| delayTyping |
int |
opcional |
Indica o tempo de digitação no whatsapp, enviado em milesegundos |
| expires |
datetime |
opcional |
Indica a data limite que essa mensagem pode ser enviada |
| template |
string |
opcional |
Modelo da mensagem |
| contact |
string |
obrigatório |
Responsável pelo envio da mensagem, pode ser um email, numero, ou chave que identifique o remetente |
clientInstanceId
|
string |
opcional |
String que pode ser usada para identificar o cliente na instancia |
| instanceKey |
string |
obrigatório |
Chave da instancia vinculada a mensagem |
| instanceSecret |
string |
obrigatório |
Secret da instancia vinculada a mensagem |
De acordo com o valor enviado na propriedade messageType, os valores da propriedade options terá uma estrutura json diferente, como mapeamento abaixo:
BUTTON
| buttons |
array |
obrigatório |
Listas dos botões |
| id |
string |
obrigatório |
Id que representa o botão |
| label |
string |
obrigatório |
Texto vinculado ao botão |
{
"buttons": [
{
"id": "1",
"label": "I like"
},
{
"id": "2",
"label": "I love"
},
{
"id": "3",
"label": "I dont like"
}
]
}OPTIONLIST
title
|
string |
obrigatório |
Titulo da lista de opções |
buttonLabel
|
string |
obrigatório |
Nome do botão que irá abrir as opções |
options
|
array |
obrigatório |
Lista das opções |
| id |
string |
obrigatório |
Id vinculada ao ao item opção |
| description |
string |
obrigatório
|
Texto descritivo vinculado ao item opção |
| title |
string |
obrigatório
|
Titulo do botão do item opção |
{
"title": "Options available",
"buttonLabel": "Opem options list",
"options": [
{
"id": "1",
"description": "desciption option 1.",
"title": "title option 1"
},
{
"id": "2",
"description": "description option 1",
"title": "title option 2"
}
]
}BUTTONACTIONS
| id |
string |
obrigatório |
Id que representa o botão |
type
|
string |
obrigatório |
Tipo da ação do botão, existe 3 tipos de ação: CALL, URL, REPLAY |
| phone |
string |
obrigatório |
Telefone para realizar uma chamada |
| label |
string |
obrigatório |
Texto vinculado a ação do botão |
| url |
string |
obrigatório |
Url de redirecionamento |
[
{
"id": "0001",
"type": "CALL",
"phone": "5511999999999",
"label": "Call now"
},
{
"id": "0002",
"type": "URL",
"label": "View my contract",
"url": "https://link2go.com.br/contato"
},
{
"id": "0003",
"type": "REPLY",
"label": "Talk attendance"
}
]
| nome |
string |
obrigatório |
Nome do contato a ser enviado |
| contato |
string |
obrigatório |
Telefone ou email do contato |
{
"buttons": "Link2GO Suporte",
"contato": "5511913366330"
}
Consulte nosso github com exemplos: ACESSE AQUI