N
Novuβ€’11mo ago
Pawan Jain

issue in trigger and subscriber create with .net sdk

52 Replies
Saruchi
Saruchiβ€’11mo ago
HI Is anyone having this issue or I am doing something wrong?
Pawan Jain
Pawan Jainβ€’11mo ago
Can you please share this error WaitigForActivation screenshot?
Prosper
Prosperβ€’11mo ago
@dr.really tagging you here just in case. Also please can you provide the version of the SDK you are using? @bsantosh909
Santosh Bhandari
Santosh Bhandariβ€’11mo ago
πŸ‘€
Pawan Jain
Pawan Jainβ€’11mo ago
Wrong person mentioned πŸ˜… @sarucchi.
Prosper
Prosperβ€’11mo ago
Sorry πŸ˜…
Saruchi
Saruchiβ€’11mo ago
this is not an error But i am not able to send the email or create a subscriber The .net quick start document doesnt seem to work so checking here
No description
Saruchi
Saruchiβ€’11mo ago
No description
Saruchi
Saruchiβ€’11mo ago
var novuConfiguration = new NovuClientConfiguration { Url = "", //self hosted ApiKey = "", }; var novu = new NovuClient(novuConfiguration); // Create subscriber var newSubscriberDto = new SubscriberCreateData { SubscriberId = "9", FirstName = "", LastName = "", Email = "", Data = new List<AdditionalData> { new AdditionalData { Key = "External ID", Value = "1122334455" }, new AdditionalData { Key = "Job Title", Value = "Software Engineer" } } }; var subscriber = novu.Subscriber.Create(newSubscriberDto); var onboardingMessage = new OnboardEventPayload { Username = "SA", WelcomeMessage = "Welcome to novu-dotnet" }; var payload = new Novu.DTO.Events.EventCreateData() { EventName = "onboarding", //have a trigger named "onboarding" in self hosted Novu To = { SubscriberId = "9" }, Payload = onboardingMessage }; var trigger = novu.Event.Trigger(payload); if (trigger.IsCompleted) // changed from - trigger.TriggerResponsePayloadDto.Acknowledged (in documentation) { Console.WriteLine("Trigger has been created."); } @unicodeveloper I am using 0.3.2 @unicodeveloper @Pawan Jain : please let me know if you need any other information @Pawan Jain @unicodeveloper anything on this ? πŸ™‚
Prosper
Prosperβ€’11mo ago
@sarucchi. please i need you to do me a favour, can you try creating a subscriber via the API, maybe through postman or an alternative, i need to be sure if it's an sdk issue or not. it;s a pretty new type of issue
dr.really
dr.reallyβ€’11mo ago
try
var subscriber = await novu.Subscriber.Create(newSub);
var subscriber = await novu.Subscriber.Create(newSub);
Saruchi
Saruchiβ€’11mo ago
@dr.really Thanks for your response I have tried with both using await and dropping await but no subscriber is created Can you please confirm what URL should i provide in NovuClientConfiguration { Url = "", //self hosted } any working example would be much appreciated
dr.really
dr.reallyβ€’11mo ago
Are you using the hosted version of Novu?
Saruchi
Saruchiβ€’11mo ago
self hosted version of Novu have tried with API_Root_Url as well something like http://35.154.137.80:3000 but doesnt seem to work **here 35.154.137.80 is example EC2 VM IP which will be different for different VM
dr.really
dr.reallyβ€’11mo ago
assuming the http:35.154.137.80:3000 is the address the api is running at, you would put http://35.154.137.80:3000/v1 as the Url value
Saruchi
Saruchiβ€’11mo ago
Yet it did not create any subscriber in my self hosted Novu with this code:- public void CreateNotification(OnboardEventPayload requestPayload) { var novuConfiguration = new NovuClientConfiguration { Url = Secrets.Notification_Url, ApiKey = Secrets.Notification_Api_Key }; var novu = new NovuClient(novuConfiguration); // Create subscriber var newSubscriberDto = new SubscriberCreateData { SubscriberId = "9", //replace with system_internal_user_id FirstName = "xx", LastName = "x", Email = "xxx" }; var subscriber = novu.Subscriber.Create(newSubscriberDto); @dr.really I have tried following:- 1. Subscriber.Create with with await - result no subscriber created 2. URL - domain/api/v1 (like https://imaginary.something.something/api/v1) 3. providing URL - http://35.154.137.80:3000/v1
dr.really
dr.reallyβ€’11mo ago
When you go to ~/v1/health-check what do you see?
Saruchi
Saruchiβ€’11mo ago
{"status":"error","info":{"db":{"status":"up"},"apiVersion":{"version":"0.17.1","status":"up"},"triggerQueue":{"status":"up"}},"error":{"inMemory":{"status":"down"}},"details":{"db":{"status":"up"},"apiVersion":{"version":"0.17.1","status":"up"},"triggerQueue":{"status":"up"},"inMemory":{"status":"down"}}}
Novu_Bot
Novu_Botβ€’11mo ago
@saruchi_13291_71869, you just advanced to level 4!
dr.really
dr.reallyβ€’11mo ago
Looks like your API is erroring, your inMemory is down
Prosper
Prosperβ€’11mo ago
@dr.really the config you did that day for inMemory, can you repeat here just so we are sure he configured it the right way?
dr.really
dr.reallyβ€’11mo ago
yessir, one moment
I had to set the IN_MEMORY_CLUSTER_MODE_ENABLED to false, but then also set REDIS_CACHE_SERVICE_HOST and REDIS_CACHE_SERVICE_PORT to the same values as REDIS_HOST and REDIS_PORT
these are environment variables
Prosper
Prosperβ€’11mo ago
thanks @dr.really . @saruchi_13291_71869 please try those
Saruchi
Saruchiβ€’11mo ago
ok,thanks let me try @dr.really @unicodeveloper One more question.. Can i hit the Novu end points through Swagger? I get 401 -unauthorized Where can i set the authorization in ~/api
Prosper
Prosperβ€’11mo ago
We recommend you just that as a guide on what request body to send. You have to use postman or an alternative to try it. We are launching something tomorrow or next to allow you try it directly from the docs
Saruchi
Saruchiβ€’11mo ago
@unicodeveloper I am using Postman with URL 1. ~/api/v1/subscribers 2. with same body params as in ~/api { "subscriberId": "123", "email": "xx@xx.com", "firstName": "string", "lastName": "string", "phone": "string", "avatar": "string", "locale": "string", "data": {} } 3. Authorization as APIKey key: APIKey -Use this API key to interact with the Novu API value: Application Identifier A public key identifier that can be exposed to the client applications but getting 401
Prosper
Prosperβ€’11mo ago
Where did you get your API key from?
Saruchi
Saruchiβ€’11mo ago
self hosted Novu's - Settings
Prosper
Prosperβ€’11mo ago
I think you are using application identifier instead of api key
Prosper
Prosperβ€’11mo ago
the value should be the api key
No description
Saruchi
Saruchiβ€’11mo ago
No description
Saruchi
Saruchiβ€’11mo ago
I am sending VALUE as API key and Application Identifier in KEY (tried sending nothing at all in KEY) but 401
Prosper
Prosperβ€’11mo ago
Application identifier should never be used here, you only use that on the frontend Key: ApiKey Value: xxxxxxxxxxxxxxxxxxxxxxxxx where xxxxxx is your actual api key or forget about the authorization and just put this in your headers. this works better: header: Authorization value: ApiKey xxxxxxxxxxxxxxxxxx
Saruchi
Saruchiβ€’11mo ago
I still see 401 in postman with above 😦
Prosper
Prosperβ€’11mo ago
let's enter dms. one of the keys must still be wrong
Saruchi
Saruchiβ€’11mo ago
dms? how?
Prosper
Prosperβ€’11mo ago
i sent you a private message
Saruchi
Saruchiβ€’11mo ago
@dr.really {"data":{"status":"ok","info":{"db":{"status":"up"},"inMemory":{"status":"up"},"apiVersion":{"version":"0.17.1","status":"up"},"triggerQueue":{"status":"up"}},"error":{},"details":{"db":{"status":"up"},"inMemory":{"status":"up"},"apiVersion":{"version":"0.17.1","status":"up"},"triggerQueue":{"status":"up"}}}} made the changes and in memory status is up Get Subscribers is working ,thanks to @unicodeveloper
but Post throws these errors: {"statusCode":400,"message":["subscriberId should not be null or undefined","subscriberId must be a string"],"error":"Bad Request"}
dr.really
dr.reallyβ€’11mo ago
are you providing a subscriber id?
Novu_Bot
Novu_Botβ€’11mo ago
@dr.really, you just advanced to level 10!
Saruchi
Saruchiβ€’11mo ago
yes and email tried in string and alphanumeric
dr.really
dr.reallyβ€’11mo ago
Show me your post example
Saruchi
Saruchiβ€’11mo ago
No description
Saruchi
Saruchiβ€’11mo ago
added Authorization in Headers .. Authorization Type: NoAuth works well with GET
dr.really
dr.reallyβ€’11mo ago
you're using a form body, isn't this just a normal post body? switch to raw and select json and then put something like:
{
"subscriberId": "abc123",
"email": "hello@example.com"
}
{
"subscriberId": "abc123",
"email": "hello@example.com"
}
Saruchi
Saruchiβ€’11mo ago
Its working !!!!! Added a subscriber I tried with sending Raw text ..selected json now and it works!!! Thank you!
dr.really
dr.reallyβ€’11mo ago
anytime!
Saruchi
Saruchiβ€’11mo ago
Now that Postman request is working πŸ™‚ Something is wrong with my .net code as well because I am not able to create a subscriber through code var subscriber = novuClient.Subscriber.Create(SubscriberCreateData) Do you follow the .Net quickstart tutorial? because I see some class names have changed so asking
No description
Saruchi
Saruchiβ€’11mo ago
have tried with both using await and not using await
dr.really
dr.reallyβ€’11mo ago
So the status WaitingForActivation, when you run it with await what does it give you?
Saruchi
Saruchiβ€’11mo ago
when i run it with await,i dont get to know what happens after this line var subscriber = await novu.Subscriber.Create(newSubscriberDto); it comes out of the debug and I get my Swagger End point screen from which I am calling this code @dr.really @unicodeveloper i am able o create a subscriber and send email to the subscriber from .net as well now with await I changed my ApiKey and removed the prefix ApiKey which I was using for postman Thanks πŸ™‚
Prosper
Prosperβ€’11mo ago
I'm glad this finally worked!!! Yaaaaaaay!!!
Want results from more Discord servers?
Add your server
More Posts