Map send_to SendGrid parameter to send an email

Hi Make Community,

I’d like to ask for your help with the following:

  1. I’m using SendGrid module to send an email to users
  2. Since the number of users emails might be more than 1 (from one of the previous scenario steps), I want to map all emails to send_to option.
  3. When I enable Map near ‘Send to’ option, Make gives me a hint of the data structure, like [object Object]

The issue is that I tried different values, for example:
[{“to”: “email@email.com”}],

but none of them worked for me and I keep getting * Invalid collection in parameter ‘send_to’.

Does anyone have an example of send_to option with Map enabled?

Thanks!

Hi @Kate_Lodova,

There are a few way to do it, but if it is a fixed number of predefined emails then you don’t need to use the Map, but since you are using it I assumed it that it is not sure how many emails you get.

Instead of to you need to craft it to work with email.

To do this, what you want to do is either,

  1. Create an Array Aggregator by iterating through the email from the previous module and using the Target structure type to be the Send to from Sendgrid.
  2. Instead of Array aggregator, Use Create JSON module/Aggregrate to JSON that will have datastructure containing emails, afterwhich you can use arrayaggregrator/Parse JSON module that will be then mapped to Send To field in SendGrid.
1 Like