# Start a message programmatically

Start an in-app message from your code, with hidden fields and a forced language, then close it when you need to.

Most messages start on their own, when the Screeb targeting engine finds a match. Start a message from your code when the trigger is something only your app knows, such as the first visit to a new feature.

The message id is in the message editor URL, after `/messages/`. To keep the message from also starting on its own, set its trigger to manual in the admin: see [Message targeting](https://help.screeb.app/guide/message-targeting/).

```dart
PluginScreeb.startMessage("<MESSAGE-ID>");
```

## Prevent multiple displays

By default, a message started from your code shows again even if the user already saw it. Turn off multiple responses to show it only once per user.

```dart
PluginScreeb.startMessage("<MESSAGE-ID>", allowMultipleResponses: false);
```

## Respect the message status

By default, a message started from your code shows whatever its status in the admin. Stop ignoring the status to show it only while the message is live.

```dart
PluginScreeb.startMessage("<MESSAGE-ID>", ignoreMessageStatus: false);
```

## Start a specific distribution

A message can have several distributions. Pass a distribution id to start the message with the settings of that distribution.

```dart
PluginScreeb.startMessage("<MESSAGE-ID>", distributionId: "<DISTRIBUTION-ID>");
```

## Add context with hidden fields

Hidden fields attach values to the response. They show next to the response in the Screeb admin and in exports, so you know where the message started.

```dart
PluginScreeb.startMessage("<MESSAGE-ID>", properties: <String, dynamic>{
  "source": "onboarding",
  "plan": "pro",
});
```

## Force the language

Pass an ISO 639-1 code, such as `"en"` or `"fr"`, to show the message in that language. The language used is the first one set among: this parameter, the language passed at initialization, the user's language property, then the browser or device language.

```dart
PluginScreeb.startMessage("<MESSAGE-ID>", language: "en");
```

## React to the message

Pass hooks when you start the message to run your code when it shows, gets a click or closes. See [Hooks](https://developers.screeb.app/sdk-flutter/hooks) for the list and the payloads.

## Close a message

Close the messages on screen, for example when the user leaves the page the message is about.

```dart
// Close every running message
PluginScreeb.closeMessage();

// Close one message
PluginScreeb.closeMessage(messageId: "<MESSAGE-ID>");
```
