Launch Single Web Pushes
- 14 Feb 2024
- 2 Minutes to read
Launch Single Web Pushes
- Updated on 14 Feb 2024
- 2 Minutes to read
Article Summary
Share feedback
Thanks for sharing your feedback!
Overview
Insider's web push API allows you to launch single web push notifications from your own back-end without using Insider's InOne panel.
Endpoint and Headers
POST https://web-push.api.useinsider.com/v1/single/campaign_id
Headers
Header | Sample Value | Description |
---|---|---|
Authorization | Bearer 1a2b3c4d5e6f | This key is required to authorize your request. Refer to API Authentication Tokens to generate your token. |
Content-Type | application/json | This header specifies the media type of the resource. |
Body Parameters
Each request body requires a partner ID and a title.
Parameter | Description | Data Type | Required |
---|---|---|---|
partner_id | This is your partner identification number, available from InOne Settings > Account Preferences. | String | Yes |
title | Every request creates a push notification campaign on InOne with the push type Single Push. This is the title of the push content. Itcannot be more than 100 characters. | String | Yes |
description | This is the body of your push notification. It cannot be more than 255 characters. If it is a rich push that has a banner, it is limited to 30 characters. | String | Yes |
image | This is the push notification icon. Only HTTPS protocols are accepted. If not provided, the default icon is used instead. | String | Yes |
banner | This is the rich push notification image. Only HTTPS protocols are accepted. | String | No |
link | The link of the Web push message. | String | Yes |
include_unengaged | Enables you to decide whether the bulk push should target unengaged tokens. When not sent in the payload, unengaged users are automatically excluded. | Boolean (true/false) | No |
ttl | Short for time to live: This is the maximum time the system will try to send a push notification to an offline or temporarily unavailable user. TTL is limited to 240 hours. | String | Yes |
target | Targeting options for the campaign (segmenting). | Object | Yes if is_all: false |
attribute | The attribute used for targeting, e.g. "d_wp_browser". | String | Yes if target is used. |
values | An array of values to target, e.g. ["Edg"] | Array | Yes if target is used. |
Your title goes here
If you want to use default attributes, you need to use “d_Default_attribute_name” format. However, if you want to use custom attributes, you need to add “c_Custom_attribute_name” format. You can refer here for further information.
Sample Example
Before sending the request, make sure:
- To replace the authorization value with your own API key.
- To add your partner ID in partner_id.
- To add your campaign name in title.
Your title goes here
When you send the request to create it, you will get your campaign_id as a response.
Sample Request
Below you can see a sample request without segments; is_all: true.
curl --location --request POST 'https://web-push.api.useinsider.com/v1/single/campaign_id' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer 1a2b3c4d5e6f' \
--data-raw '{
"partner_id": "100000001",
"title": "title of push",
"description": "description of push",
"image": "https://image.useinsider.com/mywebsite/webPushDefaultImage/JpVu9aBXgTXmcrBkiZLB1512577074.jpeg",
"banner": "https://image.useinsider.com/mywebsite/webPushDefaultImage/JpVu9aBXgTXmcrBkiZLB1512577074.jpeg",
"link": "https://image.useinsider.com",
"include_unengage": true,
"ttl": "1000"
}'
Below you can see a sample request with segments; is_all: false.
curl --location --request POST 'https://web-push.api.useinsider.com/v1/single/campaign_id' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer 1a2b3c4d5e6f' \
--data-raw '{
"partner_id": "10000001",
"title": "title of push",
"description": "description of push",
"image": "https://image.useinsider.com/mywebsite/webPushDefaultImage/JpVu9aBXgTXmcrBkiZLB1512577074.jpeg",
"banner": "https://image.useinsider.com/mywebsite/webPushDefaultImage/JpVu9aBXgTXmcrBkiZLB1512577074.jpeg",
"link": "https://image.useinsider.com",
"include_unengage": true,
"ttl": "1000",
"language": "en_US",
"target": {
"attribute": "d_wp_browser",
"values": ["Edg"]
}
}'
Sample Responses
200 OK
You can see this kind of response when you successfully launched your campaign.
{
"success": true,
"campaign_id": 1697300275
}
401 Unauthorized
{
"message": "Unauthorized"
}
424 Failed Dependency
{
"message": "SERVICE:-"
}
Error Codes
- 400: Bad request
- 401: Unauthorized request
- 424 Failed Dependency
- 429 Request limit exceeded
Limitations
- All functions must be executed with an HTTPS POST request.
- The API key should be provided as the authorization key on the request header. If the key is incorrect, the operation will not be executed and an authorization error will return in the response.
- The rate limit is 30 requests per minute second.
Was this article helpful?