#Having a Bad Request when trying to add subscribers to a topic

1 messages · Page 1 of 1 (latest)

olive sinew
#
async function addSubscriberToTopic(apiKey) {
    const novu = new Novu(apiKey);

    const topicKey = await askQuestion('Enter the topic key: ');
    const subscriberIds = await askQuestion('Enter the subscriber IDs (comma-separated): ');
    const subscriberIdArray = subscriberIds.split(',');

    try {
        // Add the subscribers to the topic
        await novu.topics.addSubscribers(topicKey, subscriberIdArray);
        console.log('Subscribers added to the topic successfully!');
    } catch (error) {
        console.error('Failed to add subscribers to the topic:', error);
    }
}```
obtuse pine
#
);```
#

Try this

#

@olive sinew