Skip to main content
Version: .NET MAUI SDK

Start a message programmatically

How to start a message programmatically?โ€‹

In most cases, you should let the Screeb targeting engine start the message. But sometimes, you may want to run a message on user action.

tip

You can find the MESSAGE_ID in the Manual section of the message editor. You can also find it in the message editor URL, after the /messages/ part.

using Screeb.Maui;

await Screeb.StartMessage("<message-id>");

You will find message id in Screeb platform.

Prevent multiple displays?โ€‹

If current user already saw your message and you would rather not display it many times, please add the allowMultipleResponses argument:

using Screeb.Maui;

await Screeb.StartMessage("<message-id>", allowMultipleResponses: false);

Respect message status?โ€‹

By default, using manual message start will ignore the message status. If you want to respect the message status, you can add the ignoreMessageStatus argument and set it to false:

using Screeb.Maui;

await Screeb.StartMessage("<message-id>", ignoreMessageStatus: false);

Contextualize responseโ€‹

The StartMessage command accepts a list of hidden fields. Values passed as parameters will be listed alongside the responses, on the Screeb platform.

using Screeb.Maui;

await Screeb.StartMessage(
"<message-id>",
allowMultipleResponses: true,
hiddenFields: new Dictionary<string, object>
{
["color"] = "red",
["size"] = 42
}
);

Force languageโ€‹

If you want to force the message language, you can pass the language parameter: Here is the order of priority for the language: message.start param > init param > user property > browser language.

await Screeb.StartMessage("<message-id>", language: "en");