Trigger Workflow
Learn how to trigger multi-channel, multi-tenant workflows in SuprSend
You can trigger workflows designed on SuprSend dashboard via making a direct call to workflows.trigger
endpoint or via event trigger. In SuprSend, we refer events as user-initiated actions, such as social media interactions, or system-generated events like pending payments. User needs to be created beforehand for event based triggers.
Direct API trigger is a straightforward way to get started, as you can include recipient channel information directly in the API call and doesn’t require prior user creation to initiate the notification.
Triggering workflow via API
It is a unified API to trigger workflow and doesn’t require user creation before hand to trigger notification. Recommended for platforms transitioning their existing notifications to SuprSend. If you are using our frontend SDKs to configure notifications and passing events and user properties from third-party data platforms like Segment, then event-based trigger would be a better choice.
It is a new workflow method and is available in below SDK versions (Python >= v0.11.0, Go >= v0.5.1, Node >= 1.10.0 and Java >= 0.7.0). Upgrade to the latest version if you are on older SDK versions.
Here is a list of integrations that you can use to trigger workflow over API:
Sample Payload
Here is a sample payload of direct API trigger
To prevent automatic creation of an actor, or recipient (user/object) in SuprSend (the case where they already exist in your system), you can use the "$skip_create": true
flag.
This can be applied inside the actor, individual user recipient objects, or object recipient objects.
Payload Schema
Property | Type | Description |
---|---|---|
workflow | string | Slug of designed workflow on SuprSend dashboard. You’ll get the slug from workflow settings. |
actor (optional) | string / object | Includes distinct_id and properties of the user who performed the action. You can use it for cross-user notifications where you need to include actor properties in notification template. Actor properties can be added as $actor.<prop> . |
recipients | array of string / array of objects | List of users who need to be notified. You can add upto 100 recipients in a workflow trigger. You can either pass recipients as an array of distinct_ID (if user is pre-synced in SuprSend database) or define recipient information inline. To notify object, pass object_id and type in recipient JSON. |
data | object | variable data required to render dynamic template content or workflow properties such as dynamic delay or channel override in send node. |
tenant_id | string | unique identifier of the brand / tenant |
idempotency_key | string | unique identifier of the request. We’ll be returning idempotency_key in our outbound webhook response. You can use it to map notification statuses and replies in your system. |
recipients[].$timezone | string | to set recipient’s timezone. Used to send notification in user’s local timezone. You can pass timezone in IANA (TZ identifier) format. |
recipients[].$preferred_language | string | to set recipient’s preferred language. This is to support localization in notification content. You can pass the language in ISO 639-1 2-letter format. Refer all language codes here. |
$skip_create | boolean | Optional flag that can be used inside actor , or recipient payloads including both user , or object . When set to true , SuprSend will not create the user or object if it doesn’t already exist in the system. |
Identifying recipients inline
One of the benefits of using direct workflow trigger is that you can identify recipients inline. You can include recipient channel information, their channel preferences, and their user properties along with the workflow trigger. Upon triggering the workflow, the recipient will be automatically created in the SuprSend database in the background.
This facilitates dynamic synchronization of your user data within SuprSend and eliminates the need for any migration efforts on your end to start sending notifications from SuprSend. You can also use recipient properties in your template as $recipient.<property>
.
This is how the complete recipient payload with look like
Property | Type | Description |
---|---|---|
distinct_id | string | Unique identifier of the user to be notified. |
communication channels ( sms etc). | array of string | You can pass user channel information using $<channel> key. This will override existing channel value from the user profile and use the channel value defined in the key for notification trigger. The same channel information will also be appended to user profile in the background Refer how different communication channels can be passed here |
$channels | array of string / dicts | Use it to pass user’s channel preference in the payload. You can always use our in-build preference APIs to maintain user notification preferences. Preferences defined within SuprSend will automatically apply with workflow trigger. By default, notifications will be sent to all channels defined in the workflow delivery node. However, if you have a scenario where user has specific channel preference for a notification (e.g., they only want to receive payment reminders via email), you can include that preference in the workflow payload. This will ensure that notifications are sent only to the channels specified in the $channels key. The supported channel values are email, sms, whatsapp, androidpush, iospush, slack, webpush, ms_teams . |
$preferred_language | string | to set recipient’s preferred language. This is to support localization in notification content. You can pass the language in ISO 639-1 2-letter format. Refer all language codes here . |
$timezone | string | to set recipient’s timezone. Used to send notification in user’s local timezone. You can pass timezone in IANA (TZ identifier) format. |
* | key-value pair | You can pass other user properties to render dynamic template content in key-value pair as "user_prop1":"value1" . Extra properties will be set in subscriber profile (as subscriber properties) which can then be used in the template as $recipient.<property> . |
Add User Communication Channel
Sending notification to multiple recipients
Recipients in workflow call is an array of distinct_ids
or recipient objects. You can pass upto 100 recipients in a single workflow trigger. SuprSend will internally convert it into multiple workflow triggers, one for each recipient in the array.
We recommend you to use lists and broadcasts to send notifications to a user list larger than 1000 users. This approach allows for bulk processing within SuprSend, resulting in significantly faster delivery compared to individual workflow calls. Sending individual workflows to a large set of users may introduce delays in your notification queue and is not an optimized way of handling bulk trigger.
Sending cross-user notifications
In scenarios where you need to notify a group of users based on another user’s action, such as sending a notification to the document owner when someone comments on it, you can specify the actor in your workflow call. This allows you to use actor’s name or other properties in your notification template. Actor properties can be included in the template as $actor.<property>
.
Sample template with actor and recipient properties:
Event based trigger
It is a cleaner way of triggering notifications where your user sync is separate and events are generated from multiple sources, backend systems, Frontend applications (user actions on the platform) or CDP platforms like Segment.
Please Note that the user profile should be created beforehand for distinct_id
passed in your event call. If user is not present, it will discard the event call.
Object triggers are not currently supported in event. Please get in touch if you have this requirement.
Below is a sample event call to trigger payment reminder workflow:
Here is a list of all integrations that you can use to trigger event:
Python Backend SDK
Node Backend SDK
Java Backend SDK
Go Backend SDK
Trigger Event HTTP API
JavaScript Frontend SDK
(Web)
Kotlin Frontend SDK
(Android)
React Native Frontend SDK
(App)
Flutter Frontend SDK
(App)
Segment
Customer Data Platform (CDP)
Triggering workflow using google sheets
Recommended for one-time notification trigger.
This can be used by growth or product teams to trigger one time notifications for lead generation, sales cold messaging or to send announcements and product updates. We do not recommend sending more than 10,000 notifications using google sheets as each row in google sheet trigger converts to 1 workflow request and might take a lot of time to process.
Also, since triggers via google sheets are generally promotional notifications, we recommend using one of the promotional sub-categories to trigger this notification. Read more about categories and how they impact your send latencies.
Here’s a step-by-step guide on how to send notifications using google sheets:
Create a template group on SuprSend account.
All the static content can be designed on the template, and all the variable data defined within {{...}}
will be passed from the Google Sheet at the time of trigger.
Create a google sheet with following data.
Each row in the sheet corresponds to one recipient.
-
ditinct_id
**column ** - this is the unique identifier of the user who needs to be notified. -
**Dynamic data columns **- you need to create one column each for the dynamic data (aka variables) in your template. Note that variable names are case sensitive.
If this is the template content:Hi {{name}}, your {{Event}} is scheduled at {{Schedule}}. See you there.
, you’ll have to create a column for each template variable -name
,Event
, andschedule
in your sheet. -
**User Channels columns **- Next, create columns for user channel details. These channel columns are necessary to pass channel information that may not be present in the user profile.
It’s always a good practice to include channel information if you’re unsure of its presence in the user profile. You can pass channels asWA
for whatsapp,Email
for email andSMS
for SMS.
For Whatsapp and SMS, you need to enter country code infront of the mobile number as+917123xxxxxx
. -
SuprSend Status
**column ** - Fill the valueTBT
in rows for which you want to trigger the notification. Once, the notification is triggered, the status changes toOK
.
📘 TIP:
Google Sheet doesn’t allow to start a field with *
+
**. To enter in + format, use string function:="+917123xxxxxx"
Go top the Google Sheets Navbar
In the Navbar of Google Sheets, click on Extensions
and select Apps Script
Remove the default information in the Apps Script
It will open Apps Script in a new tab. Remove the default information present in the editor, and copy-paste the following in the editor.
You’ll find following information to be added in your script from SuprSend dashboard.
Data | Description |
---|---|
api-key | API Key for your workspace. From left navigation panel, select settings -> API keys. |
api-secret | API Key for your workspace. From left navigation panel, select settings -> API keys. |
template-slug | Add the template slug of the template that you want to trigger. You can copy the the template slug by clicking on copy icon next to the template name on template details page. |
Workflow Name | Give a name to identify your workflow. It’ll help you locate the sent workflow on the workflow listing page. You can see the notification performance on Workflow -> Analytics page. |
category | Provide notification category. We recommend using promotional sub-category for sending engagement notifications. You can read more Notification Categories here. |
Save the Script - Close the Tab - Reload your Google Sheets Page!
After reloading, you will find a new option named “SuprSend” in the navigation bar. On clicking it, you will see the option to “Trigger SuprSend Workflow”. On triggering, the script will pick up all the rows which have value
in the column name “SuprSend Status”, and will make an API call to SuprSend. For the successful API call, the status will change to OK
.
Check the Status
You can check the status of your notification trigger on the Logs
page.
Was this page helpful?