Create subscriber via API

I found this endpoint in API but didn't find how I can send fields for deviceTokens and PushProviderIdEnum.OneSignal. Can you help please? I know that it has in novu/node library but we prefer use only API
5 Replies
Novu_Bot
Novu_Bot8mo ago
@Sasha Trityak, you just advanced to level 1!
Ask Inkeep
Ask Inkeep8mo ago
Hi @Sasha Trityak, 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: * Onesignal * Push Webhook * Pusher Beams * Push Channel Introduction -----------------------------
Ask Inkeep
Ask Inkeep8mo ago
Answer To create a subscriber and set credentials for using OneSignal as the push notification provider via the Novu API, follow these steps: First, identify the subscriber:
await novu.subscribers.identify('SUBSCRIBER_ID', {
firstName: "Your Subscriber's Name"
});
await novu.subscribers.identify('SUBSCRIBER_ID', {
firstName: "Your Subscriber's Name"
});
Then, set the device token for OneSignal:
await novu.subscribers.setCredentials('SUBSCRIBER_ID', PushProviderIdEnum.OneSignal, {
deviceTokens: ['YOUR_ONESIGNAL_PLAYER_ID'],
});
await novu.subscribers.setCredentials('SUBSCRIBER_ID', PushProviderIdEnum.OneSignal, {
deviceTokens: ['YOUR_ONESIGNAL_PLAYER_ID'],
});
(1) Please replace 'SUBSCRIBER_ID' with your subscriber's identifier, 'YOUR_ONESIGNAL_PLAYER_ID' with the OneSignal player_id associated with your user's device. This process involves two main steps: registering the subscriber in your system with Novu and then associating the OneSignal device identifier with the subscriber.
Pawan Jain
Pawan Jain8mo ago
@Sasha Trityak Have a look at this api to update subscriber credentials
Pawan Jain
Pawan Jain8mo ago
Novu
Update subscriber credentials - Novu
Subscriber credentials associated to the delivery methods such as slack and push tokens.
Want results from more Discord servers?
Add your server