📘 Available in SDK version >= v0.11.0
Payload Schema
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 recipients
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 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.
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>.
Sample template with actor and recipient properties:
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 use 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 trigger 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 workflows.bulk_trigger_instance() instance to add however-many-records to call in bulk.
Add file attachment in email
To add one or more Attachments to a Notification (viz. Email), callwf_instance.add_attachment() for each file with local-path. Ensure that file_path is proper, otherwise it will raise FileNotFoundError.
Dynamic workflow trigger
You can trigger workflow from python SDK usingsupr_client.trigger_workflow method.
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. Note: The actual processing/execution of workflow happens asynchronously.
Once your request is accepted, you can check the status of your request in the ’ SuprSend Logs’ section.
+CountryCode Required for SMS and Whatsapp:For setting
$sms and $whatsapp, +<countrycode> is mandatory to send along with phone number. Eg: +1 for US
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.