I'm trying to build a flow that uses the Send an HTTP request action to create a draft email, and this video does a great job showing how to do it. However, the example only shows how to hard code a single email address into the JSON. I want to dynamically add an array of email addresses, and I can't figure out how to make it work. I tried initializing a variable, then appending it with a loop based on a conditional field that pulls addresses from a SharePoint list. I then sent the variable to a Compose action, and inserted the Compose output into the JSON. I also tried stripping the brackets, changing the double-quotes (around email address) to single quotes... but nothing worked.
I'm typically getting the error message "were unable to deserialize" or "Unable to read JSON request payload. Please ensure Content-Type header is set and payload is of valid JSON format" - depending on what tweaks I make.
Any ideas?
Expiscornovus - thanks for that. Here's my updated flow, and it works great.
Hi @MarcusD1,
It looks like the outputs format of your array would be something like
"toRecipients": [
{
"emailAddress": {
"address": ["Pam@contoso.onmicrosoft.com","Michael@contoso.onmicrosoft.com"]
}
}
]
I believe format for the toRecipients array field needs to be formatted like below.
{
"subject": "Testing Email",
"body": {
"contentType": "html",
"content": "Test"
},
"toRecipients": [
{
"emailAddress": {
"name": "Pam Beesly",
"address": "Pam@contoso.onmicrosoft.com"
}
},
{
"emailAddress": {
"name": "Michael Scott",
"address": "Michael@contoso.onmicrosoft.com"
}
}
]
}
Michael E. Gernaey
566
Super User 2025 Season 1
David_MA
516
Super User 2025 Season 1
stampcoin
492