EVENTS
Trigger an Event
API to pass an event, which in turn triggers workflows where that event is defined as the trigger.
POST
/
event
/
Trigger an Event
curl --request POST \
--url https://hub.suprsend.com/event/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"distinct_id": "0fxxx8f74-xxxx-41c5-8752-xxxcb6911fb08",
"event": "ON SHIPMENT ARRIVAL",
"properties": {
"amount": "3780$",
"number": "TRXC1034",
"vehicle": "Truck",
"locations": "San Francisco"
}
}
'import requests
url = "https://hub.suprsend.com/event/"
payload = {
"distinct_id": "0fxxx8f74-xxxx-41c5-8752-xxxcb6911fb08",
"event": "ON SHIPMENT ARRIVAL",
"properties": {
"amount": "3780$",
"number": "TRXC1034",
"vehicle": "Truck",
"locations": "San Francisco"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
distinct_id: '0fxxx8f74-xxxx-41c5-8752-xxxcb6911fb08',
event: 'ON SHIPMENT ARRIVAL',
properties: {
amount: '3780$',
number: 'TRXC1034',
vehicle: 'Truck',
locations: 'San Francisco'
}
})
};
fetch('https://hub.suprsend.com/event/', 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://hub.suprsend.com/event/",
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([
'distinct_id' => '0fxxx8f74-xxxx-41c5-8752-xxxcb6911fb08',
'event' => 'ON SHIPMENT ARRIVAL',
'properties' => [
'amount' => '3780$',
'number' => 'TRXC1034',
'vehicle' => 'Truck',
'locations' => 'San Francisco'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://hub.suprsend.com/event/"
payload := strings.NewReader("{\n \"distinct_id\": \"0fxxx8f74-xxxx-41c5-8752-xxxcb6911fb08\",\n \"event\": \"ON SHIPMENT ARRIVAL\",\n \"properties\": {\n \"amount\": \"3780$\",\n \"number\": \"TRXC1034\",\n \"vehicle\": \"Truck\",\n \"locations\": \"San Francisco\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://hub.suprsend.com/event/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"distinct_id\": \"0fxxx8f74-xxxx-41c5-8752-xxxcb6911fb08\",\n \"event\": \"ON SHIPMENT ARRIVAL\",\n \"properties\": {\n \"amount\": \"3780$\",\n \"number\": \"TRXC1034\",\n \"vehicle\": \"Truck\",\n \"locations\": \"San Francisco\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://hub.suprsend.com/event/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"distinct_id\": \"0fxxx8f74-xxxx-41c5-8752-xxxcb6911fb08\",\n \"event\": \"ON SHIPMENT ARRIVAL\",\n \"properties\": {\n \"amount\": \"3780$\",\n \"number\": \"TRXC1034\",\n \"vehicle\": \"Truck\",\n \"locations\": \"San Francisco\"\n }\n}"
response = http.request(request)
puts response.read_body"OK"Authorizations
Pass as Bearer <API_KEY>. Get API Key from SuprSend dashboard Developers -> API Keys section.
Body
application/json
distinct_id of recipient who should receive the notification
string identifier for the event like product_purchased
Properties are used to render template or workflow variables in the trigger.
Show child attributes
Show child attributes
string identifier of the tenant this event is associated with
Idempotency key (valid for 24hours)
Response
202 - application/json
202 - Accepted
Confirmation that the event was accepted for processing.
Status message indicating the event was accepted.
Example:
"OK"
Was this page helpful?
Previous
List MessagesRetrieve a paginated list of messages in a workspace order by created_at desc. Can be used to fetch and show message logs on the platform.
Next
⌘I
Trigger an Event
curl --request POST \
--url https://hub.suprsend.com/event/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"distinct_id": "0fxxx8f74-xxxx-41c5-8752-xxxcb6911fb08",
"event": "ON SHIPMENT ARRIVAL",
"properties": {
"amount": "3780$",
"number": "TRXC1034",
"vehicle": "Truck",
"locations": "San Francisco"
}
}
'import requests
url = "https://hub.suprsend.com/event/"
payload = {
"distinct_id": "0fxxx8f74-xxxx-41c5-8752-xxxcb6911fb08",
"event": "ON SHIPMENT ARRIVAL",
"properties": {
"amount": "3780$",
"number": "TRXC1034",
"vehicle": "Truck",
"locations": "San Francisco"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
distinct_id: '0fxxx8f74-xxxx-41c5-8752-xxxcb6911fb08',
event: 'ON SHIPMENT ARRIVAL',
properties: {
amount: '3780$',
number: 'TRXC1034',
vehicle: 'Truck',
locations: 'San Francisco'
}
})
};
fetch('https://hub.suprsend.com/event/', 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://hub.suprsend.com/event/",
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([
'distinct_id' => '0fxxx8f74-xxxx-41c5-8752-xxxcb6911fb08',
'event' => 'ON SHIPMENT ARRIVAL',
'properties' => [
'amount' => '3780$',
'number' => 'TRXC1034',
'vehicle' => 'Truck',
'locations' => 'San Francisco'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://hub.suprsend.com/event/"
payload := strings.NewReader("{\n \"distinct_id\": \"0fxxx8f74-xxxx-41c5-8752-xxxcb6911fb08\",\n \"event\": \"ON SHIPMENT ARRIVAL\",\n \"properties\": {\n \"amount\": \"3780$\",\n \"number\": \"TRXC1034\",\n \"vehicle\": \"Truck\",\n \"locations\": \"San Francisco\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://hub.suprsend.com/event/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"distinct_id\": \"0fxxx8f74-xxxx-41c5-8752-xxxcb6911fb08\",\n \"event\": \"ON SHIPMENT ARRIVAL\",\n \"properties\": {\n \"amount\": \"3780$\",\n \"number\": \"TRXC1034\",\n \"vehicle\": \"Truck\",\n \"locations\": \"San Francisco\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://hub.suprsend.com/event/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"distinct_id\": \"0fxxx8f74-xxxx-41c5-8752-xxxcb6911fb08\",\n \"event\": \"ON SHIPMENT ARRIVAL\",\n \"properties\": {\n \"amount\": \"3780$\",\n \"number\": \"TRXC1034\",\n \"vehicle\": \"Truck\",\n \"locations\": \"San Francisco\"\n }\n}"
response = http.request(request)
puts response.read_body"OK"