Triggers
Create, update, delete, and query usage Triggers in Twilio.
Select
Twilio allows only a small subset of columns to be used in the WHERE clause of a SELECT query. These columns can be used with only the equals or = comparison. The available columns for Triggers are Category, TriggerBy, UsageCategory, and Sid.
SELECT * FROM Triggers WHERE Sid = 'X123456789'
Insert
To add a Trigger specify the UsageCategory, TriggerValue, and CallbackUrl. Other optional columns are Name, TriggerBy, Recurring, and CallbackMethod.
INSERT INTO Triggers (UsageCategory, TriggerValue, CallbackUrl, CallbackMethod, Name, Recurring, TriggerBy) VALUES ('sms', 100, 'http://twilio.com/test', 'POST', 'trigger test', 'monthly', 'price')
Update
Triggers allow UPDATEs for the Name, CallbackUrl, and CallbackMethod columns.
UPDATE Triggers SET Name = 'updated' WHERE Sid = 'X123456789'
Columns
Name | Type | ReadOnly | References | Description |
Sid [KEY] | String | True |
The Id of the trigger. | |
AccountSid | String | True |
The account Id of the trigger. | |
DateCreated | Datetime | True |
The creation date of the trigger. | |
DateUpdated | Datetime | True |
The modification date of the trigger. | |
DateFired | Datetime | True |
The fired date of the trigger. | |
Name | String | False |
The friendly name of the trigger. | |
UsageCategory | String | False |
The usage category the trigger watches. For example: calls, sms, phonenumbers, recordings, transcriptions, totalprice. | |
TriggerBy | String | False |
The usage record field that the trigger is watching. Allowed values: count, usage, and price. The allowed values are count, usage, price. | |
Recurring | String | False |
The recurring interval of the trigger. Allowed values: daily, monthly, and yearly. The allowed values are daily, monthly, yearly. | |
TriggerValue | Double | False |
The value of the usage record field that will fire the trigger. | |
CurrentValue | Double | True |
The current value of the field the trigger is watching. | |
CallbackUrl | String | False |
The callback URL of the trigger, where Twilio makes a request when the trigger fires. | |
CallbackMethod | String | False |
The HTTP method to be used to make requests to the callback URL. | |
UsageRecordUri | String | True |
The URI of the usage record the trigger is watching. | |
Uri | String | True |
The URI of the trigger. | |
ApiVersion | String | True |
The API version of the trigger. |