SendGrid and custom_args

Hi,
I want to add custom arguments in emails that should be sent via SendGrid.
If I’m reading help files correctly I should add them as

var headerObj = {    
   "custom_args": {
          "customerID": "1234",
          "arg2": "sample"
    }
};

merge.context.sections["Content"].addHeader("X-SMTPAPI", JSON.stringify(headerObj));

But it does not work.

The documentation states: If the email is going to be sent by the OL Connect SendGrid plugin, the X-SMTPAPI header will not be used. Enter the category or categories in the plugin’s settings instead.
I don’t want to change categories, but I’m guessing that’s the problem since I use this plugin.

The question is can I add custom arguments with SendGrid plugin (and how)?
If it’s not possible, the next question would be how to send mail to SendGrid without this plugin?

Thanks.

Does the same behaviour also occur when you replace the following line of JavaScript code:

merge.context.sections["Content"].addHeader("X-SMTPAPI", JSON.stringify(headerObj));

with the following?

merge.template.contexts.HTML_EMAIL.sections["Content"].addHeader("X-SMTPAPI", JSON.stringify(headerObj));

Info: Notice the difference? The start of the line of JavaScript code changed from merge.context.sections to merge.template.contexts.HTML_EMAIL.sections.

It’s the same.
Render Email Content generate header key (verified in JSON file after this step)

I don’t believe the custom_args property (described here) is supported by the SendGrid plugin in Workflow. There is no way to pass a value for it.

I’m not that familiar with OL Connect Automate but it doesn’t look like it is supported by the SendGrid node in Automate either.

I can’t come up with a workaround. Perhaps someone else can help out.

Edit: This was the result of tracking down and analyzing the source code. The Workflow plugin has a comment saying we should look into adding support for custom_args, but there was no ticket yet. I created a ticket now; internal ref SHARED-94452.

1 Like