Skip to main content

Topics

Topics are subscriber groups that enable fan-out delivery when used with Workflows. You can manage topics through the Dashboard or the API.

Overview

Topics provide a pub/sub model for grouping subscribers. When a workflow is triggered targeting a topic, every subscriber in that topic receives their own workflow execution.

Creating Topics

Via Dashboard

  1. Navigate to Topics in the sidebar
  2. Click Create Topic
  3. Enter a topic name (e.g., "Product Updates")
  4. The key is auto-generated from the name (e.g., product-updates)
  5. Optionally add a description
  6. Click Create

Via API

curl -X POST https://api.zyphr.dev/v1/topics \
-H "X-API-Key: zy_live_your_key" \
-H "Content-Type: application/json" \
-d '{
"name": "Product Updates",
"key": "product-updates"
}'
const topic = await zyphr.topics.create({
name: 'Product Updates',
key: 'product-updates',
});

Subscribing Users to Topics

Via Dashboard

  1. Navigate to Topics and click on a topic
  2. View the list of current subscribers
  3. Use the Add Subscriber button to subscribe users

Via API

curl -X POST https://api.zyphr.dev/v1/topics/product-updates/subscribers \
-H "X-API-Key: zy_live_your_key" \
-H "Content-Type: application/json" \
-d '{ "subscriber_ids": ["user_123", "user_456"] }'
await zyphr.topics.subscribe('product-updates', {
subscriberIds: ['user_123', 'user_456'],
});

Listing Topics

Via Dashboard

Navigate to Topics in the sidebar to see all topics with their subscriber counts.

Via API

curl https://api.zyphr.dev/v1/topics \
-H "X-API-Key: zy_live_your_key"

Viewing Topic Subscribers

Via Dashboard

Click on any topic to see a paginated list of all subscribed users.

Via API

curl "https://api.zyphr.dev/v1/topics/product-updates/subscribers?page=1&per_page=25" \
-H "X-API-Key: zy_live_your_key"

Unsubscribing Users

Via Dashboard

  1. Navigate to Topics and click on a topic
  2. Find the subscriber and click Remove

Via API

curl -X DELETE https://api.zyphr.dev/v1/topics/product-updates/subscribers \
-H "X-API-Key: zy_live_your_key" \
-H "Content-Type: application/json" \
-d '{ "subscriber_ids": ["user_123"] }'
await zyphr.topics.unsubscribe('product-updates', {
subscriberIds: ['user_123'],
});

Deleting Topics

Via Dashboard

  1. Navigate to Topics
  2. Click the menu on a topic and select Delete
  3. Confirm the deletion

Via API

curl -X DELETE https://api.zyphr.dev/v1/topics/product-updates \
-H "X-API-Key: zy_live_your_key"

Triggering Workflows by Topic

Send a notification to all subscribers of a topic through a workflow:

curl -X POST https://api.zyphr.dev/v1/workflows/product-update/trigger \
-H "X-API-Key: zy_live_your_key" \
-H "Content-Type: application/json" \
-d '{
"to": { "topic": "product-updates" },
"payload": { "featureName": "Workflows" }
}'
await zyphr.workflows.trigger('product-update', {
to: { topic: 'product-updates' },
payload: { featureName: 'Workflows' },
});

Use Cases

  • Product announcements — Notify all opted-in users of new features
  • Team channels — Group notifications by team or project
  • Category subscriptions — Let users subscribe to content categories
  • Regional alerts — Group by geography or timezone