Manage Knowledge sources connected to an Assistant
The SID of the Account that created the Knowledge resource.
^AC[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The status of processing the knowledge source ('QUEUED', 'PROCESSING', 'COMPLETED', 'FAILED')
The date and time in GMT when the Knowledge was created specified in ISO 8601 format.
GET https://assistants.twilio.com/v1/Assistants/{assistantId}/Knowledge
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 listKnowledgeByAssistant() {11const assistantsKnowledges = await client.assistants.v112.assistants("aia_asst_00000000-1111-2222-3333-444444444444")13.assistantsKnowledge.list({ limit: 20 });1415assistantsKnowledges.forEach((a) => console.log(a.description));16}1718listKnowledgeByAssistant();
1{2"knowledge": [3{4"description": "description",5"id": "aia_know",6"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",7"knowledge_source_details": {},8"name": "name",9"status": "status",10"type": "type",11"url": "url",12"date_created": "2009-07-06T20:30:00Z",13"date_updated": "2009-07-06T20:30:00Z"14}15],16"meta": {17"first_page_url": "https://www.example.com",18"key": "key",19"next_page_url": "https://www.example.com",20"page": 42,21"page_size": 42,22"previous_page_url": "https://www.example.com",23"url": "https://www.example.com"24}25}
POST https://assistants.twilio.com/v1/Assistants/{assistantId}/Knowledge/{id}
After you've created a Knowledge source using the /v1/Knowledge
endpoint, you must connect it to an Assistant to allow that Assistant to use the Knowledge.
The knowledge 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 createAssistantKnowledgeAttachment() {11const assistantsKnowledge = await client.assistants.v112.assistants("aia_asst_00000000-1111-2222-3333-444444444444")13.assistantsKnowledge("aia_knowledge")14.create();1516console.log(assistantsKnowledge.sid);17}1819createAssistantKnowledgeAttachment();
DELETE https://assistants.twilio.com/v1/Assistants/{assistantId}/Knowledge/{id}
This endpoint removes a Knowledge source from your Assistant's configuration, so it can no longer be used by that Assistant.
The knowledge 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 deleteAssistantKnowledgeAttachment() {11await client.assistants.v112.assistants("aia_asst_00000000-1111-2222-3333-444444444444")13.assistantsKnowledge("aia_knowledge")14.remove();15}1617deleteAssistantKnowledgeAttachment();