---
title: "Dynamic Workflow Trigger"
method: POST
path: "/{workspace_key}/trigger/"
---

# Dynamic Workflow Trigger

`POST /{workspace_key}/trigger/`

API to dynamically create and trigger a single step workflow.

## Path parameters

- `workspace_key` string, required

## Request body

- object
  - `name` string, required — Unique name of the workflow. The workflow name should be easily identifiable for your reference at a later stage. You can see workflow-related analytics on the workflow page (how many notifications were sent, delivered, clicked or interacted).
  - `template` string, required — Unique slug of the template created on SuprSend dashboard. You can get this by clicking on the clipboard icon next to the Template name on SuprSend templates page.
  - `notification_category` string, required — Used to apply user category level [preferences]("/docs/user-preferences") on notification trigger.
  - `users` object[], required — Array object of target users.
    - `distinct_id` string, required — unique identifier of the user
    - `$channels` string[] — send notification on selected channels in user profile. Following channel keys can be used - email, sms, whatsapp, androidpush, iospush, slack, webpush
    - `$email` string[] — To trigger notification on a particular email
    - `$sms` string[] — Send SMS on a particular number.
    - `$whatsapp` string[] — Send Whatsapp on a particular number.
    - `$androidpush` string[] — Send androidpush on the given push token
    - `$iospush` string[] — Send iOSpush on the given push token
    - `$slack` union[] — Slack channel configuration
      - union
        - object
          - `email` string, email, required — User email address
          - `access_token` string, required — Slack bot access token
        - object
          - `user_id` string, required — Slack user ID (U/WXXXXXXXX format)
          - `access_token` string, required — Slack bot access token
        - object
          - `channel` string, required — Slack channel ID (CXXXXXXXX format)
          - `access_token` string, required — Slack bot access token
        - object
          - `incoming_webhook` object, required
            - `url` string, uri, required — Slack incoming webhook URL
    - `$ms_teams` union[] — Microsoft Teams channel configuration
      - union
        - object
          - `tenant_id` string, required — Microsoft Teams tenant ID
          - `service_url` string, uri, required — Microsoft Teams service URL
          - `conversation_id` string, required — Microsoft Teams conversation ID
        - object
          - `tenant_id` string, required — Microsoft Teams tenant ID
          - `service_url` string, uri, required — Microsoft Teams service URL
          - `user_id` string, required — Microsoft Teams user ID
        - object
          - `incoming_webhook` object, required
            - `url` string, uri, required — Microsoft Teams incoming webhook URL
  - `data` object — variable data required to render dynamic template content or workflow properties like dynamic delay or channel override in send node.
    - `$attachments` union[] — Use this key to pass email attachment in the trigger. You can either pass attachment as a public URL or as a base64-encoded file (limit < 50KB).
      - union
        - object — Pass file as **publicly accessible URL** (No limit on file size)
          - `url` string, uri, required — Publicly accessible URL of the file
          - `filename` string — Filename to be shown in email
          - `ignore_if_error` boolean — Ignore the attachment if it fails to load
        - object — Pass file as a **base-64 file** (supported limit < 50KB)
          - `data` string, required — Base64-encoded content of the file
          - `filename` string — Filename to be shown in email
          - `contentType` string
  - `delivery` object — delivery instructions for the workflow. You can set [Smart Delivery](https://docs.suprsend.com/docs/smart-delivery) preference by setting "smart":true
    - `smart` boolean — You can enable smart delivery by setting it true
    - `success` string — Success event for stopping further notification in case smart is set to true. You can set notification status like delivery, interaction or custom success event
    - `time_to_live` string — Time window to define delay between subsequent channel trigger in case of smart delivery. Delay = `time_to_live / (number_of_channels - 1)`. Format - `XXdXXhXXmXXs` or if its number (n) then delay is in seconds (n)
    - `mandatory_channels` string[] — Channels on which notification has to be sent immediately in case of smart delivery. Following channel keys can be used - email, sms, whatsapp, androidpush, iospush, slack, webpush
  - `delay` string — Workflow will be halted for the time mentioned in delay, and become active once the delay period is over. Format - `XXdXXhXXmXXs` or if its number (n) then delay is in seconds (n)
  - `trigger_at` string, date — Trigger workflow on a specific date-time. Format - date string in ISO 8601 e.g. "2022-08-27T20:14:51.643Z"
  - `tenant_id` string — string identifier of the tenant this workflow is associated with
  - `$idempotency_key` string — Unique identifier of the request (deduplicates request for 24hrs)

## Response `202`

202

- string

## Other responses

- `400` — 400

---

[API](https://skmtc.net/suprsend/apis/suprsend-api.md) · [All operations](https://skmtc.net/suprsend/apis/suprsend-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/suprsend/suprsend-api/versions/8bd2574bd2c3/schema)
