This is my normal, successful subscrition to apn or gcm channel
subcribeToPushNotification(deviceToken) {
const params = {
notification_channels: Platform.OS !== 'ios' ? 'apns' : 'gcm',
device: {
platform: Platform.OS,
udid: DeviceInfo.getUniqueId()
},
push_token: {
environment: __DEV__ ? 'development' : 'production',
client_identification_sequence: deviceToken
}
}
// JS SDK v2
/*ConnectyCube.pushnotifications.subscriptions.create(params)
.then(result => {console.log("RESULT: ", result)})
.catch(error => {console.log("ERROR: ", error)});*/
// JS SDK v1
ConnectyCube.pushnotifications.subscriptions.create(
params,
(error, result) => {
if (result)
console.log("RESULT APNS: ", result)
else
console.log("ERROR VOIP", error)
}
);
}
Now I need to use VOIP push notification, but when I try the following code:
subcribeToPushNotificationVoip(deviceToken) {
const params = {
notification_channels: Platform.OS === 'ios' ? 'apnsvoip' : 'gcm',
device: {
platform: Platform.OS,
udid: DeviceInfo.getUniqueId()
},
push_token: {
environment: __DEV__ ? 'development' : 'production',
client_identification_sequence: deviceToken
}
}
// JS SDK v2
/*ConnectyCube.pushnotifications.subscriptions.create(params)
.then(result => {console.log("RESULT: ", result)})
.catch(error => {console.log("ERROR: ", error)});*/
// JS SDK v1
ConnectyCube.pushnotifications.subscriptions.create(
params,
(error, result) => {
if (result)
console.log("RESULT APNS: ", result)
else
console.log("ERROR VOIP LAST: ", error)
}
);
}
console.log
gives me this error :
ERROR VOIP LAST: {"code": 422, "detail": ["Invalid notification channel specified"], "message": {"errors": ["Invalid notification channel specified"]}, "status": "error"}
voip token example: 4dd23c212d2a8865c4747ee278de0947d0de80445400f8f85cdb5a6f3923cb74
I am using the Universal (Sandbox & Production & VoIP) SSL certificate
For VoIP it should be
notification_channel: "apns_voip"
For VoIP pushes it requires to generate a separated push token when subscribe a user, please see how to get it https://github.com/react-native-webrtc/react-native-voip-push-notification#usage
Then when token is retrieved, you need to subscribe to voip pushes by passing a ‘apns_voip’ channel in a subscription request
Them when you want to send a voip push notification, also use ‘apns_voip’ channel when create an event