Pre-requisites
Create a list of usersTrigger broadcast
You can trigger broadcast usingsupr_client.subscriber_lists.broadcast() method.
from suprsend import Suprsend, SuprsendAPIException, SubscriberListBroadcast
supr_client = Suprsend(
"_workspace_key_",
"_workspace_secret_"
)
broadcast_body = {
"list_id": "_list_id_",
"template": "_template_slug_",
"notification_category": "promotional",
## ---- Optional Parameters ------
"data": {
"key1": "value1",
"key2": "value2"
},
"channels": [], # Channel keys - email, sms, whatsapp, androidpush, iospush, ms_teams, slack, webpush
"delay": "xxdxxhxxmxxs",
"trigger_at": "ISO 8601 timestamp"
}
inst = SubscriberListBroadcast(body=broadcast_body)
resp = supr_client.subscriber_lists.broadcast(inst)
print(resp)
from suprsend import Suprsend, SuprsendAPIException, SubscriberListBroadcast
supr_client = Suprsend(
"_workspace_key_",
"_workspace_secret_"
)
broadcast_body = {
"list_id": "application_abandoned",
"template": "complete_application",
"notification_category": "promotional",
# "channels": ["iospush"],
# "delay": "30m",
# "trigger_at": "2022-12-27T11:14:51.643Z",
"data": {
"page_no": "2"
}
}
inst = SubscriberListBroadcast(body=broadcast_body)
resp = supr_client.subscriber_lists.broadcast(inst)
print(resp)
{
'success': True,
'status': 'success',
'status_code': 202,
'message': 'OK'
}
| Parameter | Description | |
|---|---|---|
| list_id | list of users that you want to send broadcast messages to. | |
| template | Add template slug here. You can get this slug by selecting the clipboard icon next to the Template name on SuprSend templates page. It is the same for all channels | |
| notification_category | Preference Category to apply user preference settings while sending. Root categories- system / transactional / promotional | |
| data | variable data defined in templates or workflow | |
| channels | Specify channels if you don’t want to send notification of all live channels in the template. Available channel keys - email, SMS, WhatsApp, androidpush, iospush, ms_teams, slack, webpush | |
| delay | Broadcast will be halted for the time mentioned in delay, and become active once the delay period is over. Example: 1d2h3m4s / 60 | |
| trigger_at | Trigger broadcast on a specific date-time. Pass in ISO 8601 timestamp (for example “2021-08-27T20:14:51.643Z”) |