mailchimp/APIv3-examples

Add subscriber to list without sending confirmation

thangtx opened this issue · 2 comments

I try to subscribe an address as document description here http://developer.mailchimp.com/documentation/mailchimp/guides/manage-subscribers-with-the-mailchimp-api/ but mailchimp still send subscriber confirmation email

POST /3.0/lists/2cd35fd050/members/ HTTP/1.1
Host: us12.api.mailchimp.com
Authorization: Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Cache-Control: no-cache
Postman-Token: 94f32fa3-935b-1e28-1049-b5f99499b5e2

{
    "email_address": "testaccount@gmail.com",
    "status": "subscribed",
    "merge_fields": {
        "FNAME": "Test",
        "LNAME": "Account"
    }
}

Response data

{
  "id": "de25a78407a2152fba1a8f2b6e4b0b2e",
  "email_address": "testaccount@gmail.com",
  "unique_email_id": "4af9adf7ff",
  "email_type": "html",
  "status": "pending",
  "merge_fields": {
    "FNAME": "Test",
    "LNAME": "Account"
  },
  "stats": {
    "avg_open_rate": 0,
    "avg_click_rate": 0
  },
  "ip_signup": "",
  "timestamp_signup": "",
  "ip_opt": "123.24.170.224",
  "timestamp_opt": "2016-04-02T13:41:24+00:00",
  "member_rating": 2,
  "last_changed": "2016-04-02T13:41:24+00:00",
  "language": "",
  "vip": false,
  "email_client": "",
  "location": {
    "latitude": 0,
    "longitude": 0,
    "gmtoff": 0,
    "dstoff": 0,
    "country_code": "",
    "timezone": ""
  },
  "list_id": "2cd35fd050",
  "_links": [
    {
      "rel": "self",
      "href": "https://us12.api.mailchimp.com/3.0/lists/2cd35fd050/members/de25a78407a2152fba1a8f2b6e4b0b2e",
      "method": "GET",
      "targetSchema": "https://us12.api.mailchimp.com/schema/3.0/Lists/Members/Instance.json"
    },
    {
      "rel": "parent",
      "href": "https://us12.api.mailchimp.com/3.0/lists/2cd35fd050/members",
      "method": "GET",
      "targetSchema": "https://us12.api.mailchimp.com/schema/3.0/Lists/Members/Collection.json",
      "schema": "https://us12.api.mailchimp.com/schema/3.0/CollectionLinks/Lists/Members.json"
    },
    {
      "rel": "update",
      "href": "https://us12.api.mailchimp.com/3.0/lists/2cd35fd050/members/de25a78407a2152fba1a8f2b6e4b0b2e",
      "method": "PATCH",
      "schema": "https://us12.api.mailchimp.com/schema/3.0/Lists/Members/Instance.json"
    },
    {
      "rel": "upsert",
      "href": "https://us12.api.mailchimp.com/3.0/lists/2cd35fd050/members/de25a78407a2152fba1a8f2b6e4b0b2e",
      "method": "PUT",
      "schema": "https://us12.api.mailchimp.com/schema/3.0/Lists/Members/Instance.json"
    },
    {
      "rel": "delete",
      "href": "https://us12.api.mailchimp.com/3.0/lists/2cd35fd050/members/de25a78407a2152fba1a8f2b6e4b0b2e",
      "method": "DELETE"
    },
    {
      "rel": "activity",
      "href": "https://us12.api.mailchimp.com/3.0/lists/2cd35fd050/members/de25a78407a2152fba1a8f2b6e4b0b2e/activity",
      "method": "GET",
      "targetSchema": "https://us12.api.mailchimp.com/schema/3.0/Lists/Members/Activity/Collection.json"
    },
    {
      "rel": "goals",
      "href": "https://us12.api.mailchimp.com/3.0/lists/2cd35fd050/members/de25a78407a2152fba1a8f2b6e4b0b2e/goals",
      "method": "GET",
      "targetSchema": "https://us12.api.mailchimp.com/schema/3.0/Lists/Members/Goals/Collection.json"
    },
    {
      "rel": "notes",
      "href": "https://us12.api.mailchimp.com/3.0/lists/2cd35fd050/members/de25a78407a2152fba1a8f2b6e4b0b2e/notes",
      "method": "GET",
      "targetSchema": "https://us12.api.mailchimp.com/schema/3.0/Lists/Members/Notes/Collection.json"
    }
  ]
}

Hi @thangtx! This issue appears to be a request for support, which we cannot provide through github. you'll need to reach out to apihelp@mailchimp.com for support.

@thangtx This should work if you use the PUT verb instead of POST. You'll need to create an MD5 hash of the lowercased email address and append that to the url. See http://developer.mailchimp.com/documentation/mailchimp/reference/lists/members/#edit-put_lists_list_id_members_subscriber_hash