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
areaction tag. Specify two parameters after the tag:htmlEnabled = trueandhtml, containing the text with markup:a: This is an article about HTML. || tts = "This is an article about <b>HTML</b>."Replies with the
texttype. In the reply object, set themarkupproperty tohtmland pass the text with markup in thetextproperty:script:
$response.replies = $response.replies || [];
$response.replies.push({
"type": "text",
"text": "HTML is a <i>hypertext</i> markup language for viewing web pages in a browser.",
"markup": "html"
});The
$reactions.answermethod. The method argument should be an object with thehtmlproperty containing the text with markup:script:
$reactions.answer({
"value": "It was invented by a Britich computer scientist, Tim Berners-Lee.",
"tts": "It was invented by <strike>an American</strike> a Britich computer scientist, Tim Berners-Lee."
});
Channel restrictions
All channels except the Chat API support a limited set of HTML tags.
| Tag | Chat widget | Telegram |
|---|---|---|
<a> (link) | Yes | Yes |
<b> (bold text) | Yes | Yes |
<i> (italic text) | Yes | Yes |
<ol> (numbered list) | Yes | No |
<pre> (preformatted text) | Yes | Yes |
<strike> (strikethrough text) | Yes | Yes |
<u> (underline text) | Yes | Yes |
<ul> (bulleted list) | Yes | No |