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
No, It should send email without payload also
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": {}
}
@Ujwal, you just advanced to level 2!
please check if email exist with this subscriber
https://docs.novu.co/api/get-subscriber/
I just checked and it doesn't have. How do I associate email to a subscriber?
Are you using novu.subscribers.identify to create a subscriber?
https://docs.novu.co/platform/subscribers#creating-a-subscriber
I guess he is directly using api
Yes, I'm using API to create a subscriber
It should not happen, I frequently create subscriber using api, It works fine for me
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
This should work
https://docs.novu.co/api/create-subscriber/
@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"
}
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?
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
subscriberId: "subscriberId"
and this is what we give in the create subscriber request payload right?
yes
what happens if we use the same subscriber id to create a subscriber?
it will just update the old values I guess
so it is our responsibility to use a unique subscriber id?
Yes, always use unique subscriber ID, preferably your user_id
so that you do not have look up twice for fetching this information
got it, thanks for your help Pawan!