Mailchimp API not replacing mc:edit content sections (using ruby library)

前端 未结 5 917
太阳男子
太阳男子 2020-12-17 18:41

I\'m having a problem replacing mc:edit content areas in Mailchimp with the content that I provide.

The email is sent out to the subscribers, but none o

5条回答
  •  星月不相逢
    2020-12-17 18:59

    As per @kateray comment above, after an hour of tries I managed to insert my custom HTML from my back-end as the MailChimp campaign content via its API 3.0. For such a simple use case it is rather annoying not to have a ready-made solution on their docs. Surely MailChimp API lacks a cookbook.

    So from the beginning:

    1. a) Create the mailing list with API or with MailChimp web interface - create list and b) add the recepients to it - add members.

    2. Create the new campaign via API create campaign or their website. Do not assign any template to it.

    3. Assign the mailing list to the camplaign assign mailing list.

    4. Now set the campaign content with this API endpoint. Assign the following value to the JSON body of the request you send to the endpoint:

    {
        "html": "

    This is your custom HTML assigned to your campaign as content.

    " }

    and send the request.

    1. In the response to this request you get the HTML you set and its plain text version.

    2. Go in the MailChimp web interface and ensure the campaign has all the check marks green.

    3. Send out the campaign with this API request.

    NB:

    • double check you use the correct HTTP verbs for each API request: GET, PUT, PATCH, POST as shown in the API reference
    • do not forget to authenticate your API calls, here is the quick intro with clean examples made in Postman
    • double check you pass the correct list ID, campaign ID with your API requests.

提交回复
热议问题