Skip to contentSkip to navigationSkip to topbar
On this page

Tools Resource


Create and configure Tools that an AI Assistant can use.


Tool Properties

tool-properties page anchor
Property nameTypeRequiredDescriptionChild properties
account_sidSID<AC>

Optional

Not PII

The SID of the Account that created the Tool resource.

Pattern: ^AC[0-9a-fA-F]{32}$Min length: 34Max length: 34

descriptionstringrequired

The description of the tool.


enabledbooleanrequired

True if the tool is enabled.


idstringrequired

The tool ID.

Pattern: ^aia_tool_*$

metaobjectrequired

The metadata related to method, url, input_schema to used with the Tool.


namestringrequired

The name of the tool.


requires_authbooleanrequired

The authentication requirement for the tool.


typestringrequired

The type of the tool. ('WEBHOOK')


urlstring

Optional

The url of the tool resource.


date_updatedstring<date-time>required

The date and time in GMT when the Tool was last updated specified in ISO 8601(link takes you to an external page) format.


POST https://assistants.twilio.com/v1/Tools

Request body parameters

request-body-parameters page anchor
Encoding type:application/json
Schema
Property nameTypeRequiredDescriptionChild properties
assistant_idstring

Optional

The Assistant ID.

Pattern: ^aia_asst_*$

descriptionstring

Optional

The description of the tool.


enabledbooleanrequired

True if the tool is enabled.


metaobject

Optional

The metadata related to method, url, input_schema to used with the Tool.


namestringrequired

The name of the tool.


policyobject

Optional

The policy associated with the tool.


typestringrequired

The description of the tool.

Create a ToolLink to code sample: Create a Tool
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function createTool() {
11
const tool = await client.assistants.v1.tools.create({
12
name: "Schedule a Meeting",
13
type: "WEBHOOK",
14
description: "Use this to schedule a meeting",
15
enabled: true,
16
meta: {
17
url: "https://example.com",
18
method: "POST",
19
input_schema: "export type Data = { date: string }",
20
},
21
});
22
23
console.log(tool.accountSid);
24
}
25
26
createTool();

Output

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}

Property nameTypeRequiredPIIDescription
idstringrequired
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function fetchTool() {
11
const tool = await client.assistants.v1.tools("aia_tool").fetch();
12
13
console.log(tool.accountSid);
14
}
15
16
fetchTool();

Output

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

Property nameTypeRequiredPIIDescription
AssistantIdstring

Optional


Pageinteger

Optional

The page index. This value is simply for client state.

Minimum: 0

PageSizeinteger

Optional

How many resources to return in each list page. The default is 50, and the maximum is 1000.

Minimum: 1Maximum: 1000

PageTokenstring

Optional

The page token. This is provided by the API.

1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function listTools() {
11
const tools = await client.assistants.v1.tools.list({ limit: 20 });
12
13
tools.forEach((t) => console.log(t.accountSid));
14
}
15
16
listTools();

Output

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}

Property nameTypeRequiredPIIDescription
idstringrequired

The tool ID.

1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function deleteTool() {
11
await client.assistants.v1.tools("aia_tool").remove();
12
}
13
14
deleteTool();

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.