Skip to main content

$reactions.answer

The method displays a simple text response.

Syntax

The method can accept a string or an object.

String

Specify a string that defines a text response:

$reactions.answer("Message text");

In the text response, you can use substitutions inside the {{}} brackets, which can contain any valid JavaScript expression.

$reactions.answer("Hello, {{ $client.name }}!");

Object

Apart from a string, the method also accepts an object in which, in addition to a simple response text, you can pass text with HTML or speech synthesis markup.

ArgumentDescriptionRequired
valueResponse textYes
ttsResponse text with speech synthesis markupNo
htmlResponse text with HTML markupNo

How to use

  • Response text with HTML markup:

    script:
    $reactions.answer({
    "value": "You won this battle!",
    "html": "<b>You won this battle!</b>"
    });
    caution
    Only the chat widget, Chat API, and Telegram support HTML markup. In other channels, the client will receive a message without formatting.
  • Response text with speech synthesis markup:

    script:
    $reactions.answer({
    "value": "141155501234",
    "tts": "<say-as interpret-as=\"telephone\">141155501234</say-as>"
    });