This is reply for another post that concerns this actual thread.
Ok, first thing, I found out that by adding “Included_segments”, the call doesn’t fail anymore.
{
"app_id": "appid",
"target_channel": "push",
"headings": {
"en": "{{header}}"
},
"contents": {
"en": "{{contents}}"
},
"included_segments": ["All"],
"includes_aliases": {
"external_id": {{emails}}
}
}
Secondly, OneSignal doesn’t allow you to setup external ID anymore from the client. You need to use the API to do so. But I found a workaround.
In the index.html file of the netlify app, replace the addAlias line:
//OneSignal.User.addAlias("external_id", externalID);
OneSignal.User.addAlias("user_id", externalID);
By doing this, you will still be able to interact with the View user API route from OneSignal by refering the alias label as user_id:
https://api.onesignal.com/apps/{app_id}/users/by/{alias_label}/{alias_id}
Replace {app_id} by the app id of OneSignal
Replace {alias_label} by "user_id"
Replace {alias_id} by the email.
And good news, It also works with includes_aliases! So you can replace the code for the call API with this one:
{
"app_id": "appid",
"target_channel": "push",
"headings": {
"en": "{{header}}"
},
"contents": {
"en": "{{contents}}"
},
"included_segments": ["All"],
"includes_aliases": {
"user_id": {{emails}} // <=== "external_id" replaced with "user_id"
}
}
It is now working perfectly fine for me!
Don’t hesitate to ping me if you need further help!