📘 Available in SDK version >= 1.10.0
Payload Schema
Once your request is accepted, you can check the status of your request in the SuprSend Logs.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.Sending notification to Multiple Users
Recipients in workflow call is an array ofdistinct_ids or recipient objects. You can pass up to 100 recipients in a single workflow trigger. SuprSend will internally convert it into multiple workflow triggers, one for each recipient in the array.
Use lists to broadcast to a large list of users:We recommend you to use lists and broadcast to send notifications to a user list larger than 1000 users. This approach allows bulk processing, 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.
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 object with look like
Add user communication channel
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>.
Sending notification to anonymous user
You can send notifications to anonymous users by passing"is_transient": true in your recipient object. This approach is recommended for scenarios where you need to send notifications to unregistered users without creating them in the SuprSend platform. The same way, you can pass "is_transient": true in your actor object to use actor properties in template without creating user profile.
Multi-tenant notifications
For cases where you want to send notifications to your enterprise customers end users, pass thetenant_id in your workflow instance. You can use this to dynamically manage tenant level notification customizations. This includes the ability to customize template design or content and route notifications via tenant vendors.
Idempotent requests
SuprSend supports idempotency to ensure that requests can be retried safely without duplicate processing. If Suprsend receives and processes a request with an idempotency_key, it will skip processing requests with sameidempotency_key for next 24 hours. Idempotency key should be uniquely generated for each request (max 255 characters allowed). Spaces in start and end of the key will be trimmed. Here are some common approaches for generating idempotency keys:
- Generate a random UUID for each request.
- Construct the idempotency key by combining relevant information about the request. This can include parameters, identifiers, or specific contextual details that are meaningful within your application. for example, you could concatenate the user ID, action, and timestamp to form an idempotency key like
user147-new-comment-1687437670 - Request-specific Identifier: If your request already contains a unique identifier, such as an order ID or a job ID, you can use that identifier directly as the idempotency key.
Bulk API for triggering multiple workflows
Bulk API allows you to send multiple workflow requests in a single call. Use.append() and workflows.bulk_trigger_instance() to add however-many-records to call in bulk.
Add attachment (in email)
To add one or more attachments to a notification (viz. Email), callwf_instance.add_attachment() for each file with local path or remote attachment url. Ensure that file path is valid, and public(for remote url) otherwise it will raise error.
Dynamic workflow trigger
You can trigger workflow from node SDK by usingsupr_client.trigger_workflow method. Import Workflow class before calling this method. Once your request is accepted, you can check the status of your request in the SuprSend Logs section.
For setting
$sms and $whatsapp, +<countrycode> is mandatory to send along with phone number. Eg: +1 for US
To find the template slug name on SuprSend platform, click on the clipboard icon on Templates page. Templates > Template Details Page
Bulk API for triggering multiple workflows
Bulk API allows you to send multiple workflow requests in a single call. There isn’t any limit on number-of-records that can be added to bulk_workflows instance. Use.append() on bulk_workflows instance to add however-many-records to call in bulk.