Webhook

Chat Ended Event

​

Resia sends this when a chat using a Chat Agent that has a chat_ended_webhook_url reaches a terminal status (completed, failed, or cancelled). type is chat.ended and chat is the same record GET /v1/chats/{chat_id} returns, built when the event is sent. Reply with any 2xx to acknowledge; Resia uses the call.ended retry schedule and repeats the same chat.id each time, so treat a repeated chat.id as a duplicate. Each attempt is one row in GET /v1/request-logs.

Body·

required
application/json

The event Resia sends after a Chat Agent chat reaches a terminal status (ENG-3621).

It nests the same ChatDetail read model that GET /v1/chats/{chat_id} returns, so a customer routes on type and reads the finished conversation and its analysis under chat.

  • One chat run and its conversation so far, as GET /v1/chats/{id} and the chat.ended webhook see it.

    Properties: 15

Responses

  • application/json
  • application/json
Request Example for postchat.ended
{
  "type": "chat.ended",
  "chat": {
    "id": "",
    "chat_agent_id": "",
    "chat_agent_version_id": "",
    "status": "pending",
    "channel": "sms",
    "participant_handle": "+14155550123",
    "agent_handle": "+14155550199",
    "transcript": [
      {
        "role": "contact",
        "content": "",
        "sent_at": ""
      }
    ],
    "analysis": {
      "additionalProperty": "anything"
    },
    "milestone": "",
    "failure": {
      "code": "recipient_opted_out",
      "message": ""
    },
    "created_at": "",
    "started_at": "",
    "updated_at": "",
    "ended_at": ""
  }
}
null