Create and configure Tools that an AI Assistant can use.
POST https://assistants.twilio.com/v1/Tools
application/json
The description of the tool.
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 createTool() {11const tool = await client.assistants.v1.tools.create({12name: "Schedule a Meeting",13type: "WEBHOOK",14description: "Use this to schedule a meeting",15enabled: true,16meta: {17url: "https://example.com",18method: "POST",19input_schema: "export type Data = { date: string }",20},21});2223console.log(tool.accountSid);24}2526createTool();
1{2"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"date_created": "2009-07-06T20:30:00Z",4"date_updated": "2009-07-06T20:30:00Z",5"description": "description",6"enabled": false,7"id": "aia_tool",8"meta": {},9"name": "name",10"requires_auth": false,11"type": "type",12"url": "url"13}
GET https://assistants.twilio.com/v1/Tools/{id}
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 fetchTool() {11const tool = await client.assistants.v1.tools("aia_tool").fetch();1213console.log(tool.accountSid);14}1516fetchTool();
1{2"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"date_created": "2009-07-06T20:30:00Z",4"date_updated": "2009-07-06T20:30:00Z",5"description": "description",6"enabled": false,7"id": "aia_tool",8"meta": {},9"name": "name",10"policies": [11{12"id": "aia_plcy",13"name": "name",14"description": "description",15"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",16"user_sid": "USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",17"type": "type",18"policy_details": {},19"date_created": "2009-07-06T20:30:00Z",20"date_updated": "2009-07-06T20:30:00Z"21}22],23"requires_auth": false,24"type": "type",25"url": "url"26}
GET https://assistants.twilio.com/v1/Tools
How many resources to return in each list page. The default is 50, and the maximum is 1000.
1
Maximum: 1000
The page token. This is provided by the API.
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 listTools() {11const tools = await client.assistants.v1.tools.list({ limit: 20 });1213tools.forEach((t) => console.log(t.accountSid));14}1516listTools();
1{2"meta": {3"first_page_url": "https://www.example.com",4"key": "key",5"next_page_url": "https://www.example.com",6"page": 42,7"page_size": 42,8"previous_page_url": "https://www.example.com",9"url": "https://www.example.com"10},11"tools": [12{13"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",14"description": "description",15"enabled": false,16"id": "aia_tool",17"meta": {},18"name": "name",19"requires_auth": false,20"type": "type",21"url": "url",22"date_created": "2009-07-06T20:30:00Z",23"date_updated": "2009-07-06T20:30:00Z"24}25]26}
DELETE https://assistants.twilio.com/v1/Tools/{id}
The tool ID.
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 deleteTool() {11await client.assistants.v1.tools("aia_tool").remove();12}1314deleteTool();