Manage Tools connected to an Assistant
GET https://assistants.twilio.com/v1/Assistants/{assistantId}/Tools
The assistant ID.
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 listToolsByAssistant() {11const assistantsTools = await client.assistants.v112.assistants("aia_asst_00000000-1111-2222-3333-444444444444")13.assistantsTools.list({ limit: 20 });1415assistantsTools.forEach((a) => console.log(a.accountSid));16}1718listToolsByAssistant();
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}
POST https://assistants.twilio.com/v1/Assistants/{assistantId}/Tools/{id}
Once you've created a tool using the /v1/Tools
endpoint, you must connect it to an Assistant to allow your Assistant to call the tool.
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 createAssistantToolAttachment() {11const assistantsTool = await client.assistants.v112.assistants("aia_asst_00000000-1111-2222-3333-444444444444")13.assistantsTools("aia_tool")14.create();1516console.log(assistantsTool.sid);17}1819createAssistantToolAttachment();
DELETE https://assistants.twilio.com/v1/Assistants/{assistantId}/Tools/{id}
This endpoint removes a Tool from your Assistant's configuration, so it can no longer be called by that Assistant.
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 deleteAssistantToolAttachment() {11await client.assistants.v112.assistants("aia_asst_00000000-1111-2222-3333-444444444444")13.assistantsTools("aia_tool")14.remove();15}1617deleteAssistantToolAttachment();