Learn how to send events to trigger workflows, with code snippets and examples.
supr_client.track_event
method. When you call supr_client.track_event
, the SDK internally makes an HTTP
call to SuprSend Platform to register this request, and you’ll immediately receive a response indicating the acceptance status. The actual processing/execution of event happens asynchronously.
Parameter | Description |
---|---|
distinct_id | distinct_id of subscriber performing the event. |
event_name | string identifier for the event like product_purchased . This should exactly match the one from created workflow. |
properties | dictionary representing event information. This can be used to pass variables to template. Property keys shouldn’t start with ss_ or $ . |
tenant_id (Optional) | Tenant ID of the tenant. |
idempotency_key (Optional) | unique key in the request call for idempotent requests. |
idempotency_key
, it will skip processing requests with same idempotency_key
for next 24 hours. You can use this key to track webhooks related to workflow notifications.
To make an idempotent request, pass idempotency_key
in the event instance. idempotency_key
should be unique that you generate for each request. You may use any string up to 255 characters in length as an idempotency key. Ensure that you don’t add any space in start and end of the key as it will be trimmed.
Here are some common approaches for assigning idempotency keys:
user147-new-comment-1687437670
.append()
on bulk_events
instance to add however-many-records to call in bulk.
add_attachment()
on event instance for each attachment file. Ensure that attachment url is valid and public, otherwise error will be raised. Since event API size can’t be > 100 KB, local file paths can’t be passed in event attachment.