Bulletins API

Overview

This endpoint enables you to raise a Bulletin after a business event is triggered.

Base URL

Here is an example base URL from the account in the India region:
https://in1.api.clevertap.com/1/targets/trigger.json

Region

Refer Region for more details.

HTTP Method

POST

Headers

Refer Headers for more details.

Body Parameters

The body is uploaded as a JSON payload. The payload is an object keyed with “d” whose value is an array describing the event including the event name, event properties, timestamp, and user identifier.

Event keys are limited to 120 characters and property values are limited to 512 bytes.

For each event, a user identifier is required. This is the key that CleverTap uses to find the user whose profile needs to be updated.

🚧

Note:

CleverTap only supports String Data type for mapped property values.

ParameterDescriptionTypeExample Value
business_eventThe business event need to trigger the Bulletin. (Required)string"Program Released"
nameThe name of the Bulletin. (Required)stringSa Re Ga Ma episode 12
propertiesEvent properties describing the business event. (Required)string"properties" :
{ "program_id" : "234567", "language":"Hindi", "prev_program_id":"123457"
c-byCreator of the Bulletin. (Required)string"[email protected]"

Below is an example payload.

{
    "business_event" : "Program Released",
    "name" : "Sa Re Ga Ma episode 12",
    "properties" : {
        "program_id" : "234567",
        "language":"Hindi",
        "prev_program_id":"123457"
    },
    "c-by" : "[email protected]",
    "when":"now"
}

Example Request

Here is an example cURL request to the Bulletins API showing the headers needed to authenticate the request from the account in the India region:

curl -X POST -d '{"business_event":true"}' "https://in1.api.clevertap.com/1/targets/trigger.json" \
-H "X-CleverTap-Account-Id: ACCOUNT_ID" \
-H "X-CleverTap-Passcode: PASSCODE" \
-H "Content-Type: application/json"
require 'net/http'
require 'uri'
require 'json'

uri = URI.parse("https://in1.api.clevertap.com/1/targets/trigger.json")
request = Net::HTTP::Post.new(uri)
request.content_type = "application/json"
request["X-Clevertap-Account-Id"] = "ACCOUNT_ID"
request["X-Clevertap-Passcode"] = "PASSCODE"
request.body = JSON.dump({
  "user_type" => true
  
})

req_options = {
  use_ssl: uri.scheme == "https",
}

response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
  http.request(request)
end
import requests

headers = {
    'X-CleverTap-Account-Id': 'ACCOUNT_ID',
    'X-CleverTap-Passcode': 'PASSCODE',
    'Content-Type': 'application/json',
}

data = '{"user_type":true}'

response = requests.post('https://in1.api.clevertap.com/1/targets/trigger.json', headers=headers, data=data)
<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
    'X-CleverTap-Account-Id' => 'ACCOUNT_ID',
    'X-CleverTap-Passcode' => 'PASSCODE',
    'Content-Type' => 'application/json'
);
$data = '{"user_type":true}';
$response = Requests::post('https://in1.api.clevertap.com/1/targets/trigger.json', $headers, $data);
var request = require('request');

var headers = {
    'X-CleverTap-Account-Id': 'ACCOUNT_ID',
    'X-CleverTap-Passcode': 'PASSCODE',
    'Content-Type': 'application/json'
};

var dataString = '{"user_type":true}';

var options = {
    url: 'https://in1.api.clevertap.com/1/targets/trigger.json',
    method: 'POST',
    headers: headers,
    body: dataString
};

function callback(error, response, body) {
    if (!error && response.statusCode == 200) {
        console.log(body);
    }
}

request(options, callback);

Example Response

{
    "status": "success",
    "targets": 1
}

Notes

The response will be a JSON object containing either the success or fail status.

The targets key returns the number of Bulletins that have been sent for the Business event that has been raised.

Expected errors

{
    "status": "fail",
    "error": "Business Event Not Found",
    "code": 400
}

When the Business event raised is not defined on the dashboard.

{
    "status": "fail",
    "error": "\"when\" has an incorrect value - null",
    "code": 400
}

The above error occurs when the "when" key is not defined while raising the business event.

{
    "status": "fail",
    "error": "Propertyproduct_categorymissing",
    "code": 400
}

The above error occurs when a property is missing while you are raising the business event.

API FAQs

To understand the common queries and concerns related to CleverTap APIs, refer to API FAQs.