Forum Discussion
Send attached images in teams to another connected user or agent.
I am working on a Bot framework project.
We have a feature called 'Connect to Agent' for connecting the user to live teams agents. Once connected with the agent, the user can send text messages to the agent and vice versa using ConnectorClient.
We wanted to add a new feature to send screenshots/ attach images either from agent or user to the connected one.
We have used the below code to get the attachment content details,
foreach (var attachment in activity.Attachments)
{
if (attachment.ContentType == "text/html")
{
message = attachment.Content.ToString();
}
}
And to send the message ,
IMessageActivity messageActivity = utilities.CreateMessageActivity(recipient, message);
ConnectorClient.Conversations.SendToConversationAsync((Activity)MessageActivity);
Able to send the image to the connected user or agent , but its not displaying as the path is not correct.
Is there any other possible ways we can get the attached image and send to the connected teams channel (agent or user)
15 Replies
- Sayali-MSFT
Microsoft
Lakshmi_145-Thanks for reporting your issue.
We will check this at our end and will get back to you.- Lakshmi_145Iron Contributor
Is there any update on this. Will be able to send images to connected user or agent using bot framework ?
- Lakshmi_145Iron Contributor
I also tried the below code,
IMessageActivity forwardedMessage = activity; foreach (var attachment in activity.Attachments) { if (attachment.ContentType.StartsWith("image/")) { forwardedMessage = Activity.CreateMessageActivity(); forwardedMessage.Attachments = new List<Attachment> { attachment }; forwardedMessage.ApplyConversationReference(recipient); } }and send the message activity using connector client. Got the same image invalid in recipient teams bot
Also tried to access the content url we are getting in the activity attachment , but it shows the below authorization error message
{"message":"Authorization has been denied for this request."}We are trying to send message from teams bot personal chat to the teams groups chat.
Image was getting received at group chat side when manually edited the attachment conent url with a jpeg image .