API & WEBHOOK
Aprenda a integrar via API WEBHOOK URL na Smart 2.0 Simplesdesk
Last updated
Aprenda a integrar via API WEBHOOK URL na Smart 2.0 Simplesdesk
Last updated
Aqui será apresentado o uso do PUSH na Simplesdesk Smart 2.0 Efetue o login na plataforma Simplesdesk > Configurações > API/WEBHOOK
PUSH: Esta função permite o envio de mensagens via API Cada envio, abrirá um novo ticket na fila de pendente, se não houver um ticket aberto para o contato na conexão(canal) escolhido para envio a ação após o envio permitirá fechar automaticamente ou manter o ticket aberto. A URL e o token podem ser gerados na plataforma. Para utilizar a URL (endpoint), basta clicar em ADICIONAR para criar a configuração para a API e preencher os campos de dados API (PUSH) como mostramos nas imagens abaixo
Metódo POST:
// Metodo post
https://URL_COPIADA_COM_TOKEN
Content-Type
application/json
Para enviar apenas texto
{
"body: "MENSAGEM", //Mensagem de texto
"number": "5511946431198", //Celular com DDI e DDD
"externalKey": "123456", //Valor obrigatório para possibilitar o rastreamento da mensagem
}
Para enviar imagens, vídeo, áudio ou documentos gerais
{
"number":"5511946431198", //Celular com DDI e DDD
"externalKey":"123456", //Valor obrigatório para possibilitar o rastreamento da mensagem
"body":"", //Mensagem de texto que será enviada como legenda/caption. Para não enviar deixe em branco
"mediaUrl":"https://exemplo.com/img.png" //url da mídia > vídeo, imagem, áudio, documentos gerais
A mensagem é inicialmente adicionada em uma fila para a mensagem ser processada sequencialmente
{
"message": "Message add queue"
}
Aqui será apresentado o uso do WEBHOOK na Simplesdesk Smart 2.0 Efetue o login na plataforma Simplesdesk > Configurações > API/WEBHOOK
Esta função permite o envio de dados do contato/atendimento a partir de um determinado evento(gatilho) que ocorre na plataforma
Dúvidas sobre o payload? Clique no ícone de ? para obter um exemplo de Payload para cada evento disponível
É possível fazer uma pesquisa pelos logs de requisição para API (PUSH) ou envio de dados para o Webhook
#
Id de identificação da requisição
Nome
Nome da Api
Evento
Nome do evento na plataforma
Tipo
Webhook ou API (Push)
Status
Falha ou sucesso (200)
Data
Data e hora da requisição
Ação
Detalhe do evento
//Payload
{
"contact": {
"id": 4200,
"name": "Christopher Zagato",
"number": "5511946431198",
"email": "simplesdesk@simplesdesk.com.br",
"profilePicUrl": null,
"tags": [
"Proposta"
],
"extrainfo": [],
"leadStatus": {
"id": 6,
"status": "Quente",
}
}
//Header
{
"Accept": "application/json, text/plain, */*,
"Content-Type": "application/json,
"User-Agent": "axios/0.21.4",
}
// ("event": "NewContact")
{
"contact": {
"id": 17256,
"name": "Nome do Contato",
"number": "559999009900",
"email": "",
"profilePicUrl": "https://pps.whatsapp.net/v/...",
"tags": [
"Cliente",
"OutraTag"
],
"extraInfo": [],
"leadStatus": {
"id": 2,
"status": "Em atendimento ",
"color": "#0000d6",
"active": true,
"createdAt": "2023-03-20T17:31:12.723Z",
"updatedAt": "2023-03-20T17:31:12.723Z"
}
},
"userId": 1,
"tenantId": 1,
"wallets": [
{
"id": 1,
"name": "Administrador",
"ContactWallet": {
"id": 44,
"contactId": 17256,
"walletId": 1,
"tenantId": 1,
"createdAt": "2023-06-05T12:07:48.557Z",
"updatedAt": "2023-06-05T12:07:48.557Z"
}
}
],
"tenantId": 1,
"event": "NewContact"
}
{
"ticket": {
"id": 9902,
"status": "open",
"unreadMessages": 0,
"lastMessage": "Aguarde, logo você será atendido.\\nNosso atendimento atendimento é de Segunda a Sexta",
"channel": "whatsapp",
"answered": true,
"isGroup": false,
"isActiveDemand": false,
"isCreatedAtAPI": false,
"lastInteractionBot": "2023-06-05T12:06:38.486Z",
"botRetries": 0,
"closedAt": null,
"lastMessageAt": "1685966800307",
"startedAttendanceAt": 1685966800307,
"userId": 1,
"contactId": 17256,
"whatsappId": 1,
"autoReplyId": null,
"setUpAutoReplyId": null,
"chatFlowId": null,
"stepChatFlow": null,
"queuedId": 2,
"closingReasonId": null,
"tenantId": 1,
"apiConfigId": null,
"createdAt": "2023-06-01T13:25:05.089Z",
"updatedAt": "2023-06-05T12:07:09.586Z",
"contact": {
"id": 17256,
"name": "Nome do contato",
"number": "559999009900",
"email": "",
"profilePicUrl": "https://pps.whatsapp.net/v.../",
"pushname": "Nome do contato",
"observations": null,
"telegramId": null,
"messengerId": null,
"instagramPK": null,
"isUser": true,
"isWAContact": true,
"isGroup": false,
"leadStatusId": null,
"tenantId": 1,
"customFields": {
"cpf": "12312312311"
},
"tags": [],
"createdAt": "2023-05-21T21:15:15.480Z",
"updatedAt": "2023-06-05T12:06:24.474Z",
"extraInfo": [],
"leadStatus": null,
"wallets": []
},
"user": null,
"tenantId": 1,
"event": "StartedTicket"
}
}
{
"ticket": {
"id": 9902,
"status": "open",
"unreadMessages": 0,
"lastMessage": "Aguarde, logo você será atendido.\\nNosso atendimento atendimento é de Segunda a Sexta",
"channel": "whatsapp",
"answered": true,
"isGroup": false,
"isActiveDemand": false,
"isCreatedAtAPI": false,
"lastInteractionBot": "2023-06-05T12:06:38.486Z",
"botRetries": 0,
"closedAt": null,
"lastMessageAt": "1685966800307",
"startedAttendanceAt": 1685966829586,
"userId": 1,
"contactId": 17256,
"whatsappId": 1,
"autoReplyId": null,
"stepAutoReplyId": null,
"chatFlowId": null,
"stepChatFlow": null,
"queuedId": 2,
"closingReasonId": null,
"tenantId": 1,
"apiConfigId": null,
"createdAt": "2023-06-01T13:25:05.089Z",
"updatedAt": "2023-06-05T12:07:09.586Z",
"contact": {
"id": 17256,
"name": "Nome do contato",
"number": "559999099900",
"email": "",
"profilePicUrl": "https://pps.whatsapp.net/v/.../",
"pushname": "Nome do contato",
"observations": null,
"telegramId": null,
"messengerId": null,
"instagramPK": null,
"isUser": true,
"isWAContact": true,
"isGroup": false,
"leadStatusId": null,
"tenantId": 1,
"customFields": {
"cpf": "12312312311"
},
"tags": [],
"createdAt": "2023-05-21T21:15:15.480Z",
"updatedAt": "2023-06-05T12:06:24.474Z",
"extraInfo": [],
"leadStatus": null,
"wallets": []
},
"user": null
},
"tenantId": 1,
"event": "TransferOfTicket"
}
{
"connection": {
"UrlWabaWebHook": "",
"UrlMessengerWebHook": "",
"id": 1,
"name": "Linha 2",
"qrcode": "",
"status": "CONNECTED",
"battery": "20",
"plugged": false,
"isActive": true,
"isRejectCall": true,
"callRejectedMessage": null,
"isDeleted": false,
"retries": 0,
"isDefault": true,
"instagramUser": null,
"fbPageId": null,
"type": "whatsapp",
"number": "5599999999999",
"phone": {},
"tenantId": 1,
"createdAt": "2021-03-12T02:23:17.000Z",
"updatedAt": "2023-06-05T12:46:57.643Z",
"chatFlowId": 1,
"defaultQueueId": 6
},
"tenantId": 1,
"event": "ConnectionStatusUpdate"
}
{
"contact": {
"id": 17256,
"name": "Nome do Contato",
"number": "559999099900",
"email": "",
"profilePicUrl": "https://pps.whatsapp.net/v/...",
"tags": [
"Cliente",
"OutraTag"
],
"extraInfo": [],
"leadStatus": {
"id": 2,
"status": "Em atendimento",
"color": "#0000d6",
"active": true,
"createdAt": "2023-03-20T17:31:12.723Z",
"updatedAt": "2023-03-20T17:31:12.723Z",
"userId": 1,
"tenantId": 1
},
"wallets": [
{
"id": 1,
"name": "Administrador",
"ContactWallet": {
"id": 44,
"contactId": 17256,
"walletId": 1,
"tenantId": 1,
"createdAt": "2023-06-05T12:07:48.557Z",
"updatedAt": "2023-06-05T12:07:48.557Z"
}
}
]
},
"tenantId": 1,
"event": "UpdateContact"
}
{
"ticket": {
"id": 9902,
"status": "open",
"unreadMessages": 0,
"lastMessage": "Aguarde, logo você será atendido.\\nNosso atendimento atendimento é de Segunda a Sexta",
"channel": "whatsapp",
"answered": true,
"isGroup": false,
"isActiveDemand": false,
"isCreatedAtAPI": false,
"lastInteractionBot": "2023-06-05T12:06:38.486Z",
"botRetries": 0,
"closedAt": null,
"lastMessageAt": "1685966800307",
"startedAttendanceAt": 1685966829586,
"userId": 1,
"contactId": 17256,
"whatsappId": 1,
"autoReplyId": null,
"stepAutoReplyId": null,
"chatFlowId": null,
"stepChatFlow": null,
"queuedId": 2,
"closingReasonId": null,
"tenantId": 1,
"apiConfigId": null,
"createdAt": "2023-06-01T13:25:05.089Z",
"updatedAt": "2023-06-05T12:07:09.586Z",
"contact": {
"id": 17256,
"name": "Nome do contato",
"number": "559999099900",
"email": "",
"profilePicUrl": "https://pps.whatsapp.net/v/...",
"pushname": "Nome do contato",
"observations": null,
"telegramId": null,
"messengerId": null,
"instagramPK": null,
"isUser": true,
"isWAContact": true,
"isGroup": false,
"leadStatusId": null,
"tenantId": 1,
"customFields": {
"cpf": "12312312311"
},
"tags": [],
"createdAt": "2023-05-21T21:15:15.480Z",
"updatedAt": "2023-06-05T12:06:24.474Z",
"extraInfo": [],
"leadStatus": null,
"wallets": []
},
"user": null
},
"tenantId": 1,
"event": "FinishedTicket"
}
{
"message": {
"mediaName": null,
"mediaUrl": null,
"msgCreatedAt": "2023-06-05T12:06:40.000Z",
"id": "e3b501ba-91ab-4066-a8da-3b67da787f4e",
"wabaMediaId": null,
"isDeleted": false,
"userId": null,
"scheduleDate": null,
"ticketId": 9902,
"body": "Aguarde, logo você será atendido.\\nNosso atendimento atendimento é de Segunda a Sexta das 08h",
"contactId": 17256,
"fromMe": true,
"read": true,
"mediaType": "chat",
"timestamp": "1685966800",
"quotedMsgId": null,
"sendType": "bot",
"tenantId": 1,
"note": false,
"isTransfer": false,
"status": "sent",
"ack": 0,
"messageId": "3E8073CACCBDF2B747D45E",
"updatedAt": "2023-06-05T12:06:40.079Z",
"createdAt": "2023-06-05T12:06:40.079Z",
"idFront": null
},
"tenantId": 1,
"event": "NewMessage"
}
{
"ticket": {
"id": 9902,
"status": "open",
"unreadMessages": 0,
"lastMessage": "Aguarde, logo você será atendido.\\nNosso atendimento atendimento é de Segunda a Sexta",
"channel": "whatsapp",
"answered": true,
"isGroup": false,
"isActiveDemand": false,
"isCreatedAtAPI": false,
"lastInteractionBot": "2023-06-05T12:06:38.486Z",
"botRetries": 0,
"closedAt": null,
"lastMessageAt": "1685966800307",
"startedAttendanceAt": 1685966829586,
"userId": 1,
"contactId": 17256,
"whatsappId": 1,
"autoReplyId": null,
"stepAutoReplyId": null,
"chatFlowId": null,
"stepChatFlow": null,
"queuedId": 2,
"closingReasonId": null,
"tenantId": 1,
"apiConfigId": null,
"createdAt": "2023-06-01T13:25:05.089Z",
"updatedAt": "2023-06-05T12:07:09.586Z",
"contact": {
"id": 17256,
"name": "Nome do contato",
"number": "559999099900",
"email": "",
"profilePicUrl": "https://pps.whatsapp.net/v/...",
"pushname": "Nome do contato",
"observations": null,
"telegramId": null,
"messengerId": null,
"instagramPK": null,
"isUser": true,
"isWAContact": true,
"isGroup": false,
"leadStatusId": null,
"tenantId": 1,
"customFields": {
"cpf": "12312312311"
},
"tags": [],
"createdAt": "2023-05-21T21:15:15.480Z",
"updatedAt": "2023-06-05T12:06:24.474Z",
"extraInfo": [],
"leadStatus": null,
"wallets": []
},
"user": null
},
"tenantId": 1,
"event": "UpdateOnTicket"
}
{
"ticket": {
"id": 9902,
"status": "open",
"unreadMessages": 0,
"lastMessage": "Aguarde, logo você será atendido.\\nNosso atendimento atendimento é de Segunda a Sexta",
"channel": "whatsapp",
"answered": true,
"isGroup": false,
"isActiveDemand": false,
"isCreatedAtAPI": false,
"lastInteractionBot": "2023-06-05T12:06:38.486Z",
"botRetries": 0,
"closedAt": null,
"lastMessageAt": "1685966800307",
"startedAttendanceAt": 1685966829586,
"userId": 1,
"contactId": 17256,
"whatsappId": 1,
"autoReplyId": null,
"stepAutoReplyId": null,
"chatFlowId": null,
"stepChatFlow": null,
"queuedId": 2,
"closingReasonId": null,
"tenantId": 1,
"apiConfigId": null,
"createdAt": "2023-06-01T13:25:05.089Z",
"updatedAt": "2023-06-05T12:07:09.586Z",
"contact": {
"id": 17256,
"name": "Nome do contato",
"number": "559999099900",
"email": "",
"profilePicUrl": "https://pps.whatsapp.net/v/...",
"pushname": "Nome do contato",
"observations": null,
"telegramId": null,
"messengerId": null,
"instagramPK": null,
"isUser": true,
"isWAContact": true,
"isGroup": false,
"leadStatusId": null,
"tenantId": 1,
"customFields": {
"cpf": "12312312311"
},
"tags": [],
"createdAt": "2023-05-21T21:15:15.480Z",
"updatedAt": "2023-06-05T12:06:24.474Z",
"extraInfo": [],
"leadStatus": null,
"wallets": []
},
"user": null
},
"tenantId": 1,
"event": "NewTicket"
}
{
"ack": 2,
"id": "a9985ce6-671a-4de9-b7a0-ce4791fdd95fc",
"messageId": "3EBD81AFDAE68EAFBBC2F2",
"ticketId": 9902,
"tenantId": 1,
"event": "AckMessage"
}
Caso tenha alguma dúvida, é só chamar nosso time de suporte da Simplesdesk. Ou, se preferir, chame através do nosso 😉