post
https://ads-dev.aylanetworks.com/apiv1/triggers//trigger_apps.json
This API creates a trigger app associated with the specified trigger. The API supports the following request data objects: email, sms, forward, push_ios, push_android, and push_baidu. See the request examples below.
Note on forward: A forwarding trigger app posts json-formatted device, property, and custom data to the given REST API endpoint. The request data object sent to the specified endpoint resembles the following:
{
"device": {
"dsn": "AC000W000000001",
"product_name": "Device 1"
},
"property": {
"name": "my_prop",
"base_type": "integer",
"value": "25",
"data_updated_at": "2019-09-20T19:02:04Z"
},
"data": "custom text"
}
| Name | Type | Description |
|---|---|---|
| name | string (255 chars) | email, sms, forward, push_ios, push_android, push_baidu |
| nickname | string (255 chars) | Name of Trigger App |
| username | string (255 chars) | email greeting |
| repeat_freq | integer (default=30) | repeat interval in seconds |
| param1 | string (255 chars) | name-dependent |
| param2 | string (255 chars) | name-dependent |
| param3 | string (255 chars) | name-dependent |
| param4 | string (255 chars) | name-dependent |
| param5 | string (255 chars) | name-dependent |
| contact_id | integer | Ayla contact id of sender. See the getContact API. |
| push_sound | string (255 chars) | mps sound file name |
| push_mdata | string (255 chars) | metadata key/value pairs: "key1:value1, key2:value2" |
| email_template_id | string (255 chars) | ID of custom email template |
| email_subject | string (255 chars) | Email subject line |
| email_body_html | string (255 chars) | Email body with template tags |
| requires_acceptance | boolean (default=false) | true=enables acceptance flow for SMS applications |
{
"trigger_app": {
"name": "email",
"username": "test",
"repeat_freq": "60",
"param1": "[email protected]",
"param3": "test",
"email_template_id": "test",
"email_subject": "test",
"email_body_html": "test"
}
}{
"trigger_app": {
"name": "sms",
"nickname": "Name of Trigger App",
"repeat_freq": 0,
"param1": "country code of phone number",
"param2": "phone number",
"param3": "text to send",
"param4": "if acceptance=true, acceptance message, if false, unused",
"contact_id": "sender contact id",
"requires_acceptance": true=enables acceptance flow for SMS applications.
}
}{
"trigger_app": {
"name": "forward",
"nickname": "Name of Trigger App",
"repeat_freq": 0,
"param1": "",
"param2": "REST API endpoint for POST method",
"param3": "username for POST basic auth",
"param4": "password for POST basic auth",
"param5": "custom data to send"
}
}{
"trigger_app": {
"name": "push_ios",
"nickname": "Name of Trigger App",
"repeat_freq": 0,
"param1": "registration ID from Apple without dashes or spaces",
"param2": "key assigned to PERM",
"param3": "optional message (max 100 chars)",
"push_sound": "mp3 file name (max 50 chars)",
"push_mdata": "metadata key/value pairs (max 50 chars)"
}
}{
"trigger_app": {
"name": "push_android",
"nickname": "Name of Trigger App",
"repeat_freq": 0,
"param1": "registration ID from Google",
"param3": "optional message (max 100 chars)",
"push_sound": "mp3 file name (max 50 chars)",
"push_mdata": "metadata key/value pairs (max 50 chars)"
}
}{
"trigger_app": {
"name": "push_baidu",
"nickname": "Name of Trigger App",
"repeat_freq": 0,
"param1": "registration ID from Baidu",
"param2": "Channel ID",
}
}