Send a message to an Assistant
success or failure based on whether the request successfully generated a response.
If successful, this property will denote whether the response was flagged or not.
The SID of the Account that sent the Message.
^AC[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The error message if generation was not successful
POST https://assistants.twilio.com/v1/Assistants/{id}/Messages
the Assistant ID.
application/json
The webhook url to call after the assistant has generated a response or report an error.
one of the modes 'chat', 'email' or 'voice'
chat
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function createMessage() {11const message = await client.assistants.v112.assistants("aia_asst_00000000-1111-2222-3333-444444444444")13.messages.create({14identity: "email:test@api.com",15body: "When was Twilio founded?",16});1718console.log(message.status);19}2021createMessage();
1{2"aborted": false,3"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",4"body": "This will be the body of the new message!",5"error": "error",6"flagged": false,7"session_id": "session_id",8"status": "status"9}