Closed jondcallahan closed 9 years ago
This is almost there but needs a couple of tweaks:
typeclass: "array"
from the mergeVars
input definitionmergeVars
to only have one item in the array (i.e. one object with "name" and "content" keys instead of two)Then you can test that the machine works with your changes. Normally you can do that by installing the machinepack runner (npm install machinepack
) and running mp exec
on the command line, but in this case it might be easier to write a little script since the mergeVars
input is JSON. Something like:
require('./').sendTemplateEmail({
apiKey: "theapikey",
toEmail: "john@doe.com",
templateName: "Welcome",
mergeVars: [{'name': 'foo', 'content': 'bar'}]
}).exec(console.log);
then save it as test.js
and run on the command line with node test.js
Thanks for the feedback. I've changed the file, successfully tested, and recommitted with the changes.
You should consider adding merge vars to sendPlaintextEmail as well while you're at it, and perhaps even global merge vars. Either way, well done on the PR.
Sorry about the delay on this, taking a look now.
Was trying to use template_content for merge tags, but it only supported one. I added the merge_vars field to allow users to input multiple unique merge tags and content.