Create Drip Autoresponder
Drip autoresponder is used to send a series of notifications to users depending on the criteria specified in the drip campaign. Drip campaign criteria are evaluated whenever a user subscribes to push notifications or when an existing user is added to a segment. A Drip campaign is initialized when a user satisfies the criteria specified in the Drip Autoresponder.
POST
https://api.pushengage.com/apiv1/drips
Request Body
| Property Name | Type | Required | Description |
|---|---|---|---|
| campaign_name | String | Yes | The name of the Drip Autoresponder campaign. |
| notifications | Drip Notification[] | Yes | An array of notifications in the Drip campaign. |
| send_to | Send To | No | Defines the target audience for the Drip campaign. |
| utm_params | UTM Params | No | An object containing UTM parameters for the Drip campaign. |
Response Body
| Property Name | Type | Required | Description |
|---|---|---|---|
| success | Boolean | Yes | Indicates whether the API call was successful or not. |
| drip_id | Number | Yes | The unique identifier for the Drip Autoresponder campaign. |
| message | String | No | This message is present in case of failure and indicates the reason for the failure. |
Drip Notification
| Property Name | Type | Required | Description |
|---|---|---|---|
| title | String | Yes | Title of the notification. |
| message | String | Yes | The message to be displayed in the push notification. |
| url | String | Yes | The URL that opens upon clicking the received push notification. |
| image_url | String | Yes | URL of the notification icon image. |
| big_image_url | String | Yes | URL of the notification large image. |
| require_interaction | Number | Yes | Valid values: 1, 0Indicates that on devices with sufficiently large screens, the notification should remain active until the user clicks or dismisses it. |
| expiry | Number | Yes | The expiry time of on notification in seconds. The notification will be expired if the device does not come back online within this time. The maximum time is 28 days. |
| schedule_options | Object | Yes | An object containing the scheduling details of the notification. |
| schedule_options.type | String | Yes | Valid values: after, rightawaySpecifies when to send this notification after sending the previous notification in the Drip campaign. The type of first notifications can be either rightaway or after and the rest of the following notifications it should be after. |
| schedule_options.value | Number | Yes | The value specifies the time to wait before sending the notification after sending the previous notification in the campaign. It is required when the type is set to after. |
| schedule_options.unit | Number | Yes | Valid values: minutes, days, dowThe unit of the value is required when the type is set to after. The value will be treated based on its unit. If the unit is minutes, then the value will indicate the number of minutes. If the unit is days, then the value will indicate the number of days. If the unit is dow, then the value will be 0 for Sunday, 1 for Monday, 2 for Tuesday, 3 for Wednesday, 4 for Thursday, 5 for Friday, and 6 for Saturday. |
| schedule_options.at | String | Yes | The sending time of the notification in the HH:mm:ss format. It is required when the unit is days or dow. |
| actions | Action[] | No | An array of action button to display in the notification. It accept maximum two action. |
Send To Object
| Property Name | Type | Required | Description |
|---|---|---|---|
| include_segments | String[] | No | Notifications will be sent only to those users who are subscribed to any of the given segments. |
| exclude_segments | String[] | No | Notifications will not be sent to users subscribed to any of the given segments. |
| include_countries | String[] | No | Notifications will only be sent to users from the given countries. |
| exclude_countries | String[] | No | Notifications will not be sent to users who are from any of the given countries. |
| include_states | String[] | No | Notifications will only be sent to users from the given states. |
| exclude_states | String[] | No | Notifications will not be sent to users who are from any of the given states. |
| include_cities | String[] | No | Notifications will only be sent to users from the given cities. |
| exclude_cities | String[] | No | Notifications will not be sent to users who are from any of the given cities. |
UTM params Object
| Property Name | Type | Required | Description |
|---|---|---|---|
| utm_source | String | Yes | The UTM source parameter value included in the URL of the notifications for the campaign. |
| utm_medium | String | Yes | The UTM medium parameter value included in the URL of the notifications for the campaign. |
| utm_campaign | String | Yes | The UTM campaign parameter value included in the URL of the notifications for the campaign. |
| utm_term | String | No | The UTM term parameter value included in the URL of the notifications for the campaign. |
| utm_content | String | No | The UTM content parameter value included in the URL of the notifications for the campaign. |
Action Object
| Property Name | Type | Required | Description |
|---|---|---|---|
| label | String | Yes | The text to be shown to the user on action button. |
| url | String | Yes | The URL that opens upon clicking the action button. |
| image_url | String | No | The URL of an icon to display with the action button. |
Example
Request
- cURL
- PHP
curl --location --request POST 'https://api.pushengage.com/apiv1/drips' \
--header 'Api-Key: <YOUR_API_KEY>' \
--header 'Content-Type: application/json' \
--data-raw '{
"campaign_name": "Drip Autoresponder Campaign",
"send_to": {
"include_segments": ["segment1", "segment2"],
"exclude_segments": ["segment2", "segment3"]
},
"utm_params": {
"enabled": true,
"source": "PushEngage",
"medium": "Push Notification",
"campaign": "Drip Autoresponder",
"term": "UTM Term",
"content": "UTM Content"
},
"notifications": [
{
"schedule_options": {
"type": "rightaway"
},
"title": "Notification Title 1",
"message": "Notification Message 1",
"url": "https://example.com/landing-page/",
"image_url": "https://example.com/img/notification-icon-image.jpg",
"big_image_url": "https://example.com/img/notification-large-image.jpg",
"require_interaction": 1,
"expiry": 86400,
"actions": [
{
"label": "Action 1",
"url": "https://example.com/action-1-landing-page/",
"image_url": "https://example.com/img/action-1-icon-16x16.jpg"
},
{
"label": "Action 2",
"url": "https://www.pushengage.com",
"image_url": "https://example.com/action-2-landing-page/"
}
]
},
{
"schedule_options": {
"type": "after",
"value": 2,
"unit": "days",
"at": "16:30:00"
},
"title": "Notification Title 2",
"message": "Notification Message 2",
"url": "https://example.com/landing-page-2/",
"image_url": "https://example.com/img/notification-icon-image.jpg",
"big_image_url": "https://example.com/img/notification-large-image-2.jpg",
"require_interaction": 1,
"expiry": 86400,
"actions": [
{
"label": "Action 1",
"url": "https://example.com/action-1-landing-page/"
}
]
}
]
}'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.pushengage.com/apiv1/drips',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"campaign_name": "Drip Autoresponder Campaign",
"send_to": {
"include_segments": ["segment1", "segment2"],
"exclude_segments": ["segment2", "segment3"]
},
"utm_params": {
"enabled": true,
"source": "PushEngage",
"medium": "Push Notification",
"campaign": "Drip Autoresponder",
"term": "UTM Term",
"content": "UTM Content"
},
"notifications": [
{
"schedule_options": {
"type": "rightaway"
},
"title": "Notification Title 1",
"message": "Notification Message 1",
"url": "https://example.com/landing-page/",
"image_url": "https://example.com/img/notification-icon-image.jpg",
"big_image_url": "https://example.com/img/notification-large-image.jpg",
"require_interaction": 1,
"expiry": 86400,
"actions": [
{
"label": "Action 1",
"url": "https://example.com/action-1-landing-page/",
"image_url": "https://example.com/img/action-1-icon-16x16.jpg"
},
{
"label": "Action 2",
"url": "https://www.pushengage.com",
"image_url": "https://example.com/action-2-landing-page/"
}
]
},
{
"schedule_options": {
"type": "after",
"value": 2,
"unit": "days",
"at": "16:30:00"
},
"title": "Notification Title 2",
"message": "Notification Message 2",
"url": "https://example.com/landing-page-2/",
"image_url": "https://example.com/img/notification-icon-image.jpg",
"big_image_url": "https://example.com/img/notification-large-image-2.jpg",
"require_interaction": 1,
"expiry": 86400,
"actions": [
{
"label": "Action 1",
"url": "https://example.com/action-1-landing-page/"
}
]
}
]
}',
CURLOPT_HTTPHEADER => array(
'Api-Key: <YOUR_API_KEY>',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
?>
Response
- 200 OK
- 401 Unauthorized
- 400 Bad Request
{
"success": true,
"drip_id": 12345
}
{
"success": false,
"message": "API KEY Invalid"
}
{
"success": false,
"error": {
"name": "InvalidRequestException",
"message": "Error Message"
}
}