How to submit multiple email addresses to Sendgrid

Options

Hi everyone

I am trying to figure out how to update the 'sendgrid_dynamic_send' custom function to allow me to input multiple email addresses in either the To or CC field. According to Sengrid's documentation, both fields support multiple email addresses. Each one must be submitted as an object, along with an optional name field.

Looking at the screenshot below, you can see the expected structure for the To email field. What updates would I need to make to have it support multiple email addresses that are coming in from the calling API as an array variable?

I've tried multiple options but I can't get anything to work. Any help greatly appreciated. 🙂

Thanks.

Tagged:

Best Answer

  • dorian
    dorian Member
    Answer ✓
    Options

    Holy crap I figured this out too! Trial and error for hours…

    I wanted to actually submit multiple email addresses in the CC field. In the end I added a single new CC block to the external API request function, a new input set to json, and then created an array variable with each email address as an object in it and passed that into the json input. I tried multiple variations on the input field type; only when I set it to json did it finally work.

Answers