Trigger not working when email is not specified in the payload

I created a subscriber by mentioning email in the payload. When call trigger API with the subscriber ID, I would expect it to send email to the email address associated with the subscriber. However, I don't see that happening. I only receive email when I mention the email property in the payload for the Trigger API. Am I doing anything wrong?
22 Replies
Pawan Jain
Pawan Jain2y ago
No, It should send email without payload also
ujwal1373
ujwal1373OP2y ago
This is the payload I'm using to create the subscriber: { "subscriberId": "abc", "email": "[email protected]", "firstName": "John", "lastName": "Doe" } And this is the payload for the trigger API: { "name" : "templateName", "to": { "subscriberId": "abc" }, "payload": {} }
Novu_Bot
Novu_Bot2y ago
@Ujwal, you just advanced to level 2!
Pawan Jain
Pawan Jain2y ago
please check if email exist with this subscriber https://docs.novu.co/api/get-subscriber/
ujwal1373
ujwal1373OP2y ago
I just checked and it doesn't have. How do I associate email to a subscriber?
Gali Baum
Gali Baum2y ago
Are you using novu.subscribers.identify to create a subscriber? https://docs.novu.co/platform/subscribers#creating-a-subscriber
Pawan Jain
Pawan Jain2y ago
I guess he is directly using api
ujwal1373
ujwal1373OP2y ago
Yes, I'm using API to create a subscriber
Pawan Jain
Pawan Jain2y ago
It should not happen, I frequently create subscriber using api, It works fine for me
ujwal1373
ujwal1373OP2y ago
The response payload to the POST /v1/subscribers contains email, but when I do a GET I don't see email in the response @Pawan Jain what is the required payload for creating a subscriber with email
ujwal1373
ujwal1373OP2y ago
@Pawan Jain I was referring to the same documentation and this is the payload I have been using to create the subscriber { "subscriberId": "abc", "email": "[email protected]", "firstName": "John", "lastName": "Doe" }
Pawan Jain
Pawan Jain2y ago
Wait, in a meeting we can debug together on screen session what happening wrong When you hit this API, after successful, you see email in response?
ujwal1373
ujwal1373OP2y ago
yes I see it in the response.. but when I do a GET using this subscriber ID, I don't see the email ok so from the create subscriber response, what is the subscriber id that should be used in the trigger - id or subscriberId { _id: "_id", firstName: "firstName", lastName: "lastName", email: "email", phone: "phone", avatar: "avatar", locale: "locale", subscriberId: "subscriberId", channels: ["channels"], isOnline: true, lastOnlineAt: "lastOnlineAt", _organizationId: "_organizationId", _environmentId: "_environmentId", deleted: true, createdAt: "createdAt", updatedAt: "updatedAt", __v: 0 } I was using the id
Pawan Jain
Pawan Jain2y ago
subscriberId: "subscriberId"
ujwal1373
ujwal1373OP2y ago
and this is what we give in the create subscriber request payload right?
Pawan Jain
Pawan Jain2y ago
yes
ujwal1373
ujwal1373OP2y ago
what happens if we use the same subscriber id to create a subscriber?
Pawan Jain
Pawan Jain2y ago
it will just update the old values I guess
ujwal1373
ujwal1373OP2y ago
so it is our responsibility to use a unique subscriber id?
Pawan Jain
Pawan Jain2y ago
Yes, always use unique subscriber ID, preferably your user_id so that you do not have look up twice for fetching this information
ujwal1373
ujwal1373OP2y ago
got it, thanks for your help Pawan!
Want results from more Discord servers?
Add your server