curl --request POST \
--url https://api-0{X}.moengage.com/v1.0/business_event/trigger \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: <content-type>' \
--data '
{
"event_name": "Series_Name",
"event_attributes": {
"season": "Season 1",
"episodes": 12,
"cast": [
"John Doe",
"Jane Doe"
],
"date": "11/11/2023"
},
"triggered_by": "john.doe@example.com"
}
'import requests
url = "https://api-0{X}.moengage.com/v1.0/business_event/trigger"
payload = {
"event_name": "Series_Name",
"event_attributes": {
"season": "Season 1",
"episodes": 12,
"cast": ["John Doe", "Jane Doe"],
"date": "11/11/2023"
},
"triggered_by": "john.doe@example.com"
}
headers = {
"Content-Type": "<content-type>",
"Authorization": "Basic <encoded-value>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': '<content-type>', Authorization: 'Basic <encoded-value>'},
body: JSON.stringify({
event_name: 'Series_Name',
event_attributes: {
season: 'Season 1',
episodes: 12,
cast: ['John Doe', 'Jane Doe'],
date: '11/11/2023'
},
triggered_by: 'john.doe@example.com'
})
};
fetch('https://api-0{X}.moengage.com/v1.0/business_event/trigger', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-0{X}.moengage.com/v1.0/business_event/trigger",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'event_name' => 'Series_Name',
'event_attributes' => [
'season' => 'Season 1',
'episodes' => 12,
'cast' => [
'John Doe',
'Jane Doe'
],
'date' => '11/11/2023'
],
'triggered_by' => 'john.doe@example.com'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: <content-type>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api-0{X}.moengage.com/v1.0/business_event/trigger"
payload := strings.NewReader("{\n \"event_name\": \"Series_Name\",\n \"event_attributes\": {\n \"season\": \"Season 1\",\n \"episodes\": 12,\n \"cast\": [\n \"John Doe\",\n \"Jane Doe\"\n ],\n \"date\": \"11/11/2023\"\n },\n \"triggered_by\": \"john.doe@example.com\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("Authorization", "Basic <encoded-value>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api-0{X}.moengage.com/v1.0/business_event/trigger")
.header("Content-Type", "<content-type>")
.header("Authorization", "Basic <encoded-value>")
.body("{\n \"event_name\": \"Series_Name\",\n \"event_attributes\": {\n \"season\": \"Season 1\",\n \"episodes\": 12,\n \"cast\": [\n \"John Doe\",\n \"Jane Doe\"\n ],\n \"date\": \"11/11/2023\"\n },\n \"triggered_by\": \"john.doe@example.com\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-0{X}.moengage.com/v1.0/business_event/trigger")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = '<content-type>'
request["Authorization"] = 'Basic <encoded-value>'
request.body = "{\n \"event_name\": \"Series_Name\",\n \"event_attributes\": {\n \"season\": \"Season 1\",\n \"episodes\": 12,\n \"cast\": [\n \"John Doe\",\n \"Jane Doe\"\n ],\n \"date\": \"11/11/2023\"\n },\n \"triggered_by\": \"john.doe@example.com\"\n}"
response = http.request(request)
puts response.read_bodyTrigger Business Event
This API allows you to trigger a business event in MoEngage. You can set up campaigns to be executed when these events are triggered.
curl --request POST \
--url https://api-0{X}.moengage.com/v1.0/business_event/trigger \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: <content-type>' \
--data '
{
"event_name": "Series_Name",
"event_attributes": {
"season": "Season 1",
"episodes": 12,
"cast": [
"John Doe",
"Jane Doe"
],
"date": "11/11/2023"
},
"triggered_by": "john.doe@example.com"
}
'import requests
url = "https://api-0{X}.moengage.com/v1.0/business_event/trigger"
payload = {
"event_name": "Series_Name",
"event_attributes": {
"season": "Season 1",
"episodes": 12,
"cast": ["John Doe", "Jane Doe"],
"date": "11/11/2023"
},
"triggered_by": "john.doe@example.com"
}
headers = {
"Content-Type": "<content-type>",
"Authorization": "Basic <encoded-value>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': '<content-type>', Authorization: 'Basic <encoded-value>'},
body: JSON.stringify({
event_name: 'Series_Name',
event_attributes: {
season: 'Season 1',
episodes: 12,
cast: ['John Doe', 'Jane Doe'],
date: '11/11/2023'
},
triggered_by: 'john.doe@example.com'
})
};
fetch('https://api-0{X}.moengage.com/v1.0/business_event/trigger', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-0{X}.moengage.com/v1.0/business_event/trigger",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'event_name' => 'Series_Name',
'event_attributes' => [
'season' => 'Season 1',
'episodes' => 12,
'cast' => [
'John Doe',
'Jane Doe'
],
'date' => '11/11/2023'
],
'triggered_by' => 'john.doe@example.com'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: <content-type>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api-0{X}.moengage.com/v1.0/business_event/trigger"
payload := strings.NewReader("{\n \"event_name\": \"Series_Name\",\n \"event_attributes\": {\n \"season\": \"Season 1\",\n \"episodes\": 12,\n \"cast\": [\n \"John Doe\",\n \"Jane Doe\"\n ],\n \"date\": \"11/11/2023\"\n },\n \"triggered_by\": \"john.doe@example.com\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("Authorization", "Basic <encoded-value>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api-0{X}.moengage.com/v1.0/business_event/trigger")
.header("Content-Type", "<content-type>")
.header("Authorization", "Basic <encoded-value>")
.body("{\n \"event_name\": \"Series_Name\",\n \"event_attributes\": {\n \"season\": \"Season 1\",\n \"episodes\": 12,\n \"cast\": [\n \"John Doe\",\n \"Jane Doe\"\n ],\n \"date\": \"11/11/2023\"\n },\n \"triggered_by\": \"john.doe@example.com\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-0{X}.moengage.com/v1.0/business_event/trigger")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = '<content-type>'
request["Authorization"] = 'Basic <encoded-value>'
request.body = "{\n \"event_name\": \"Series_Name\",\n \"event_attributes\": {\n \"season\": \"Season 1\",\n \"episodes\": 12,\n \"cast\": [\n \"John Doe\",\n \"Jane Doe\"\n ],\n \"date\": \"11/11/2023\"\n },\n \"triggered_by\": \"john.doe@example.com\"\n}"
response = http.request(request)
puts response.read_bodyFAQs
Do I need to pass the value for all event attributes while triggering the campaign?
Do I need to pass the value for all event attributes while triggering the campaign?
How do I know if the campaign has been triggered successfully?
How do I know if the campaign has been triggered successfully?
Authorizations
The Basic authentication header contains your Base64-encoded key. This authentication parameter, used for access control, must be passed with the request.
Format: Authorization: Basic Base64_ENCODED_WORKSPACEID_APIKEY==
Headers
Set the Content-Type header to application/json.
Body
Event to trigger.
The name of the business event to be triggered.
"Series_Name"
This field contains the event attributes with which the business event will be triggered.
Structure: "event_attributes": { "attribute_name1": "", ... }
Every attribute contains the following information: attribute_name - This field contains the name of the business event attribute for which the value is being sent in the request. The attribute_name is a String.
Example: "attribute_name": "season"
{ "season": "Season 1", "episodes": 12, "cast": ["John Doe", "Jane Doe"], "date": "11/11/2023" }
Information about who triggered the business event.
"john.doe@example.com"
Response
This response is returned when the request is processed successfully.
"The business event has been triggered"
Was this page helpful?