I'm working in a bot that uses a QnA Service to answer some questions. I set up channels like mail or Microsoft Teams so the bot can respond the answers there. I wanted to configure the mail channel so it responds if the subject is a particular one.
I don't see any option to configure it where you link the bot to the mail channel:
Is there any way to configure it?
Email channel configuration with the bot and making your logic work are two different things.
This documentation will enable you to pass native metadata to a channel in the activity object's channel data property.
For example,the JSON object of the channelData property for a custom email message is shown below:
"channelData": {
"type": "message",
"locale": "en-Us",
"channelID": "email",
"from": { "id": "[email protected]", "name": "My bot"},
"recipient": { "id": "[email protected]", "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>",
"subject": "Super awesome message subject",
"importance": "high",
"ccRecipients": "[email protected]"
}
}
An example to set Email channel specific properties in ChannelData can be implemented such as:
if (message.ChannelId == ChannelIds.Email)
{
var reply = message.CreateReply();
reply.ChannelData = JObject.FromObject(new
{
htmlBody = "<html><body style=\"font-family: Calibri; font-size: 11pt;\">This is the email body!</body></html>",
subject = "This is the email subject",
importance = "high"
});
//send reply to user
await context.PostAsync(reply);
}
Hope this helps.