Skip to contentSkip to navigationSkip to topbar
On this page

Plugin Resource


A Plugin is a resource that contains information about a given plugin, like its name, description, and the account that owns the plugin.

While the Plugin Version Resource contains information on the actual source code for a deployed Plugin, the Plugin Resource serves as an identifier for the Plugin itself. For example, you might have a CRM plugin. You can use the Plugin Resource to describe the plugin itself, and then a series of Plugin Versions to reference the source code of your various iterations of the Plugin.


Plugin Properties

plugin-properties page anchor
Property nameTypeRequiredDescriptionChild properties
sidSID<FP>

Optional

Not PII

The unique string that we created to identify the Flex Plugin resource.

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

account_sidSID<AC>

Optional

The SID of the Account that created the Flex Plugin resource and owns this resource.

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

unique_namestring

Optional

PII MTL: 30 days

The name that uniquely identifies this Flex Plugin resource.


friendly_namestring

Optional

The friendly name this Flex Plugin resource.


descriptionstring

Optional

A descriptive string that you create to describe the plugin resource. It can be up to 500 characters long


archivedboolean

Optional

Whether the Flex Plugin is archived. The default value is false.


date_updatedstring<date-time>

Optional

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


urlstring<uri>

Optional

The absolute URL of the Flex Plugin resource.


linksobject<uri-map>

Optional


Create a Plugin resource

create-a-plugin-resource page anchor
POST https://flex-api.twilio.com/v1/PluginService/Plugins

Headers

headers page anchor
Property nameTypeRequiredPIIDescription
Flex-Metadatastring

Optional

The Flex-Metadata HTTP request header

Encoding type:application/x-www-form-urlencoded
SchemaExample
Property nameTypeRequiredDescriptionChild properties
UniqueNamestringrequired

The Flex Plugin's unique name.


FriendlyNamestring

Optional

The Flex Plugin's friendly name.


Descriptionstring

Optional

A descriptive string that you create to describe the plugin resource. It can be up to 500 characters long

Create a PluginLink to code sample: Create a Plugin
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 createPlugin() {
11
const plugin = await client.flexApi.v1.plugins.create({
12
uniqueName: "UniqueName",
13
});
14
15
console.log(plugin.sid);
16
}
17
18
createPlugin();

Output

1
{
2
"sid": "FPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
3
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
4
"unique_name": "UniqueName",
5
"friendly_name": "friendly name",
6
"description": "description",
7
"archived": false,
8
"date_created": "2020-01-10T20:00:00Z",
9
"date_updated": "2020-01-10T20:00:00Z",
10
"url": "https://flex-api.twilio.com/v1/PluginService/Plugins/FPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
11
"links": {
12
"plugin_versions": "https://flex-api.twilio.com/v1/PluginService/Plugins/FPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Versions"
13
}
14
}

GET https://flex-api.twilio.com/v1/PluginService/Plugins/{Sid}

Property nameTypeRequiredPIIDescription
Flex-Metadatastring

Optional

The Flex-Metadata HTTP request header

Property nameTypeRequiredPIIDescription
Sidstringrequired

The SID of the Flex Plugin resource to fetch.

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 fetchPlugin() {
11
const plugin = await client.flexApi.v1.plugins("Sid").fetch();
12
13
console.log(plugin.sid);
14
}
15
16
fetchPlugin();

Output

1
{
2
"sid": "Sid",
3
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
4
"unique_name": "unique-name",
5
"friendly_name": "friendly name",
6
"description": "description",
7
"archived": false,
8
"date_created": "2020-01-10T20:00:00Z",
9
"date_updated": "2020-01-10T20:00:00Z",
10
"url": "https://flex-api.twilio.com/v1/PluginService/Plugins/FPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
11
"links": {
12
"plugin_versions": "https://flex-api.twilio.com/v1/PluginService/Plugins/FPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Versions"
13
}
14
}

Read multiple Plugin resources

read-multiple-plugin-resources page anchor
GET https://flex-api.twilio.com/v1/PluginService/Plugins

Property nameTypeRequiredPIIDescription
Flex-Metadatastring

Optional

The Flex-Metadata HTTP request header

Property nameTypeRequiredPIIDescription
PageSizeinteger

Optional

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

Minimum: 1Maximum: 1000

Pageinteger

Optional

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

Minimum: 0

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 listPlugin() {
11
const plugins = await client.flexApi.v1.plugins.list({ limit: 20 });
12
13
plugins.forEach((p) => console.log(p.sid));
14
}
15
16
listPlugin();

Output

1
{
2
"plugins": [],
3
"meta": {
4
"page": 0,
5
"page_size": 50,
6
"first_page_url": "https://flex-api.twilio.com/v1/PluginService/Plugins?PageSize=50&Page=0",
7
"previous_page_url": null,
8
"url": "https://flex-api.twilio.com/v1/PluginService/Plugins?PageSize=50&Page=0",
9
"next_page_url": null,
10
"key": "plugins"
11
}
12
}

Update a Plugin resource

update-a-plugin-resource page anchor
POST https://flex-api.twilio.com/v1/PluginService/Plugins/{Sid}

Property nameTypeRequiredPIIDescription
Flex-Metadatastring

Optional

The Flex-Metadata HTTP request header

Property nameTypeRequiredPIIDescription
Sidstringrequired

The SID of the Flex Plugin resource to update.

Encoding type:application/x-www-form-urlencoded
SchemaExample
Property nameTypeRequiredDescriptionChild properties
FriendlyNamestring

Optional

The Flex Plugin's friendly name.


Descriptionstring

Optional

A descriptive string that you update to describe the plugin resource. It can be up to 500 characters long

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 updatePlugin() {
11
const plugin = await client.flexApi.v1
12
.plugins("Sid")
13
.update({ friendlyName: "FriendlyName" });
14
15
console.log(plugin.sid);
16
}
17
18
updatePlugin();

Output

1
{
2
"sid": "Sid",
3
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
4
"unique_name": "unique-name",
5
"friendly_name": "FriendlyName",
6
"description": "description update",
7
"archived": false,
8
"date_created": "2020-01-10T20:00:00Z",
9
"date_updated": "2020-01-10T20:00:00Z",
10
"url": "https://flex-api.twilio.com/v1/PluginService/Plugins/FPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
11
"links": {
12
"plugin_versions": "https://flex-api.twilio.com/v1/PluginService/Plugins/FPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Versions"
13
}
14
}

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.