Implement channel-specific functionality with the Bot Connector API

Some channels provide features that can't be implemented by using only message text and attachments. To implement channel-specific functionality, you can pass native metadata to a channel in the Activity object's channelData property. For example, your bot can use the channelData property to instruct Telegram to send a sticker or to instruct Office365 to send an email.

This article describes how to use a message activity's channelData property to implement this channel-specific functionality:

Channel Functionality
Email Send and receive an email that contains body, subject, and importance metadata

Note

The value of an Activity object's channelData property is a JSON object. The structure of the JSON object will vary according to the channel and the functionality being implemented, as described below.

Create a custom email message

To create an email message, set the Activity object's channelData property to a JSON object that contains these properties:

{
    "type": "ActivityTypes.Message",
    "locale": "en-Us",
    "channelID": "email",
    "fromName": { "id": "mybot@mydomain.com", "name": "My bot"},
    "recipientName": { "id": "joe@otherdomain.com", "name": "Joe Doe"},
    "conversation": { "id": "123123123123", "topic": "awesome chat" },
    "channelData":
    {
        "htmlBody": "<html><body style = \"font-family: Calibri; font-size: 11pt;\" >This is more than awesome.</body></html>",
        "importance": "high",
        "ccRecipients": "Yasemin@adatum.com;Temel@adventure-works.com",
    }
}

This snippet shows an example of the channelData property for a custom email message.

"channelData":
{
    "htmlBody": "<html><body style = \"font-family: Calibri; font-size: 11pt;\" >This is more than awesome.</body></html>",
    "importance": "high",
    "ccRecipients": "Yasemin@adatum.com;Temel@adventure-works.com"
}

Additional resources