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
- Navigate to Topics in the sidebar
- Click Create Topic
- Enter a topic name (e.g., "Product Updates")
- The key is auto-generated from the name (e.g.,
product-updates) - Optionally add a description
- 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
- Navigate to Topics and click on a topic
- View the list of current subscribers
- 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
- Navigate to Topics and click on a topic
- 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
- Navigate to Topics
- Click the menu on a topic and select Delete
- 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