Sign In Register

How can we help you today?

Start a new topic

sendMessage, sendMessageEx and message

Could someone give me a starting point on how to work with Spark.sendMessage, Spark.sendMessageEx and Spark.message?

The documentation is very unclear on this. Especially since most of these methods are deprecated, but still referred to in samples.

I want to send a simple message to a user similar to a CreateChallengeResponse. The reason is that the challenge is created in Cloud Code, so the user on behalf of whom the challenge is created doesn't get a CreateChallengeResponse. So I want to send a custom message instead.

Any insight is appreciated!



Ok thanks, that makes it clear.

One follow up question though. If I create a custom script message, how can I replace variables in the message template?

E.g. if I have this as the message: You just earned ${achievementName}. How do I dynamically replace the ${achievementName}



Hi Jeffry,

The correct way to send a custom message is using Spark.message. If you have configures a custom message through the Configurator, you can specify the shortCode here to send it:

var message = Spark.message("myMessage");



You can also set the message's content before sending (for example, if you haven't setup a custom message) using:


If you have any further questions on this please let us know.



1 person likes this
Login to post a comment