N
Novu•3w ago
Pallab

Expo device token in the trigger payload

I have a use case where one subscriber may have two different expo tokens intended for two different apps. In order to ensure that the right notification reaches the intended app, instead of setting the expo token in the user credentials, I am sending the token in the trigger payload based on the type of notification to be sent. However, I have observed that every time I invoke the trigger API with the expo token in the payload, it also saves it against the subscriber id. To work around this, I also invoke the API to clear the credentials. However, I noticed that the step fails often with the error Subscriber credentials is missing the tokens for sending a push notification message Am I doing this right or is there a better way to handle this? Novu: Self-hosted, v2.1.0
4 Replies
Pawan Jain
Pawan Jain•3w ago
@Pallab Can you please share the request payload?
Pallab
PallabOP•3w ago
Here's how the payload is sent.
curl -X POST 'https://dev-novu.monaire.ai/v1/events/trigger' \
-H 'Authorization: ApiKey NOVU_SECRET_KEY' \
-H 'Content-Type: application/json' \
-d '{
"name": "status-update",
"to": {
"channels": [
{
"credentials": {
"deviceTokens": [
"ExponentPushToken[uFuSFKPqguHM9xr2f99gew]",
"ExponentPushToken[zMHkuZGMMlVxbPAokaLsTm]",
"ExponentPushToken[w-k4tELm_h1UfgXtVXvi_u]"
]
},
"providerId": "expo"
}
],
"subscriberId": "289516895101526569"
},
"payload": {
"field1": "data1",
"field2": "data2",
"field3": "data3"
}
}'
curl -X POST 'https://dev-novu.monaire.ai/v1/events/trigger' \
-H 'Authorization: ApiKey NOVU_SECRET_KEY' \
-H 'Content-Type: application/json' \
-d '{
"name": "status-update",
"to": {
"channels": [
{
"credentials": {
"deviceTokens": [
"ExponentPushToken[uFuSFKPqguHM9xr2f99gew]",
"ExponentPushToken[zMHkuZGMMlVxbPAokaLsTm]",
"ExponentPushToken[w-k4tELm_h1UfgXtVXvi_u]"
]
},
"providerId": "expo"
}
],
"subscriberId": "289516895101526569"
},
"payload": {
"field1": "data1",
"field2": "data2",
"field3": "data3"
}
}'
In the step execution, I get to see this.
{
"_integrationId": "66c5ffdfc3a9a7a51cdacc94",
"providerId": "expo",
"credentials": {
"webhookUrl": "",
"deviceTokens": []
}
}
{
"_integrationId": "66c5ffdfc3a9a7a51cdacc94",
"providerId": "expo",
"credentials": {
"webhookUrl": "",
"deviceTokens": []
}
}
Pawan Jain
Pawan Jain•2w ago
@Pallab
However, I have observed that every time I invoke the trigger API with the expo token in the payload, it also saves it against the subscriber id.
yes, it is the intended behaviour, subscriber data is upserted
To work around this, I also invoke the API to clear the credentials.
Why you are removing those tokens? Novu requires token to send push notifications to @Pallab Do you need more help in this?
Pallab
PallabOP•7d ago
I changed the design to create separate subscribers for the intended action. We are good for now. Appreciate the response! 🙏

Did you find this page helpful?