Receiving following error message from Firebase Cloud functions log for my Firebase Function. I am trying to create a remote push notification payload with localization which has dynamic values.
Error: Messaging payload contains an invalid value for the "notification.loc-args" property. Values must be strings.
TypeScript code for payload
var values : String[] = [];
values.push('Johnny Appleseed');
const payload = {
notification: {
'title-loc-key': 'INVITE_PUSH_TITLE',
'loc-key': 'INVITE_PUSH_BODY',
'loc-args': values,
'type': 'Invite',
'fromName': name,
'userId': uid,
}
};
'loc-args' property already contains string array. What is wrong here?
Following sample shows how it suppose to be, based on Apple documentation
Localization Parameter for iOS
"GAME_PLAY_REQUEST_FORMAT" = "%@ and %@ have invited you to play Monopoly";
Payload
{
"aps" : {
"alert" : {
"loc-key" : "GAME_PLAY_REQUEST_FORMAT",
"loc-args" : [ "Jenna", "Frank"]
}
}
}