この記事では、Webhook 経由で転送できるサポートされているイベントについて説明します。Webhook は、すべてのアカウントに対して定義できる HTTP コールバックです。これらは、MessageHub でのメッセージ作成などのイベントによってトリガーされます。複数の Webhook を MessageHub アカウントに接続できます。
大事な
Webhook のサポートは限られています。さらにサポートが必要な場合は、プロの開発者にお問い合わせください。
必要条件
アクティブなClickFunnelsアカウント
MessageHubアプリ
オブジェクト
イベントには、ペイロードとして次のいずれかのオブジェクトを含めることができます。MessageHub でサポートされているさまざまなタイプのオブジェクトは次のとおりです。
account
アカウントに対して次のペイロードが返されます。
{
"id": "integer",
"name": "string"
}
inbox
次のペイロードが受信トレイに返されます。
{
"id": "integer",
"name": "string"
}
contact
連絡先に対して次のペイロードが返されます。
{
"id": "integer",
"name": "string",
"avatar": "string",
"type": "contact",
"account": {
// <...account Object Attributes>
}
}
user
次のペイロードがエージェント/管理者に対して返されます。
{
"id": "integer",
"name": "string",
"email": "string",
"type": "user"
}
conversation
会話に対して次のペイロードが返されます。
{
"additional_attributes": {
"browser": {
"device_name": "string",
"browser_name": "string",
"platform_name": "string",
"browser_version": "string",
"platform_version": "string"
},
"referer": "string",
"initiated_at": {
"timestamp": "iso-datetime"
}
},
"can_reply": "boolean",
"channel": "string",
"id": "integer",
"inbox_id": "integer",
"contact_inbox": {
"id": "integer",
"contact_id": "integer",
"inbox_id": "integer",
"source_id": "string",
"created_at": "datetime",
"updated_at": "datetime",
"hmac_verified": "boolean"
},
"messages": [
// Array Of message Objects
],
"meta": {
"sender": {
// contact Object Attributes
},
"assignee": {
// user Object Attributes
}
},
"status": "string",
"unread_count": "integer",
"agent_last_seen_at": "unix-timestamp",
"contact_last_seen_at": "unix-timestamp",
"timestamp": "unix-timestamp",
"account_id": "integer"
}
message
メッセージに対して次のペイロードが返されます。
{
"id": "integer",
"content": "string",
"message_type": "integer",
"created_at": "unix-timestamp",
"private": "boolean",
"source_id": "string / null",
"content_type": "string",
"content_attributes": "object",
"sender": {
"type": "string - contact/user"
// user Or contact Object Attributes
},
"account": {
// account Object Attributes
},
"conversation": {
// conversation Object Attributes
},
"inbox": {
// inbox Object Attributes
}
}
Webhook ペイロードの例
次に、返される最終的な Webhook ペイロードの例を示します。
{
"event": "event_name"
// Attributes related to the event
}
イベント
MessageHub は、次の Webhook イベントをサポートしています。ダッシュボードで Webhook を設定したり、API を使用してサブスクライブしたりできます。
大事な
カスタムコードでは大文字と小文字が区別されます。表示されているとおりに追加することが重要です。
conversation_created
このイベントは、アカウントで新しい会話が作成されるとトリガーされます。イベントのペイロードは次のとおりです。
{
"event": "conversation_created"
// <...conversation Object Attributes>
}
conversation_updated
このイベントは、会話のいずれかの属性に変更があったときにトリガーされます。
{
"event": "conversation_updated" ,
"changed_attributes": [
{
"<attribute_name>": {
"current_value": "",
"previous_value": ""
}
}
]
// <...conversation Object Attributes>
}
conversation_status_changed
このイベントは、会話の状態が変更されたときにトリガーされます。
手記
Webhook の代わりにエージェント ボット API を使用している場合、このイベントはまだサポートされていません。
{
"event": "conversation_status_changed"
// <...conversation Object Attributes>
}
message_created
このイベントは、会話でメッセージが作成されるとトリガーされます。イベントのペイロードは次のとおりです。
{
"event": "message_created"
// <...message Object Attributes>
}
message_updated
このイベントは、会話でメッセージが更新されたときにトリガーされます。イベントのペイロードは次のとおりです。
{
"event": "message_updated"
// <...message Object Attributes>
}
webwidget_triggered
このイベントは、エンドユーザーがライブチャットウィジェットを開いたときにトリガーされます。
{
"id": "integer",
"contact": {
// <...contact Object Attributes>
},
"inbox": {
// <...inbox Object Attributes>
},
"account": {
// <...account Object Attributes>
},
"current_conversation": {
// <...conversation Object Attributes>
},
"source_id": "string",
"event": "webwidget_triggered",
"event_info": {
"initiated_at": {
"timestamp": "date-string"
},
"referer": "string",
"widget_language": "string",
"browser_language": "string",
"browser": {
"browser_name": "string",
"browser_version": "string",
"device_name": "string",
"platform_name": "string",
"platform_version": "string"
}
}
}