Webhook receives messages
Last updated:2024-12-29

Webhook receives messages

When using the webhook mode to request the Send Message API, submit the content of the response message from the Bot or human customer service to the specified webhook address.

Request Method

POST

Endpoint

Please configure your message acceptance address on the Bot - 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"
}
'

        
This code block in the floating window

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 Required Description
message_id string Yes Unique message ID.
message_type string Yes Message type, possible values: ANSWER, QUESTION.
text string No Reply text.
flow_output JSON Array No Content of the flow bot's reply.
content string No Flow bot component reply text.
branch string No Flow bot branch.
from_component_name string No Flow bot upstream component name.
create_time long Yes Timestamp when the reply message was created.
conversation_id string Yes Conversation ID.

Response

Response Example

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

        
This code block in the floating window