I want to use email channel of bot framework to send email via bot if bot is unable to provide help required.
I have configured an outlook office 365 email and successfully added to the email channel of my bot.
As I have never used the email channel before I am not sure of the channel data that has to be set in case of email, I have no idea what is missing or if there's some error in reply creation.
I want to send direct email from bot to user's email id with some relevant details, user to whom email will be sent is not involved in conversation.
I am getting bad request error while trying to send the email via following code:
ChannelAccount botAccount = new ChannelAccount(
id: $"{ConfigurationManager.AppSettings["BotEmail"]}".ToLower(),
name: $"{ConfigurationManager.AppSettings["BotId"]}")
{ Id = ConfigurationManager.AppSettings["BotEmail"]};
ChannelAccount userAccount = new ChannelAccount(
id: $"{ConfigurationManager.AppSettings["UserEmail"]}",
name: "Vanjuli")
{ Id = ConfigurationManager.AppSettings["UserEmail"]};
var serviceURL = @"https://email.botframework.com/";
MicrosoftAppCredentials.TrustServiceUrl(serviceURL, DateTime.MaxValue);
using (var _connector = new ConnectorClient(new Uri(serviceURL)))
{
ConversationResourceResponse conversationId = await _connector.Conversations.CreateDirectConversationAsync(botAccount, userAccount);
IMessageActivity reply = Activity.CreateMessageActivity();
reply.From = botAccount;
reply.Recipient = userAccount;
ConversationAccount conversationAccount = new ConversationAccount(id: conversationId.Id);
reply.Conversation = new ConversationAccount(id: conversationId.Id);
reply.Text = "This is dummy text of an email!";
reply.Locale = "en-Us";
await _connector.Conversations.SendToConversationAsync((Activity)reply);
}
I would also like to send attachments via email and send email to a group (service desk or group of email ids), is it possible to do so via email channel from a bot deployed on website or are there any challenges or risks ?
According to Microsoft documentation bot receives all emails from the registered mail and can reply to any email but what I am trying to achieve is sending email explicitly which is not a reply to any previous mail. Is something like this possible for a bot which is not solely an email chatbot or is deployed on a website?
While the intent is admirable, the approach is not recommended at all, and was not intended to mix the channels in such a manner.
Nicholas is correct; if you want to showcase multiple channels, it's best to not have them in a single