Back to Novu

Create topic subscriptions

docs/api-reference/topics/create-topic-subscriptions.mdx

3.19.01.0 KB
Original Source

Subscribe one or more subscribers to a topic. Pass subscriptions as subscriber IDs, or as objects with identifier and subscriberId when you need a custom subscription key.

Preferences can include JSON Logic conditions evaluated at trigger time against the trigger payload, subscriber profile, actor, and context. Use paths such as { "var": "payload.fieldName" }, { "var": "subscriber.data.tier" }, { "var": "actor.data.role" }, or { "var": "context.tenant.id" }.

Pass an optional context object to scope subscriptions to a Context. The Context on the subscription must exactly match the Context on the workflow trigger. See Context-scoped subscriptions.

<Note> When you provide a custom `identifier` for a subscription, it must be **512 characters or fewer**. Requests with longer identifiers are rejected. </Note>