Send and receive text message
The primary way your bot will communicate with users, and likewise receive communication, is through message activities. Some messages may simply consist of plain text, while others may contain richer content such as cards or attachments. Your bot's turn handler receives messages from the user, and you can send responses to the user from there. The turn context object provides methods for sending messages back to the user. This article describes how to send simple text messages.
Markdown is supported for most text fields, but support may vary by channel.
Send a text message
To send a simple text message, specify the string you want to send as the activity:
In the bot's activity handlers, use the turn context object's
SendActivityAsync method to send a single message response. You can also use the object's
SendActivitiesAsync method to send multiple responses at once.
Receive a text message
To receive a simple text message, use the text property of the activity object.
In the bot's activity handlers, use the following code to receive a message.
var responseMessage = turnContext.Activity.Text;
- For more information about activity processing in general, see activity processing.
- For more information on formatting, see the message activity section of the Bot Framework Activity schema.
Feedback verzenden over: