N
Novu•9mo ago
maybeNoT

Triggering workflow to topic subscribers doesn't work.

I've got simple workflow defined send-mail which is just simply sending mails. I've tested it and I'm receiving mails when I'm triggering it to single subscriber, but it doesn't work when I try to trigger that to the topic. First I created the topic like so:
const createdTopic = await this.novu.topics.create({
key: 'some-key',
name: 'just name',
});
const createdTopic = await this.novu.topics.create({
key: 'some-key',
name: 'just name',
});
Then I added two subscribers like so:
const addedSubsToTopic = await this.novu.topics.addSubscribers('some-key', {
subscribers: ['6617e3701da082efc8ee2f92', '285u3298591y691'],
});
const addedSubsToTopic = await this.novu.topics.addSubscribers('some-key', {
subscribers: ['6617e3701da082efc8ee2f92', '285u3298591y691'],
});
And now I'm trying to trigger this worflow to the topic like this:
const { data } = await this.novu.trigger('send-mail', {
to: [{ type: TriggerRecipientsTypeEnum.TOPIC, topicKey: 'some-key' }],
payload: {},
});
const { data } = await this.novu.trigger('send-mail', {
to: [{ type: TriggerRecipientsTypeEnum.TOPIC, topicKey: 'some-key' }],
payload: {},
});
I'm getting back the transaction id in a response:
{
data: {
acknowledged: true,
status: 'processed',
transactionId: '5e99a3ba-5329-4e9e-8d37-cb77a7eb9b48'
}
}
{
data: {
acknowledged: true,
status: 'processed',
transactionId: '5e99a3ba-5329-4e9e-8d37-cb77a7eb9b48'
}
}
But no actual mail is delivered, and there's no such transaction id on my Activity Feed. I've got Novu self-hosted and deployed with docker. Any help appreaciated.
30 Replies
Ask Inkeep
Ask Inkeep•9mo ago
Hi @maybeNoT, I'm an AI assistant for Novu. While a team member reviews this question, I'll look through relevant sources and see if I can provide suggestions. Please tag @Ask Inkeep with any follow-up questions. ----------------------------- While I generate an answer, here are some sources that might be helpful: * Topics * Go * Workflows * Preferences ----------------------------- Answer Based on the description, it seems like you've followed the correct steps for creating a topic, adding subscribers to it, and triggering a workflow to the topic. If you're not seeing the expected emails being sent and the transaction not appearing in your Activity Feed, there could be several factors at play, including configuration issues or the way the workflow is set up. However, without direct access to error logs or more detailed system configurations, it's challenging to pinpoint the exact cause. Here are a few troubleshooting steps you can consider: 1. Check Workflow Configuration: Ensure your send-mail workflow is correctly configured to handle topic triggers. Workflows need to be set up in a way that supports the type of triggering you're attempting. 2. Review Topic and Subscriber Setup: Double-check if the topic and subscribers are set up correctly. Ensure the subscribers added to the topic are valid and capable of receiving emails. 3. Inspect Docker and Self-Hosted Setup: Since you're using a self-hosted Novu deployed with Docker, ensure your environment is correctly configured, especially regarding network settings and access to email sending services. 4. Consult Novu Documentation: For more detailed guidance and examples on triggering workflows, topics, and troubleshooting, refer to the Novu documentation. 5. System Logs: Check your system logs for any errors related to the failed trigger attempts. Errors or warnings in the logs can provide more insight into what might be going wrong. If after following these steps, you still encounter issues, it may be beneficial to review any recent changes or updates to your Novu setup or consult with your development team for further diagnostics.
maybeNoT
maybeNoTOP•9mo ago
1. How to configure workflow to handle topic triggers? 2. Where can I review the topic and subscribers? I can't see this option in interface.
Ask Inkeep
Ask Inkeep•9mo ago
Got it. Tagging @Support for additional help.
maybeNoT
maybeNoTOP•9mo ago
@Ask Inkeep
Ask Inkeep
Ask Inkeep•9mo ago
Hmm.. Seems like you didn't ask a question. Please try again.
maybeNoT
maybeNoTOP•9mo ago
@Ask Inkeep How to configure workflow to handle topic triggers? Where can I review the topic and subscribers? I can't see this option in interface.
Ask Inkeep
Ask Inkeep•9mo ago
Thanks for the follow-up, @maybeNoT. I'll get back to you soon. ----------------------------- While I generate an answer, here are some sources that might be helpful: * Topics * Get workflows * Glossary * PHP -----------------------------
Ask Inkeep
Ask Inkeep•9mo ago
Answer To configure a workflow to handle topic triggers, you need to ensure that your workflow is set up with the correct trigger identifier and is designed to process notifications for topics. This involves specifying the type as 'Topic' and the topicKey when triggering a notification to a topic, as shown in the example (1) :
await novu.trigger('<WORKFLOW_TRIGGER_IDENTIFIER>', {
to: [{ type: 'Topic', topicKey: 'your-topic-key' }],
payload: {},
});
await novu.trigger('<WORKFLOW_TRIGGER_IDENTIFIER>', {
to: [{ type: 'Topic', topicKey: 'your-topic-key' }],
payload: {},
});
Regarding reviewing topics and subscribers, the current Novu interface might not directly display this information. Managing topics and subscribers typically involves using the Novu API for creating, adding subscribers to, and triggering notifications to topics. For detailed operations like listing topics or subscribers, you would generally interact with the Novu API programmatically (1) (2) . For more details on these processes, including managing subscribers and topics through the API, please refer to the Novu documentation available online.
Ask Inkeep
Ask Inkeep•9mo ago
Got it. Tagging @Support for additional help.
Pawan Jain
Pawan Jain•9mo ago
@maybeNoT Do you see any error in logs for this?
maybeNoT
maybeNoTOP•9mo ago
No, I'm not getting any errors. Also I can see my topic is properly created and subscribers are added:
topics data --> {
data: {
_id: '661d19f0c0e62c5f4e959505',
_environmentId: '6617e3bd1da082efc8ee2fa2',
_organizationId: '6617e3bd1da082efc8ee2f9b',
key: 'some-key',
name: 'message to it dev',
subscribers: [ '6617e3701da082efc8ee2f92', '285u3298591y691' ]
}
}
topics data --> {
data: {
_id: '661d19f0c0e62c5f4e959505',
_environmentId: '6617e3bd1da082efc8ee2fa2',
_organizationId: '6617e3bd1da082efc8ee2f9b',
key: 'some-key',
name: 'message to it dev',
subscribers: [ '6617e3701da082efc8ee2f92', '285u3298591y691' ]
}
}
maybeNoT
maybeNoTOP•9mo ago
Workflow:
No description
maybeNoT
maybeNoTOP•9mo ago
@Pawan Jain @Support
Novu_Bot
Novu_Bot•9mo ago
@maybeNoT, you just advanced to level 2!
Pawan Jain
Pawan Jain•9mo ago
@maybeNoT I am a bit confused as you mentioned you see nothing in logs. Could you check with simple text content inplace of html or complex content in the email content editor step?
maybeNoT
maybeNoTOP•9mo ago
I triggered workflow like this with a single request now and with a simple text mail.
const { data: single } = await this.novu.trigger('send-mail2', {
to: { subscriberId: '6617e3701da082efc8ee2f92' },
payload: {
description: 'Test notification',
},
});
console.log('trigger single --> ', single);

const { data: batch } = await this.novu.trigger('send-mail2', {
to: [{ type: TriggerRecipientsTypeEnum.TOPIC, topicKey: 'it-dev' }],
payload: {
description: 'Test notification',
},
});
console.log('trigger batch --> ', batch);
const { data: single } = await this.novu.trigger('send-mail2', {
to: { subscriberId: '6617e3701da082efc8ee2f92' },
payload: {
description: 'Test notification',
},
});
console.log('trigger single --> ', single);

const { data: batch } = await this.novu.trigger('send-mail2', {
to: [{ type: TriggerRecipientsTypeEnum.TOPIC, topicKey: 'it-dev' }],
payload: {
description: 'Test notification',
},
});
console.log('trigger batch --> ', batch);
And this is the response that I get back:
trigger single --> {
data: {
acknowledged: true,
status: 'processed',
transactionId: '4ec9bb65-4897-4d21-a54d-41d96bd7bcbd'
}
}
trigger batch --> {
data: {
acknowledged: true,
status: 'processed',
transactionId: '7e303442-d19f-4d55-b477-252fb3c23726'
}
}
trigger single --> {
data: {
acknowledged: true,
status: 'processed',
transactionId: '4ec9bb65-4897-4d21-a54d-41d96bd7bcbd'
}
}
trigger batch --> {
data: {
acknowledged: true,
status: 'processed',
transactionId: '7e303442-d19f-4d55-b477-252fb3c23726'
}
}
For the single: - I received mail - I can find event by transaction ID in activity feed For the topic: - I did not receive an email - I can't find it in activity feed Just like no event was actually triggered. My request is going through. I think I'm getting proper response. I don't see any errors, or which logs you want me to check and where?
Pawan Jain
Pawan Jain•9mo ago
Could you join in google meet and share the screen? https://meet.google.com/pdf-rhqv-ibg
maybeNoT
maybeNoTOP•9mo ago
Yea I can. I got a message that I can't join.
Pawan Jain
Pawan Jain•9mo ago
try again now
maybeNoT
maybeNoTOP•9mo ago
Requesting.
Etigma
Etigma•9mo ago
Hello @Pawan Jain , I got the same problem ! While using topic is fonctionnal in my tests on web.novu.co. On my environment (as simple as @maybeNoT ) its not working. I'm using Java And/or Postman for my tests. In Java, i can see that when I request a topic with a topicKey, its working properly but TopicResponse has a topicId and topicKey null. (but a key and name not null) That's the case for both environments
Tomer Barnea
Tomer Barnea•9mo ago
@Etigma just to make sure I understand, on your enviorement, you mean you run the full enviorment, correct?
Etigma
Etigma•9mo ago
Yes
Tomer Barnea
Tomer Barnea•9mo ago
Thanks, @Pawan Jain please keep us updated👀
maybeNoT
maybeNoTOP•9mo ago
As we discussed yesterday, I'm trying to launch Novu locally. 1. I was able to install dependencies properly. The problem was that my pnpm version was too old and you require ^8.9.0 2. Now trying to run pnpm run start:web and I'm getting this error.
No description
maybeNoT
maybeNoTOP•9mo ago
I did run npx update-browserslist-db@latest as suggested. Then it threw an error and suggested to do pnpm up caniuse-lite I did that as well - and still this issue.
maybeNoT
maybeNoTOP•9mo ago
3. Trying to run pnpm run start:api:dev Also unable to start due to 562 errors, most of them:
TS2307: Cannot find module '@novu/shared' or its...
TS2339: Property 'X' does not exist on type 'Y'.
TS2307: Cannot find module '@novu/shared' or its...
TS2339: Property 'X' does not exist on type 'Y'.
No description
maybeNoT
maybeNoTOP•9mo ago
4. Trying to run pnpm run start:worker similar to this one above, but 196 errors
No description
maybeNoT
maybeNoTOP•9mo ago
pnpm install
No description
maybeNoT
maybeNoTOP•9mo ago
@Pawan Jain
Want results from more Discord servers?
Add your server