Push Message

You can send API-based push message campaigns using the HTTP API.

Authentication

Authentication is done using an API key, which must be sent in the HTTP header.

X-HACKLE-API-KEY: {YOUR_API_KEY}

🚧

API KEY Environment Note

Please note that API integration keys differ for each environment.

Request

POST https://api.hackle.io/v1/push-message/trigger/send

Request Body

FieldTypeRequiredDescriptionRestrict
campaignKeynumberOThe campaign key for the push message
usersarrayOList of users to receive the push messageThe maximum number of users is limited to 50.

User Object

FieldTypeRequiredDescription
userIdstringXUser ID (required if deviceId is not provided)
deviceIdstringXDevice ID (required if userId is not provided)
apiPropertiesobjectXKey-value pairs used for personalization the push message.
key(string)-value(string|number|boolean) Pair

🚧

Target Users

The target user information must match the cohort user conditions set in the push message campaign.
Push messages will not be sent to users who do not meet the cohort conditions.

Example

curl -i -X POST \
  'https://api.hackle.io/v1/push-message/trigger/send' \
  -H 'X-HACKLE-API-KEY: YOUR_API_KEY_HERE' \
  -H 'Content-Type: application/json' \
  -d '{
    "campaignKey": 1,
    "users": [
      {  
        "userId": "eb24b2d8-21a3-4e95-b801-626ba0904e01",
        "apiProperties": {
          "productNumber": "123"
        }
      }
    ]
  }'

Response

The response to the API send request returns either a Success Response or an Error Response object.

Success

200 OK

FieldData TypeDescription
dispatchIdstringA unique UUID for the push message request triggered by the API
messagestringContains the message "success".

A successful push message send request does not guarantee that the user actually received the push message.

You can check the final send success statistics on the dashboard.

Error

FieldData TypeDescription
codestringSpecific error response code
messagestringDisplays an error message
Http StatusCodeMessageDescription
401INVALID_API_KEY“Invalid API key“When an invalid API KEY is included in the header
401API_KEY_NOT_FOUND“The API key must be included in the header”When the API KEY is not included in the header
400EXCEED_USER_MAX_LENGTH“Max input length exceeded“When the request exceeds the maximum number of users that can be sent at once
400CAMPAIGN_NOT_FOUND“Could not find push message campaign with the given key“When there is no API-based campaign matching the provided campaign key
400EMPTY_IDENTIFIER“At least one identifier should be given“When both userId and deviceId are missing in the target user information

Example

Successful Send Request Example

{
    "dispatchId": "bac3da45-f6e3-44ea-989e-e0fa0ffc9f5c",
    "message": "success"
}

Failed Send Request Example

{
    "code": "INVALID_API_KEY",
    "message": "Invalid API key"
}