Function
Functions are JavaScript Node.js code that execute at a particular domain.
The steps to create Functions are as follows:
- Create a Function (this resource)
- Create a Function Version via
serverless.twilio.com
We will need the Function Version SID to include this Function in a Build.
Function properties
Resource Properties in REST API format | |
---|---|
sid
|
The unique string that we created to identify the Function resource. |
account_sid
|
The SID of the Account that created the Function resource. |
service_sid
|
The SID of the Service that the Function resource is associated with. |
friendly_name
|
The string that you assigned to describe the Function resource. It can be a maximum of 255 characters. |
date_created
|
The date and time in GMT when the Function resource was created specified in ISO 8601 format. |
date_updated
|
The date and time in GMT when the Function resource was last updated specified in ISO 8601 format. |
url
|
The absolute URL of the Function resource. |
links
|
The URLs of nested resources of the Function resource. |
Create a Function resource
https://serverless.twilio.com/v1/Services/{ServiceSid}/Functions
Parameters
Parameters in REST API format | |
---|---|
service_sid
Path
|
The SID of the Service to create the Function resource under. |
friendly_name
Required
|
A descriptive string that you create to describe the Function resource. It can be a maximum of 255 characters. |
Example 1
Fetch a Function resource
https://serverless.twilio.com/v1/Services/{ServiceSid}/Functions/{Sid}
Parameters
Parameters in REST API format | |
---|---|
service_sid
Path
|
The SID of the Service to fetch the Function resource from. |
sid
Path
|
The SID of the Function resource to fetch. |
Example 1
Read multiple Function resources
https://serverless.twilio.com/v1/Services/{ServiceSid}/Functions
Parameters
Parameters in REST API format | |
---|---|
service_sid
Path
|
The SID of the Service to read the Function resources from. |
Example 1
Update a Function resource
https://serverless.twilio.com/v1/Services/{ServiceSid}/Functions/{Sid}
Parameters
Parameters in REST API format | |
---|---|
service_sid
Path
|
The SID of the Service to update the Function resource from. |
sid
Path
|
The SID of the Function resource to update. |
friendly_name
Required
|
A descriptive string that you create to describe the Function resource. It can be a maximum of 255 characters. |
Example 1
Delete a Function resource
https://serverless.twilio.com/v1/Services/{ServiceSid}/Functions/{Sid}
Parameters
Parameters in REST API format | |
---|---|
service_sid
Path
|
The SID of the Service to delete the Function resource from. |
sid
Path
|
The SID of the Function resource to delete. |
Example 1
Need some help?
We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd by visiting Twilio's Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.