Trabalhando com webhooks de bots

Ao criar ou editar um bot, você pode adicionar um webhook se clicar no “+” para adicionar uma ação como normalmente faria. No painel de seleção de ação, clique em “Disparar um webhook”.trigger-a-webhook

Em seguida, crie um apelido à sua ação e insira o URL do endpoint do webhook. Se seu webhook estiver enviando dados para o HubSpot em resposta à solicitação, marque a caixa “Aguarde o feedback do webhook”. (Leia mais sobre isso abaixo.) Salve sua ação. trigger-a-webhook-editorQuando essa ação foi atingida em uma conversa, o HubSpot enviará uma carga útil JSON ao URL do Webhook que você definiu. A carga útil conterá informações relevantes à sessão de chat, incluindo as respostas dos visitantes a qualquer pergunta, o ID de contato deles e as informações sobre o bot.

Exemplo de carga útil de solicitação:
//sample payload { "userMessage": { // Details for the last message sent to your bot "message": "100-500", // The last message received by your bot, sent by the visitor "quickReply": { // If the visitor selected any quick reply options, this will be a list of the selected options. // Will be 'null' if no options were selected. "quickReplies":[ // A list of quick reply options selected by the visitor { "value":"100-500", "label":"100-500" } ], }, "session": { "vid": 12345, // The contact VID of the visitor, if known. "properties": { // A list of properties collected by the bot in the current session. "CONTACT": { "firstname": { "value": "John", "syncedAt": 1534362540592 }, "email": { "value": "testing@domain.com", "syncedAt": 1534362541764 }, "lastname": { "value": "Smith", "syncedAt": 1534362540592 } } } } }

Usuários avançados também têm a opção de incluir JSON na resposta do webhook. Ao fazer isso, você pode afetar o fluxo de conversa ou enviar uma mensagem personalizada.

Exemplo de carga útil de resposta:
//sample payload { "botMessage": null, // This is the message your bot will display to the visitor. "nextModuleNickname": "PromptForCollectUserInput", // If defined, this will be the next module your bot will go to. If undefined, the default configured behavior will be observed. "responseExpected": false // If true, the webhook will be triggered again with the visitor's next reply. If false, the default configured behavior will be observed. }

Este artigo foi útil?
Este formulário deve ser usado apenas para fazer comentários sobre esses artigos. Saiba como obter ajuda para usar a HubSpot..