ボットからWebhookを操作する

ボットを作成または編集する際には、通常の[+]をクリックしてアクションを追加することで、Webhookを追加できます。アクション選択パネルで、[Webhookをトリガー]をクリックします。trigger-a-webhook

次に、アクションにニックネームを付けて、WebhookのエンドポイントURLを入力します。リクエストに対するレスポンスとして貴社のWebhookからHubSpotにデータを送信する場合は、[Webhookのフィードバックを待機]ボックスをオンにします(この後、詳しく説明します)。アクションを保存します。trigger-a-webhook-editorコミュニケーション内でこのアクションに到達すると、定義したWebhook URLにHubSpotからJSONペイロードが送信されます。ペイロードには、チャットセッションに関する情報(質問に対する訪問者の回答、訪問者のコンタクトIDなど)とボットに関する情報が格納されます。

リクエストペイロードの例:
//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 } } } } }

高度な利用方法として、WebhookのレスポンスにJSONを含めることもできます。その結果、コミュニケーションのフローに影響を与えたり、カスタムメッセージを送信したりできます。

レスポンスペイロードの例:
//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. }

参考になりましたか?
こちらのフォームではドキュメントに関するご意見をご提供ください。HubSpotがご提供しているヘルプはこちらでご確認ください。