# showMessage

Command (Messages and statuses).

Show one message as Notification or Popup If multiple message are sent, they are queued

Puts text from the client application in front of the driver, inside BeNav, while they are
navigating. It saves the driver switching applications to read something, and lets the client
application say something urgent at the moment it matters.

Two forms: a *notification* banner at the top of the screen, which does not interrupt, and a
*popup* in the middle, which blocks interaction until it is dealt with. The client application
chooses how long it stays, whether the driver can dismiss it, whether it makes a sound, and its
colours.

**Worth knowing**

- One message is shown at a time; further messages queue and appear in turn.
- A *popup* that is neither dismissible nor time-limited blocks the driver until the client
  application sends [`hideMessage`](https://docs.benomad.com/benav-rnc/commands/hide-message.md). Deliberate for an acknowledgement, dangerous by
  accident.

**Example: a change of plan mid-route**

A customer cancels while the driver is already on the way. Dispatch sends a notification-style
message ("Drop 4 cancelled, continue to drop 5") which the driver reads without leaving
navigation, followed by a fresh [`startGuidance`](https://docs.benomad.com/benav-rnc/commands/start-guidance.md) for the new destination.

## Command

```json
{
    "id": "string",
    "jsonrpc": "2.0",
    "method": "showMessage",
    "params": {
        "dismissible": true,
        "expiresIn": 5,
        "soundAlert": false,
        "text": "Your message ",
        "type": "notification",
        "backgroundColor" : "#FF5722",
        "textColor": "#2196F3"
    }
}
```

Specific parameters:

- `text` Text of the message
- `type` \["notification" \| "popup"\]

  - `notification` Message will be displayed at the top of the screen
  - `popup` Message will be displayed in the middle of the screen, and make other elements non interactive
- `soundAlert` Should a notification sound be sent when the message appears
- `dismissible` Should the message be dismissible by user through a close button
- `expiresIn` Duration the message will be displayed for.

  - if set to 0 the message will be displayed indefinitely
- `backgroundColor` Color of the card the message is displayed in
- `textColor` Color of the message's text

`text` and `type` are **mandatory**; a blank `text` is rejected with `-32602 invalid.params`. `expiresIn` is expressed in **seconds**. Defaults: `dismissible` `true`, `expiresIn` `0` (indefinite), `soundAlert` `false`. `type` is matched case-insensitively.

**If** `dismissible` **is set to false and** `expiresIn` **to 0, the message will only disappear after a call to** [`hideMessage`](https://docs.benomad.com/benav-rnc/commands/hide-message.md). **Be careful as such a message with a type** `popup` **will block any action by the user until a call to** [`hideMessage`](https://docs.benomad.com/benav-rnc/commands/hide-message.md)**.**

**Only one (1) message can be displayed at a time. Multiple calls to this command will queue the subsequent messages: each will be displayed after the previous one disappear.**

## Response

Generic responses
