ExportConfiguration resource
The ExportConfiguration resource enables daily automatic generation of files (Twilio Editions customers only) and sets the callback method for notification when file generation completes.
Twilio Editions feature
Bulk export automation for daily file exports is available to all Twilio Editions customers. Learn more about Editions.
You can set daily automatic exports of activity logs from the Twilio platform. Automatic daily exports generate one data file per day for every resource enabled. The system typically attempts to create a data file based on the state of the data at the time of creation, but delays are possible.
If you use bulk export automation or custom jobs, you can send a callback by webhook or email to notify you when a file is ready:
- For webhooks, the webhook method value must be either
GET
orPOST
and the webhook URL value should be the URL of the service you want to call when the file is available. - For email, the email value should be a valid email address.
If true, Twilio will automatically generate every day's file when the day is over.
Stores the URL destination for the method specified in webhook_method.
Sets whether Twilio should call a webhook URL when the automatic generation is complete, using GET or POST. The actual destination is set in the webhook_url
The type of communication – Messages, Calls, Conferences, and Participants
The URL of this resource.
GET https://bulkexports.twilio.com/v1/Exports/{ResourceType}/Configuration
The type of communication – Messages, Calls, Conferences, and Participants
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 fetchExportConfiguration() {11const exportConfiguration = await client.bulkexports.v112.exportConfiguration("Messages")13.fetch();1415console.log(exportConfiguration.enabled);16}1718fetchExportConfiguration();
Response
1{2"url": "https://bulkexports.twilio.com/v1/Exports/Messages/Configuration",3"enabled": true,4"webhook_url": "",5"webhook_method": "",6"resource_type": "Messages"7}
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 fetchExportConfiguration() {11const exportConfiguration = await client.bulkexports.v112.exportConfiguration("Calls")13.fetch();1415console.log(exportConfiguration.enabled);16}1718fetchExportConfiguration();
Response
1{2"url": "https://bulkexports.twilio.com/v1/Exports/Messages/Configuration",3"enabled": true,4"webhook_url": "",5"webhook_method": "",6"resource_type": "Calls"7}
POST https://bulkexports.twilio.com/v1/Exports/{ResourceType}/Configuration
The type of communication – Messages, Calls, Conferences, and Participants
application/x-www-form-urlencoded
If true, Twilio will automatically generate every day's file when the day is over.
Stores the URL destination for the method specified in webhook_method.
Sets whether Twilio should call a webhook URL when the automatic generation is complete, using GET or POST. The actual destination is set in the webhook_url
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 updateExportConfiguration() {11const exportConfiguration = await client.bulkexports.v112.exportConfiguration("Messages")13.update({14webhookMethod: "GET",15webhookUrl: "https://api.your-infrastructure.com/receive-messages/",16});1718console.log(exportConfiguration.enabled);19}2021updateExportConfiguration();
Response
1{2"url": "https://bulkexports.twilio.com/v1/Exports/Messages/Configuration",3"enabled": true,4"webhook_url": "https://api.your-infrastructure.com/receive-messages/",5"resource_type": "Messages",6"webhook_method": "GET"7}