Send a message to the assistant

POST /v1/Assistants/{id}/Messages

send a message

Path parameters

  • id string Required

    the Assistant ID.

application/json

Body Required

  • identity string Required

    The unique identity of user for the session.

  • session_id string

    The unique name for the session.

  • body string Required

    The query to ask the assistant.

  • webhook string

    The webhook url to call after the assistant has generated a response or report an error.

  • mode string

    one of the modes 'chat', 'email' or 'voice'

    Default value is chat.

Responses

  • 200 application/json

    OK

    Hide response attributes Show response attributes object
    • status string Required

      success or failure based on whether the request successfully generated a response.

    • flagged boolean

      If successful, this property will denote whether the response was flagged or not.

    • aborted boolean

      This property will denote whether the request was aborted or not.

    • session_id string Required

      The unique name for the session.

    • account_sid string Required

      The SID of the Account that sent the Message.

      Minimum length is 34, maximum length is 34. Format should match the following pattern: ^AC[0-9a-fA-F]{32}$.

    • body string

      If successful, the body of the generated response

    • error string

      The error message if generation was not successful

  • 202 application/json

    OK

    Hide response attributes Show response attributes object
    • status string Required

      success or failure based on whether the request successfully generated a response.

    • flagged boolean

      If successful, this property will denote whether the response was flagged or not.

    • aborted boolean

      This property will denote whether the request was aborted or not.

    • session_id string Required

      The unique name for the session.

    • account_sid string Required

      The SID of the Account that sent the Message.

      Minimum length is 34, maximum length is 34. Format should match the following pattern: ^AC[0-9a-fA-F]{32}$.

    • body string

      If successful, the body of the generated response

    • error string

      The error message if generation was not successful

POST /v1/Assistants/{id}/Messages
curl \
 --request POST 'https://assistants.twilio.com/v1/Assistants/{id}/Messages' \
 --user "username:password" \
 --header "Content-Type: application/json" \
 --data '{"identity":"string","session_id":"string","body":"string","webhook":"string","mode":"chat"}'
Request examples
{
  "identity": "string",
  "session_id": "string",
  "body": "string",
  "webhook": "string",
  "mode": "chat"
}
Response examples (200)
{
  "status": "string",
  "flagged": true,
  "aborted": true,
  "session_id": "string",
  "account_sid": "string",
  "body": "string",
  "error": "string"
}
Response examples (202)
{
  "status": "string",
  "flagged": true,
  "aborted": true,
  "session_id": "string",
  "account_sid": "string",
  "body": "string",
  "error": "string"
}