Schemas define how information is organized within an event's data
attribute. You can use the schema to explore the fields in an event type before subscribing to it. You can use also it in production to validate that the events you receive match their published schemas.
There are two ways to find the schema id
of an Event-Type.
schema_id
in its properties.dataschema
. The schema id
is part of the url. For example, if the url is https://events-schemas.twilio.com/VoiceInsights.CallSummary/1, the schema id
is VoiceInsights.CallSummary.
The unique identifier of the schema. Each schema can have multiple versions, that share the same id.
Contains a dictionary of URL links to nested resources of this schema.
The date that the latest schema version was created, given in ISO 8601 format.
The latest version published of this schema.
0
GET https://events.twilio.com/v1/Schemas/{Id}
The unique identifier of the schema. Each schema can have multiple versions, that share the same 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 fetchSchema() {11const schema = await client.events.v112.schemas("Messaging.MessageStatus")13.fetch();1415console.log(schema.id);16}1718fetchSchema();
1{2"id": "Messaging.MessageStatus",3"url": "https://events.twilio.com/v1/Schemas/Messaging.MessageStatus",4"latest_version_date_created": "2020-07-30T20:00:00Z",5"latest_version": 1,6"links": {7"versions": "https://events.twilio.com/v1/Schemas/Messaging.MessageStatus/Versions"8}9}