Closed HarshaHegde1994 closed 6 years ago
Can you show me the code of your providers and notification?
code for the provider
const notifme = new NotifmeSdk({
channels: {
push: config.push,
sms: {
"providers":[{
"type": config.sms.providers.type,
"id": config.sms.providers.id,
send: async (request) => {
return await sendSMS(request,config)
}
}]
}
},
useNotificationCatcher: config.isNotificationCatcher // <= this sends all your notifications to the catcher running on port 1025
});
code for notification
notifmeSdk.send({push: {registrationToken: notificationObj.registrationToken,
title: notificationObj.notificationMessage.title,
body: notificationObj.notificationMessage.body,
icon: notificationObj.notificationMessage.icon
}},
{sms: {
to: notificationObj.smsTo,
text: notificationObj.smsBody,
}}
)
Not sure where i went wrong.
send
takes only one parameter containing all the channels:
notifmeSdk.send({
push: {
registrationToken: notificationObj.registrationToken,
title: notificationObj.notificationMessage.title,
body: notificationObj.notificationMessage.body,
icon: notificationObj.notificationMessage.icon
},
sms: {
to: notificationObj.smsTo,
text: notificationObj.smsBody,
}
)
But the documentation says like this.
notifmeSdk.send({
email: {
from: 'me@example.com',
to: 'john@example.com',
subject: 'Hi John',
html: '<b>Hello John! How are you?</b>'
},
sms: {
from: '+15000000000',
to: '+15000000001',
text: 'Hello John! How are you?'
},
push: {
registrationToken: 'xxxxx',
title: 'Hi John',
body: 'Hello John! How are you?',
icon: 'https://notifme.github.io/notifme-sdk/img/icon.png'
},
webpush: {
subscription: {
keys: {
auth: 'xxxxx',
p256dh: 'xxxxx'
},
endpoint: 'xxxxx'
},
title: 'Hi John',
body: 'Hello John! How are you?',
icon: 'https://notifme.github.io/notifme-sdk/img/icon.png'
}
})
I'm confused when you say 'one parameter containing all the channels'. How does that differ?
// Your code:
notifmeSdk.send({push: ...}, {sms: ...})
// What you should have:
notifmeSdk.send({push: ..., sms: ...})
Oh!! sorry. Thanks for the reply....
Hi, I was trying to send a mult-ichannel notification. 1st channel is sending the notification, however, rest of the channels are not sending any notifications.