Open gfl-chris opened 6 years ago
Did you manage to make it work yet?
Here is my code
notificationReq := &onesignal.NotificationRequest{ AppID: appID, Contents: map[string]string{"en": "English message"}, IsAndroid: true, Tags: map[string]string{ "role": "merchant", }, }
And the error
2018/12/18 00:18:31 OneSignal returned those error messages:
- Tags must be an array. For example, [{"key":"gender","relation":"=","value":"male"}] exit status 1
@gfl-chris notification by template works fine for me. @UpToEleven1102 you need to format tags properly (map inside slice of interfaces), here is sample of tags formatting:
onesignal.NotificationRequest{
TemplateID: "TemplateID",
Tags: []interface{}{
map[string]interface{}{
"key": "gender", "relation": "=", "value": "male",
},
},
AppID: appID,
IncludePlayerIDs: IncludePlayerIDs,
//Contents: map[string]string{"en": "hello"},
}
I can't find a reference to
NotificationRequest
'sTags
field (JSON:tags
) in the Onesignal documentation and support tells me that tag values can't be set when creating a notification (when sending a templated notification). What was/is the intended behaviour? Has this been working for anyone else?