N
Novu9mo ago
MFM Tech

Data have no value when Get Message using Email Channel

Hello, i try to get message from email channel but the data contain no value, and the behavior when debugging and running without debug return different respons, i check the total count after get the message but when i running without debug its getting error, i think its step inside the condition, is there any solution ? Im using .Net core 8
4 Replies
Ask Inkeep
Ask Inkeep9mo ago
Hi @MFM Tech, 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: * How to use Novu to send notifications to a channel in a Discord server * Recipes * Run Novu in local machine * Go ----------------------------- Answer It sounds like you're experiencing an issue retrieving messages from the email channel in Novu, where the data appears empty and you're encountering different behavior between debugging and production runs. While specific .NET Core examples are not provided in the provided information sources, you can utilize the general approach to fetching messages from a specific channel, as shown in the Novu documentation. To fetch all messages sent via a specific channel, such as email, you can apply filters in your API call. Here is a generalized example in Node.js, which you might adapt to .NET Core 8:
import { Novu, ChannelTypeEnum } from '@novu/node';

const novu = new Novu('<NOVU_API_KEY>');

const listMessagesOptions = {
page: 0, // optional
limit: 20, // optional
channel: ChannelTypeEnum.EMAIL, // only email type messages will be fetched
subscriberId: 'yourSubscriberId', // optional
transactionIds: ['transactionId1', 'transactionId2'], // optional
};

const { data: messagesData } = await novu.messages.list(listMessagesOptions);
import { Novu, ChannelTypeEnum } from '@novu/node';

const novu = new Novu('<NOVU_API_KEY>');

const listMessagesOptions = {
page: 0, // optional
limit: 20, // optional
channel: ChannelTypeEnum.EMAIL, // only email type messages will be fetched
subscriberId: 'yourSubscriberId', // optional
transactionIds: ['transactionId1', 'transactionId2'], // optional
};

const { data: messagesData } = await novu.messages.list(listMessagesOptions);
Ask Inkeep
Ask Inkeep9mo ago
(1) To adapt this to .NET Core, you would use the Novu API client suitable for .NET, applying similar parameters for filtering by the email channel. Ensure you properly configure your API client with the correct Novu API key and base URL. If you're seeing different behaviors between debugging and running your application normally, double-check your environment variables and configurations to ensure they are consistent across environments. Also, ensure that your debugging environment correctly simulates the production API calls and responses. Unfortunately, without more specific details or error messages, this general guidance is the best direction I can provide. If your issue persists or you have more specific details, it might be beneficial to consult Novu's official documentation or reach out to their support for more tailored assistance related to your .NET Core implementation.
Ask Inkeep
Ask Inkeep9mo ago
Got it. Tagging @Support for additional help.
Pawan Jain
Pawan Jain9mo ago
@MFM Tech I am having a bit difficulty in understanding your question Are you using get messages api with email channel filter, but not able to get any response
Want results from more Discord servers?
Add your server