Skip to contentSkip to navigationSkip to topbar
Page toolsOn this page
Looking for more inspiration?Visit the

Feedback Resource


This API tracks Human Feedback that you gather on AI Assistant responses.


Feedback Properties

feedback-properties page anchor
Property nameTypeRequiredPIIDescriptionChild properties
assistantIdstring
required
Not PII

The Assistant ID.


idstring
required

The Feedback ID.

Pattern: ^aia_fdbk_.+$

accountSidSID<AC>

Optional

The SID of the Account that created the Feedback.

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

userSidSID<US>

Optional

The SID of the User created the Feedback.

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

messageIdstring
required

The Message ID.


scorenumber<float>
required

The Score to provide as Feedback (0-1)

Minimum: 0Maximum: 1

sessionIdstring
required

The Session ID.


textstring
required

The text to be given as feedback.


dateUpdatedstring<date-time>
required

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


POST https://assistants.twilio.com/v1/Assistants/{id}/Feedbacks

Path parameters

path-parameters page anchor
Property nameTypeRequiredPIIDescription
idstring
required

The assistant ID.

Encoding type:application/json
Schema
Property nameTypeRequiredPIIDescriptionChild properties
messageIdstring

Optional

The message ID.

Pattern: ^aia_msg_.+$

scorenumber<float>

Optional

The score to be given(0-1).

Minimum: 0Maximum: 1

sessionIdstring
required

The Session ID.


textstring

Optional

The text to be given as feedback.

Track feedback on a session

track-feedback-on-a-session page anchor
Track FeedbackLink to code sample: Track Feedback
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 createFeedback() {
11
const feedback = await client.assistants.v1
12
.assistants("aia_asst_00000000-1111-2222-3333-444444444444")
13
.feedbacks.create({
14
session_id: "your-session-id",
15
score: 0.5,
16
});
17
18
console.log(feedback.assistantId);
19
}
20
21
createFeedback();

Response

Note about this response
1
{
2
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
3
"assistant_id": "assistant_id",
4
"date_created": "2009-07-06T20:30:00Z",
5
"date_updated": "2009-07-06T20:30:00Z",
6
"id": "aia_asst_00000000-1111-2222-3333-444444444444",
7
"message_id": "message_id",
8
"score": 0.042,
9
"session_id": "session_id",
10
"text": "text",
11
"user_sid": "USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
12
}

Track feedback on a specific message

track-feedback-on-a-specific-message page anchor
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 createFeedback() {
11
const feedback = await client.assistants.v1
12
.assistants("aia_asst_00000000-1111-2222-3333-444444444444")
13
.feedbacks.create({
14
message_id: "aia_msg_00000000-1111-2222-3333-444444444444",
15
session_id: "your-session-id",
16
score: 0.5,
17
});
18
19
console.log(feedback.assistantId);
20
}
21
22
createFeedback();

Response

Note about this response
1
{
2
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
3
"assistant_id": "assistant_id",
4
"date_created": "2009-07-06T20:30:00Z",
5
"date_updated": "2009-07-06T20:30:00Z",
6
"id": "aia_asst_00000000-1111-2222-3333-444444444444",
7
"message_id": "message_id",
8
"score": 0.042,
9
"session_id": "session_id",
10
"text": "text",
11
"user_sid": "USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
12
}

GET https://assistants.twilio.com/v1/Assistants/{id}/Feedbacks

Property nameTypeRequiredPIIDescription
idstring
required

The assistant ID.

Property nameTypeRequiredPIIDescription
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 listFeedback() {
11
const feedbacks = await client.assistants.v1
12
.assistants("id")
13
.feedbacks.list({ limit: 20 });
14
15
feedbacks.forEach((f) => console.log(f.assistantId));
16
}
17
18
listFeedback();

Response

Note about this response
1
{
2
"feedbacks": [
3
{
4
"assistant_id": "assistant_id",
5
"id": "aia_fdbk_#",
6
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
7
"user_sid": "USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
8
"message_id": "message_id",
9
"score": 0.042,
10
"session_id": "session_id",
11
"text": "text",
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
}