web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Copilot Studio - Autonomous Agents
Suggested answer

Draft Email In Shared Mailbox Agent Flow JSON Error

(1) ShareShare
ReportReport
Posted on by 8
Hi all, I have a few questions and a really strange problem with trying to get this working.
 
Question 1 and strange problem:
I have an agent that triggers on an incoming message and creates a draft answer but its supposed to create it in the shared mailbox.
I tried allowing login on the shared mailbox (i know) and using those credentials in the Draft email action. and i have tried using the Send HTTP agent flow to create the draft, but kind of work and kind of don't
 
 
The problem with Draft email action
 
1. If I use the Draft an email and set the connection credentials to the shared mailbox it works briefly but then switched back to my credentials, even when i save it shows the connection as the SM account but after a few refreshed the connection switched back to mine, which means the draft is being created in my mailbox instead of the shared mailbox.
2. When the email is drafted its always in plain text, and i have to manually switch to HTML.
 
 
The problem with the Send HTTP action agent flow:
1. When I test directly from chat it works perfectly, the draft gets created in the shared using my account creds. But when I send an email it fails with the error that Unable to read JSON request payload. Please ensure Content-Type header is set and payload is of valid JSON format.  
2. It also only fails when I specify "nicely formatted" or "format in HTML" in the instructions. if I don't then it works but it's a wall of text.
 
I have tried all the different agents, i have tried rephrasing that in all types of ways but the minute i specify rich text of html the flow fails. I looked at the input for both a one that worked and one that failed in the flow, and it looks the same, content looks the same and json looks proper even chatgpt says they look the same, I've stripped it down and the problem is definitely with the body being sent.
 
Ultimately what I'm trying to do is an autonomous agent that monitors shared mailbox, creates a draft answer response to incoming emails and leaves it in the shared mailbox for the team to review.
 
 
Question 2: I noticed that drafts are brand new items, is it possibly to attach or reply but not send to the original message? For example, normally when hit reply but didn't actually reply it goes to the draft, but you can see the thread, with this its a brand-new message being drafted with the original message included in the body.
 
Question 3: Are agent flows included, and by included, I mean not being charged extra, in the $30mnthly license? The pricing table is a bit confusing. 
 
Thanks.
I have the same question (0)
  • Suggested answer
    Michael E. Gernaey Profile Picture
    52,325 Super User 2025 Season 2 on at
    Draft Email In Shared Mailbox Agent Flow JSON Error
     
    If I really wanted to do this fully, I would either
     
    1) if the service account can get a license, log in in incognito as the Service Account and Create the Agent
    make sure flows run as creator
    make sure the Tools or Flows (and I am not sure which you are creating except the trigger being hopefully the agent), that all actions are using specific connections that are the Service Account and are not set to run as the user but as the Maker.
     
    Or at least make sure the Flow is built incognito as the Service account so all connections etc are the service account and make sure it is not set to run as user so it only runs as the agent.
     
    Please share pictures of your flows after making these changes if you somehow find it doesn't work how you want it.
     
    Cheers

    If these suggestions help resolve your issue, Please consider Marking the answer as such and also maybe a like.

    Thank you!
    Sincerely, Michael Gernaey
  • CU19061716-0 Profile Picture
    8 on at
    Draft Email In Shared Mailbox Agent Flow JSON Error
    Hi Micheal, it actually resolved itself. I made no changes, came back the next day to test and both the shared issue worked, and using the send http flow worked. no idea why but it's great when it fixes itself..sort of.
  • Suggested answer
    CU19061716-0 Profile Picture
    8 on at
    Draft Email In Shared Mailbox Agent Flow JSON Error
    So just to provide an update if anyone else had this problem. What was actually causing the issue was the Agent itself. When it read from my answer template row which contains a verbatim message that I want it to use, and it came across email addresses, sometimes when creating the html in the json code it would use \mailto: and that would break the json, but when it used <b> bold to just highlight the html in the code it would work. 
     
    When i instructed it to stop doing that, it worked 99% of the time, ultimately i ended up building in as part of my agent flow a custom prompt, to properly format the json before creating the reply and that worked. Also thank you Microsoft for making those custom prompts free with the $30 license btw, very helpful.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Coming soon: forum hierarchy changes

In our never-ending quest to improve we are simplifying the forum hierarchy…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Copilot Studio

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 356 Super User 2025 Season 2

#2
Romain The Low-Code Bearded Bear Profile Picture

Romain The Low-Code... 345 Super User 2025 Season 2

#3
S-Venkadesh Profile Picture

S-Venkadesh 57 Moderator

Last 30 days Overall leaderboard