Overview
By default, notifications are triggered for thedefault tenant (represents your organization). Pass tenant_id in workflow or event calls to apply tenant-specific customizations.
When tenant_id is passed:
- Tenant properties replace variables in templates
- Per-tenant preferences are applied
- Tenant-specific vendor routing is used if configured
📘 For entirely different business lines with separate user bases, use different workspaces instead of tenants.
Workflow trigger
curl --request POST \
--url https://hub.suprsend.com/trigger/ \
--header 'Authorization: Bearer __api_key__' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{
"workflow": "_workflow_slug_",
"recipients": [
{
"distinct_id": "0gxxx9f14-xxxx-23c5-1902-xxxcb6912ab09",
"$email": ["user@example.com"]
}
],
"data": {},
"tenant_id": "_tenant_id_",
"$idempotency_key": "_unique_identifier_"
}'
from suprsend import Suprsend, WorkflowTriggerRequest
supr_client = Suprsend("_workspace_key_", "_workspace_secret_")
w1 = WorkflowTriggerRequest(
body={
"workflow": "_workflow_slug_",
"recipients": [{"distinct_id": "0gxxx9f14-xxxx-23c5-1902-xxxcb6912ab09", "$email": ["user@example.com"]}],
"data": {}
},
tenant_id="_tenant_id_",
idempotency_key="_unique_identifier_"
)
response = supr_client.workflows.trigger(w1)
print(response)
const { Suprsend, WorkflowTriggerRequest } = require("@suprsend/node-sdk");
const supr_client = new Suprsend("_workspace_key_", "_workspace_secret_");
const w1 = new WorkflowTriggerRequest(
{
workflow: "_workflow_slug_",
recipients: [{ distinct_id: "0gxxx9f14-xxxx-23c5-1902-xxxcb6912ab09", $email: ["user@example.com"] }],
data: {}
},
{
tenant_id: "_tenant_id_",
idempotency_key: "_unique_identifier_"
}
);
const response = supr_client.workflows.trigger(w1);
response.then((res) => console.log("response", res));
import java.util.Arrays;
import org.json.JSONArray;
import org.json.JSONObject;
import suprsend.Suprsend;
import suprsend.SuprsendException;
import suprsend.WorkflowTriggerRequest;
Suprsend suprClient = new Suprsend("_workspace_key_", "_workspace_secret_");
JSONObject body = new JSONObject()
.put("workflow", "_workflow_slug_")
.put("recipients", new JSONArray()
.put(new JSONObject()
.put("distinct_id", "0gxxx9f14-xxxx-23c5-1902-xxxcb6912ab09")
.put("$email", Arrays.asList("user@example.com"))))
.put("data", new JSONObject());
WorkflowTriggerRequest wf = new WorkflowTriggerRequest(body, "_tenant_id_", "_unique_identifier_");
JSONObject response = suprClient.workflows.trigger(wf);
System.out.println(response);
package main
import (
"log"
suprsend "github.com/suprsend/suprsend-go"
)
func main() {
suprClient, err := suprsend.NewClient("_workspace_key_", "_workspace_secret_")
if err != nil {
log.Fatalln(err)
}
w1 := &suprsend.WorkflowTriggerRequest{
Body: map[string]interface{}{
"workflow": "_workflow_slug_",
"recipients": []map[string]interface{}{{"distinct_id": "0gxxx9f14-xxxx-23c5-1902-xxxcb6912ab09", "$email": []string{"user@example.com"}}},
"data": map[string]interface{}{},
},
TenantId: "_tenant_id_",
IdempotencyKey: "_unique_identifier_",
}
resp, err := suprClient.Workflows.Trigger(w1)
if err != nil {
log.Fatalln(err)
}
log.Println(resp)
}
Event trigger
curl --request POST \
--url https://hub.suprsend.com/event/ \
--header 'Authorization: Bearer __api_key__' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{
"distinct_id": "0fxxx8f74-xxxx-41c5-8752-xxxcb6911fb08",
"event": "new_user_signup",
"properties": {},
"tenant_id": "_tenant_id_"
}'
from suprsend import Suprsend, Event
supr_client = Suprsend("_workspace_key_", "_workspace_secret_")
event = Event(
distinct_id="0fxxx8f74-xxxx-41c5-8752-xxxcb6911fb08",
event_name="new_user_signup",
properties={},
tenant_id="_tenant_id_"
)
response = supr_client.track_event(event)
print(response)
const { Suprsend, Event } = require("@suprsend/node-sdk");
const supr_client = new Suprsend("_workspace_key_", "_workspace_secret_");
const event = new Event(
"0fxxx8f74-xxxx-41c5-8752-xxxcb6911fb08",
"new_user_signup",
{},
{ tenant_id: "_tenant_id_" }
);
const response = supr_client.track_event(event);
response.then((res) => console.log("response", res));
import org.json.JSONObject;
import suprsend.Suprsend;
import suprsend.SuprsendException;
import suprsend.Event;
Suprsend suprClient = new Suprsend("_workspace_key_", "_workspace_secret_");
String distinctId = "0fxxx8f74-xxxx-41c5-8752-xxxcb6911fb08";
String eventName = "new_user_signup";
JSONObject properties = new JSONObject();
Event e = new Event(distinctId, eventName, properties, null, "_tenant_id_");
JSONObject response = suprClient.trackEvent(e);
System.out.println(response);
package main
import (
"log"
suprsend "github.com/suprsend/suprsend-go"
)
func main() {
suprClient, err := suprsend.NewClient("_workspace_key_", "_workspace_secret_")
if err != nil {
log.Fatalln(err)
}
ev := &suprsend.Event{
EventName: "new_user_signup",
DistinctId: "0fxxx8f74-xxxx-41c5-8752-xxxcb6911fb08",
Properties: map[string]interface{}{},
TenantId: "_tenant_id_",
}
_, err = suprClient.TrackEvent(ev)
if err != nil {
log.Fatalln(err)
}
}
Related documentation
- Tenant Templates - Use tenant properties in templates
- Tenant Management - Create and update tenants
- Tenant Vendors - Configure tenant-specific vendor routing
- Tenant Preferences - Set tenant-level notification preferences