Mandrill Node - use json without attachment

I’m using the Mandrill node to send transactional emails.
I would like to use the “JSON Parameters” option so I can just include my merge vars as json.

However, when I do this it always complains about missing “attachmentJson”. See error below.
I looked into the code and it seems if the json option is used all 4 parameters have to be used:

if (jsonActive) {
	body.message.headers = validateJSON(this.getNodeParameter('headersJson', i) as string);
	body.message.metadata = validateJSON(this.getNodeParameter('metadataJson', i) as string);
	body.message.global_merge_vars = validateJSON(this.getNodeParameter('mergeVarsJson', i) as string);
	body.message.attachments = validateJSON(this.getNodeParameter('attachmentsJson', i) as string);
} else {...

I think it would be useful to not have to send an attachment but still be able to use the json option. Please let me know if this is possible.

The error I get:

ERROR: Could not get parameter "attachmentsJson"!
Error: Could not get parameter "attachmentsJson"!
at getNodeParameter (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/src/NodeExecuteFunctions.js:196:15)
at Object.getNodeParameter (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/src/NodeExecuteFunctions.js:387:24)
at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Mandrill/Mandrill.node.js:694:85)
at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/src/Workflow.js:489:37)
at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/src/WorkflowExecute.js:369:62
at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/src/WorkflowExecute.js:449:15
at /usr/local/lib/node_modules/n8n/node_modules/p-cancelable/index.js:61:11
at new Promise (<anonymous>)
at new PCancelable (/usr/local/lib/node_modules/n8n/node_modules/p-cancelable/index.js:31:19)
at WorkflowExecute.processRunExecutionData (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/src/WorkflowExecute.js:296:16)

Ah yes sorry. There was sadly a bug in our code. Just got fixed and will be released with the next version.

The problem is actually not that it is empty, it was that it used a wrong parameter name. For that reason will the JSON option sadly not work till the new version got released.

I will update here once that did happen.

Got released with n8n@0.84.0

1 Like