Webhook Mode
最新の更新:2024-12-29

Webhook Mode

The current GPTBots Agent message response modes support: blocking, streaming, and webhook. When developers use the webhook mode to receive response messages, the message content provided by the Agent or human customer service will be submitted to the specified webhook address.

Request Method

POST

Endpoint

Please configure your message acceptance address on the Agent - Integration - API - webhook page.

Authentication

For details, refer to the authentication method description in the API Overview.

Request

Request Example

curl -X POST YOUR_API \ -H 'Authorization: Bearer your_apikey' \ -H 'Content-Type: application/json' \ -d '{ "message_id": "65a4ccfC7ce58e728d5897e0", "message_type": "ANSWER", "text": "Hi, is there anything I can help you?", "flow_output": [ { "content": "你好", "branch": "1", "from_component_name": "User Input" } ], "create_time": 1679587005, "conversation_id": "657303a8a764d47094874bbe" } '
          curl -X POST YOUR_API \ 
  -H 'Authorization: Bearer your_apikey' \ 
  -H 'Content-Type: application/json' \ 
  -d '{
  "message_id": "65a4ccfC7ce58e728d5897e0",
  "message_type": "ANSWER",
  "text": "Hi, is there anything I can help you?",
  "flow_output": [
    {
      "content": "你好",
      "branch": "1",
      "from_component_name": "User Input"
    }
  ],
  "create_time": 1679587005,
  "conversation_id": "657303a8a764d47094874bbe"
}
'

        
このコードブロックは、フローティングウィンドウに表示されます

Request Headers

Field Type Description
Authorization Bearer or Basic ${token} Use Authorization: Bearer OR Basic ${token} for authentication. Obtain the token from the API Key page.
Content-Type application/json Data type, value is application/json.

Request Body

Field Type Description
message_id string Unique ID of the message.
message_type string Message type, values: ANSWER, QUESTION.
text string Text content provided by the Agent.
flow_output JSON Array Content of the Agent's reply in Flow mode.
content string Text reply from the Agent component in Flow mode.
branch string Branch of the Agent in Flow mode.
from_component_name string Upstream component name of the Agent in Flow mode.
create_time long Timestamp when the reply message was created.
conversation_id string Conversation ID.

Response

Response Example

{ "code": 200, "msg": "success" }
          {
  "code": 200,
  "msg": "success"
}

        
このコードブロックは、フローティングウィンドウに表示されます