# Messages and jumps

These functions decide what the contact sees and where the scenario goes after the code. Messages and the jump are carried out once the code has finished without an error — in the order they were called.

## sendMessage

```js
sendMessage(text)
```

Sends a text message to the contact.

| Parameter | Type | What to pass |
|---|---|---|
| `text` | String | The message text. A number is turned into a string |

**Returns nothing.**

An empty string is not sent. The text goes out as is: [templates](https://support.watbot.org/chatbots/templates) `{{ ... }}` in it are not processed — insert the values you need into the string in code.

Up to 10 messages can be sent per run. The eleventh call already ends the code with an error, and not a single message is sent.

```js
var bouquet = getContactVariable('bouquet');
var price = Number(getContactVariable('price') || 0);

sendMessage('Your order: ' + bouquet + '.');
sendMessage('To pay: $' + price + '.');
```

## goToBlock

```js
goToBlock(id)
```

Moves the contact to a scenario block: the bot runs that block just as if a connection led to it.

| Parameter | Type | What to pass |
|---|---|---|
| `id` | Number | The ID of a block of the same bot. It is shown in the block settings |

**Returns nothing.**

The function can be called once per run — a second call ends the code with an error. If the bot has no block with this ID, there is no jump, and no error appears in the log — check the ID.

`goToBlock` does not cancel the "Continue" connection: without `disableContinue()` the bot runs both the given block and the one connected to "Continue".

```js
var sum = Number(getContactVariable('order_total') || 0);

if (sum >= 100) {
    goToBlock(12345);
    disableContinue();
}
```

Replace `12345` with the ID of the block you need.

## disableContinue

```js
disableContinue()
```

Disables the block's "Continue" connection for this run: the scenario does not move on along it. Next time the connection works again, unless the code calls `disableContinue()` again.

**No parameters.**

**Returns nothing.**

This way the code itself decides whether the scenario moves on: for example, it stops until the contact has filled in an address.

```js
var address = getContactVariable('delivery_address');

if (!address) {
    sendMessage('Send us the delivery address, and we will continue with your order.');
    disableContinue();
}
```
