Create messages with the Bot Connector API
Your bot will send Activity objects of type message to communicate information to users, and likewise, will also receive message activities from users. Some messages may simply consist of plain text, while others may contain richer content such as text to be spoken, suggested actions, media attachments, rich cards, and channel-specific data. This article describes some of the commonly-used message properties.
Message text and formatting
Message text can be formatted using plain, markdown, or xml. The default format for the
textFormat property is markdown and interprets text using Markdown formatting standards. The level of text format support varies across channels.
For tables describing which features are supported on each channel, see the channels reference article.
textFormat property of the Activity object can be used to specify the format of the text. For example, to create a basic message that contains only plain text, set the
textFormat property of the
Activity object to plain, set the
text property to the contents of the message and set the
locale property to the locale of the sender.
attachments property of the Activity object can be used to send simple media attachments (image, audio, video, file) and rich cards. For details, see Add media attachments to messages and Add rich cards to messages.
Many channels support the ability for a bot or user to "mention" someone within the context of a conversation. To mention a user in a message, populate the message's
entities property with a Mention object.
To convey location-related information within a message, populate the message's
entities property with Place objects.
Text to speech
speak property of the Activity object can be used to specify the text to be spoken by your bot on a speech-enabled channel and the
inputHint property of the
Activity object can be used to influence the state of the client's microphone. For details, see Add speech to messages and Add input hints to messages.
suggestedActions property of the Activity object can be used to present buttons that the user can tap to provide input. Unlike buttons that appear within rich cards (which remain visible and accessible to the user even after being tapped), buttons that appear within the suggested actions pane will disappear after the user makes a selection. For details, see Add suggested actions to messages.