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_bodyOKAuthorizations
Body
application/json
Lookup key stored on each execution this event triggers, so a Cancel Workflow node can later stop them by matching on it. Pass a literal string (max 512 characters; longer values are truncated). Overrides a target workflow's own Trigger-node Cancellation Key expression when both are present.
Maximum string length:
512Example:
"booking-123"
Response
202 - text/plain
202 - Accepted
Plain-text confirmation that the event was accepted for processing.
Example:
"OK"
⌘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_bodyOK