如何使用node.js自动更新mailchimp模板

How do I update a mailchimp template automatically using node.js.

So if I changed the index.html from the github email repo, it would update the mailhimp template inside mailchimp itself.

Unfortunately, you won't be able to update a MailChimp template from Node.js just by editing a html file in a github repo.

You'll have to use the MailChimp API. You can access the API's directly or you can use one of the MailChimp API wrappers for Node.js. mailchimp-api-node is the official MailChimp wrapper, but I use node-mailchimp

Depending on what you're updating, the two API's you should look into are:

/campaigns/template-content to just update the content portion of the template https://apidocs.mailchimp.com/api/2.0/campaigns/template-content.php

/templates/update to update your user templates (not campaign content) to be used in campaigns https://apidocs.mailchimp.com/api/2.0/templates/update.php

Note: These are version 2.0 API's. I haven't had a chance to work with the new version 3.0 API's yet so there may be changes. Version 2.0 API's still work but they just aren't being updated anymore.