Sign In Register

How can we help you today?

Start a new topic
Answered

push notifications with "title", "Subtitle" and "summary" Dynamic

Hi,

I'm using Spark.sendMessage ({"alert": "A new game has Begun"}, sparkPlayers);


How I can send a message with "title", "Subtitle" and "summary" Dynamic?


Regards


Best Answer

I had to add "$" -> ${data.xxx}, but it works well.

Thank you very much.


1-First you have to create a custom message. Go to "Messages->ScriptMessage Extension tab" create a new message with a specific code like "NEW_GAME_ALERT" (it doesn't have to be upppercase, I like to have uppercase codes). 
2-Fill out the input texts (message, title subtitle) as desired.
3-Use {data.xxx} for variables in your text where xxx is any property from the object used in the Spark.sendMessageExt()

Ex:
Short Code:NEW_GAME_ALERT, Message: "A new game will begin in {data.days} days."
In your cloud code:
Spark.sendMessageExt({"days":6}, "NEW_GAME_ALERT", sparkPlayers);
Result: "A new game will begin in 6 days."
Answer

I had to add "$" -> ${data.xxx}, but it works well.

Thank you very much.