Flow with JSON

IberianLynx 0 Reputation points
2023-03-12T11:35:51.6+00:00

Hello everyone,

I am trying to make a flow with the trigger

"When an HTTP request is received"

In this case, when filling in some data on the web, a JSON with this structure is provided.

"to", "subject" and "body"

the number of emails as well as ther names may vary.

I want, when the JSON is received, the flow sends to all the emails found in JSON an email with the subject and the body.

It's my first flow :(

Thank you

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
3,542 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  2. Anders Wennerwik 0 Reputation points
    2023-03-12T20:33:20.84+00:00

    Hi

    Create the Json schema by loading a sample payload into the HTTP request.

    Create a Compose action and replace the comma (',') in the To field with semicolon (';) with this expression:
    replace(triggerBody()?['to'],',',';')

    Initialize a string variable and add the body field from the Json payload.

    Create a Send an Email (v2) action from the Office 365 Outlook selection and populate it as seen below.

    User's image


  3. MayankBargali-MSFT 70,936 Reputation points Moderator
    2023-03-13T07:11:39.44+00:00

    @IberianLynx Thanks for reaching out. Assuming that you want to send single email to individual emails rather than sending one email to all the email ID's and the json object is defined as below

    {
       "to": "******@email.es, ******@email.es, ******@email.es",
       "body": "<h1>Hello</h1>",
       "subject": "Registration of an event"
    }
    
    

    Workflow:

    User's image

    You can change the above workflow and add individual names as per your input and customize it as per your need. You can refer to this document to know more about outlook connector. In case if you only need to send one email to all the email ID's then you need to remove the for each statement and use replace in the emaiList.

    You can refer to function reference for more details on the available functions in logic app.

    For your reference sharing the Code View with array and Code View without array

    The above is only for reference and you can modify it as per your requirement. Feel free to get back to me if you need any assistance.

    Please accept as "Yes" if the answer is helpful so that it can help others in the community. If you need any help/clarification/concerns/follow up questions, then please click on "Add Comment" on my answer and provide more details.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.