Create Drip Autoresponder¶
Getting Started¶
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.
Introduction¶
The API endpoint is used to create a new Drip Autoresponder campaign.
Request URL¶
https://api.pushengage.com/apiv1/drips
Request Method¶
POST
Request Body¶
Property Name | Type | Description |
---|---|---|
campaign_name | String | The name of the Drip Autoresponder campaign. |
notifications | Drip Notification[] | An array of notifications in the Drip campaign. |
send_to | Sent To | optional Defines the target audience for the Drip campaign. |
utm_params | Object | optional An object containing UTM parameters for the Drip campaign. |
utm_params.utm_source | String | The UTM source parameter value included in the URL of the notifications for the campaign. |
utm_params.utm_medium | String | The UTM medium parameter value included in the URL of the notifications for the campaign. |
utm_params.utm_campaign | String | The UTM campaign parameter value included in the URL of the notifications for the campaign. |
utm_params.utm_term | String | optional The UTM term parameter value included in the URL of the notifications for the campaign. |
utm_params.utm_content | String | optional The UTM content parameter value included in the URL of the notifications for the campaign. |
Drip Notification¶
Property Name | Type | Description |
---|---|---|
title | String | Title of the notification. |
message | String | The message to be displayed in the push notification. |
url | String | The URL that opens upon clicking the received push notification. |
image_url | String | URL of the notification icon image. |
big_image_url | String | URL of the notification large image. |
require_interaction | Number | Valid values: 1 , 0 Indicates that on devices with sufficiently large screens, the notification should remain active until the user clicks or dismisses it. |
expiry | Number | 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 | An object containing the scheduling details of the notification. |
schedule_options.type | String | Valid values: after , rightaway Specifies 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 | 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 | Valid values: minutes , days , dow The 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 | The sending time of the notification in the HH:mm:ss format. It is required when the unit is days or dow . |
actions | Array | optional An array of action button to display in the notification. It accept maximum two actions. |
actions.*.label | String | The text to be shown to the user on action button. |
actions.*.url | String | The URL that opens upon clicking the action button. |
actions.*.image_url | String | optional The URL of an icon to display with the action button. |
Send To Object¶
Property Name | Type | Description |
---|---|---|
include_segments | String[] | optional Notifications will be sent only to those users who are subscribed to any of the given segments. |
exclude_segments | String[] | optional Notifications will not be sent to users subscribed to any of the given segments. |
include_countries | String[] | optional Notifications will only be sent to users from the given countries. |
exclude_countries | String[] | optional Notifications will not be sent to users who are from any of the given countries. |
include_states | String[] | optional Notifications will only be sent to users from the given states. |
exclude_states | String[] | optional Notifications will not be sent to users who are from any of the given states. |
include_cities | String[] | optional Notifications will only be sent to users from the given cities. |
exclude_cities | String[] | optional Notifications will not be sent to users who are from any of the given cities. |
Response Body¶
Property Name | Type | Description |
---|---|---|
success | Boolean | Indicates whether the API call was successful or not. |
drip_id | Number | The unique identifier for the Drip Autoresponder campaign. |
message | String | This message is present in case of failure and indicates the reason for the failure. |
Example¶
Request¶
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"
},
"title1": "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"
},
"title1": "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"
},
"title1": "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"
},
"title1": "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¶
{
"success": true,
"drip_id": 12345
}
{
"success": false,
"message": "API KEY Invalid"
}
{
"success": false,
"error": {
"name": "InvalidRequestException",
"message": "Error Message"
}
}