Skip to main content

HTML markup

In certain channels, you can use HTML markup to format the text in bot replies: for example, to emphasize some words a message using italics or render an enumeration as a list.

HTML markup is supported in the following channels:

caution
If the bot sends a message with HTML markup in some other channel, the user will receive a plain text message without any formatting.

How to use

There are several ways you can use HTML in the script:

  • The a reaction tag. Specify two parameters after the tag: htmlEnabled = true and html, containing the text with markup:

     a: This is an article about HTML. || tts = "This is an article about <b>HTML</b>."
  • The $reactions.answer method. The method argument should be an object with the html property containing the text with markup:

    script:
    $reactions.answer({
    "value": "HTML is a <i>hypertext</i> markup language for viewing web pages in a browser.",
    "tts": "HTML is a <i>hypertext</i> markup language for viewing web pages in a browser."
    });
  • Replies with the text type. In the reply object, set the markup property to html and pass the text with markup in the text property:

    script:
    $response.replies = $response.replies || [];
    $response.replies.push({
    "type": "text",
    "text": "It was invented by <strike>an American</strike> a British computer scientist, Tim Berners-Lee.",
    "markup": "html"
    });
  • Replies with the image and video types for markup of image or video captions. In the reply object, set the markup property to html and pass the text with markup in imageName or videoName:

    script:
    $response.replies = $response.replies || [];
    $response.replies.push({
    "type": "image",
    "imageUrl": "https://example.com/tim-berners-lee.png",
    "imageName": "<u>Tim-Berners Lee</u>, the inventor of HTML",
    "markup": "html"
    });

Channel restrictions

All channels except the Chat API support a limited set of HTML tags.

TagChat widgetTelegram
<a> (link)YesYes
<b> (bold text)YesYes
<i> (italic text)YesYes
<ol> (numbered list)YesNo
<pre> (preformatted text)YesYes
<strike> (strikethrough text)YesYes
<u> (underline text)YesYes
<ul> (bulleted list)YesNo
<code> (code)YesYes