Conversational Text Formatting in Microsoft Bot-Framework

This post is about how can we do text formatting in the Microsoft Bot framework.

Like, how to send or receive text in bold, italics, list, quote, links etc.

  • Bold and Italics

//bold

session.send("Hello, **You said**, %s", session.message.text);

bold


//italics

session.send("Hello, *You said* %s, session.message.text");

italics


//bold and italics both

session.send("***This text is bold and italics both***");

bni

  • Multiline Text

//multiline

session.send("What is your name?\n\nWhat is your age?\n\nWhere do you live?");

multiline

  • List

//lists

session.send("Hi, Below is my list\n\n"+ "* Item 1\n\n"+ "* Item 2\n\n"+ "Item 1 ");

list

  • Strikethrough text

//strikethrough

session.send("~~This is strike through~~");

strikethrough

  • Quote a text

//quote

session.send("Block quote below bar \n\n"+ "---"+ "\n\n> This is how you write quotes in here. Hope you like it.\n\n"+ "-BOT");

quote

  • Adding Links

//links

session.send("This is link: [bing](http://www.bing.com)");

link

  • Adding text in increased font(a heading)

session.send("# This is big text\n\n"+ "This is normal text");

bigtext

Hope it helps you when you are developing a chat bot using Microsoft Bot Framework.

Note: These formatting may not work on all channels like facebook messenger.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s