N
Novu8mo ago
MINIMINI

Sending SMS via TOPIC

Hello. I sent an SMS to the Twilo service via a topic with a few people in it. But only one of them can receive the message. I think it only goes to the first person in the array, but how can I send a message to all subscribers included in the topic at the same time?? PS. I used Workflows on site
5 Replies
Ask Inkeep
Ask Inkeep8mo ago
Hi @MINIMINI, I'm an AI assistant for Novu. I'll analyze available sources and get back to your shortly. ----------------------------- While I generate an answer, here are some sources that might be helpful: * Topics * .NET * Twilio * SMS Channel Overview ----------------------------- Answer When sending an SMS through Novu using a topic, it should indeed distribute the message to all subscribers added to that topic, not just the first one in the array. To ensure you're setting up and using topics correctly with Novu and your Twilio service, here are some steps to follow based on the documentation: 1. Create a Topic: First, ensure you have created a topic correctly. When creating a topic, you use a unique identifier for that topic. Here's how you can create a topic:
import { Novu } from '@novu/node';
const novu = new Novu("<NOVU_API_KEY>");
const result = await novu.topics.create({
key: 'unique-topic-identifier',
name: 'descriptive-topic-name',
});
import { Novu } from '@novu/node';
const novu = new Novu("<NOVU_API_KEY>");
const result = await novu.topics.create({
key: 'unique-topic-identifier',
name: 'descriptive-topic-name',
});
(1) 2. Add Subscribers to the Topic: Ensure that you have correctly added subscribers to your topic. You can add multiple subscribers to a topic using their subscriber IDs. Here's an example:
import { Novu } from '@novu/node';
const novu = new Novu("<NOVU_API_KEY>");
const topicKey = 'unique-topic-identifier';
const response = await novu.topics.addSubscribers(topicKey, {
subscribers: ['subscriber-id-1', 'subscriber-id-2', ...],
});
import { Novu } from '@novu/node';
const novu = new Novu("<NOVU_API_KEY>");
const topicKey = 'unique-topic-identifier';
const response = await novu.topics.addSubscribers(topicKey, {
subscribers: ['subscriber-id-1', 'subscriber-id-2', ...],
});
3. Trigger Workflow to a Topic: Finally, when triggering a workflow to a topic, you specify the topic key in the to field, which should distribute the message to all subscribers within that topic.
await novu.trigger('<WORKFLOW_TRIGGER_IDENTIFIER>', {
to: [{ type: 'Topic', topicKey: 'unique-topic-identifier' }],
payload: {},
});
await novu.trigger('<WORKFLOW_TRIGGER_IDENTIFIER>', {
to: [{ type: 'Topic', topicKey: 'unique-topic-identifier' }],
payload: {},
});
Ask Inkeep
Ask Inkeep8mo ago
If you've followed these steps, all subscribers in the topic should receive the SMS message. If only one subscriber is receiving the message despite this setup, it might be necessary to review the topic configuration and the subscriber list added to that topic to ensure everything is set correctly. Additionally, ensure that there are no specific limitations or issues on the Twilio side that might affect the delivery to multiple recipients.
Sources [1] Topics
Ask Inkeep
Ask Inkeep8mo ago
Got it. Tagging @Support for additional help.
Pawan Jain
Pawan Jain8mo ago
@MINIMINI All subscribers have phone number field set? Could you please share the screenshot on how you are triggering workflow to topic?
Ask Inkeep
Ask Inkeep8mo ago
Glad I could be helpful. Feel free to create a new thread with any new questions you may have.
Want results from more Discord servers?
Add your server