The Community is hosting an End of Summer sweepstakes! Participants must complete tasks to earn tickets that will enter them with a chance to win a free year of Constant Contact and other great prizes!*
*No Purchase Necessary. For Official Rules, visit here. Constant Contact’s End of Summer 2020 Sweepstakes ends on October, 20, 2020 at 11:50 PM EST.

Bulk Activities - Add Contacts API example request

Highlighted
Member

Bulk Activities - Add Contacts API example request

http://developer.constantcontact.com/docs/bulk_activities_api/bulk-activities-add-contacts.html
There are several places where the example request body doesn't seem to match up with the documentation

- the documentation states that any additional properties to be included in import_data beyond EMAIL need to be listed in the column_names array. however your example request shows "JOB TITLE" in column_names and "job_title" in the import_data. is there an implied mapping between spaces and underscores that isn't documented?

- the documentation for column_names mentions "CUSTOM FIELD 1" (to 15), which seems to imply up to 15 separate custom fields, however the example request shows an array labeled "custom_fields". similarly, "ADDRESS LINE 1" (to 3) is shown under column_names, but the example request shows an array "addresses" of objects, each containing keys "line1", "line2", and "line3" (no space or underscore)

Also: the documentation states that if the column_names array exists but is empty, only the email addresses will be added. however our tests seem to show that all fields will be added even when column_names is empty.

 

Doesn't seem to be using column_names even though its required. Is this correct? Is there something that I am missing?

 

Figured out that we had to use the property names in the import_data - example "job_title". Found here when adding individual contacts: http://developer.constantcontact.com/docs/contacts-api/contacts-resource.html. But added fax/cell_phone and they were not accepted? Also notice does not allow me to add State Other? What is the property name for that?

 

 

Thank you in advance for the help!

5 REPLIES 5
Highlighted
Moderator

Re: Bulk Activities - Add Contacts API example request

Sorry for the delay on our response. We're working on looking through the info you brought up - there does seem to be a little bit of a discrepency here, or at least some clarifications we can make in the documentation. We'll get back to you soon on this.

Nick Galbraith
Support Engineer
Highlighted
Moderator

Re: Bulk Activities - Add Contacts API example request

Thanks for the feedback.  Sounds like we need to clean up the documentation to be more specific and clear.  Will get this feedback to our tech writer and hopefully we can clean this up soon so no one else runs into this.  In the meatime, the answer is yes.  The spaces in the column names maps to understores in the JSON fields (JSON doesn't support spaces in field names).  Here is an example payload using most fields that should help:

 

{
    "column_names": [
        "EMAIL",
        "FIRST NAME",
        "LAST NAME",
        "JOB TITLE",
        "COMPANY NAME",
        "WORK PHONE",
        "HOME PHONE",
        "CUSTOM FIELD 1",
        "CUSTOM FIELD 2",
        "CUSTOM FIELD 3",
        "CUSTOM FIELD 4",
        "CUSTOM FIELD 5",
        "CUSTOM FIELD 6",
        "CUSTOM FIELD 7",
        "CUSTOM FIELD 8",
        "CUSTOM FIELD 9",
        "CUSTOM FIELD 10",
        "CUSTOM FIELD 11",
        "CUSTOM FIELD 12",
        "CUSTOM FIELD 13",
        "CUSTOM FIELD 14",
        "CUSTOM FIELD 15"
    ],
    "import_data": [
        {
            "addresses": [
                {
                    "city": "Waltham",
                    "country_code": "US",
                    "line1": "",
                    "line2": "",
                    "postal_code": "02451",
                    "state_code": "MA"
                }
            ],
            "company_name": "",
            "custom_fields": [
                {
                    "name": "Custom Field 1",
                    "value": ""
                },
                {
                    "name": "Custom Field 2",
                    "value": ""
                },
                {
                    "name": "Custom Field 3",
                    "value": ""
                },
                {
                    "name": "Custom Field 4",
                    "value": ""
                },
                {
                    "name": "Custom Field 5",
                    "value": ""
                },
                {
                    "name": "Custom Field 6",
                    "value": ""
                },
                {
                    "name": "Custom Field 7",
                    "value": ""
                },
                {
                    "name": "Custom Field 8",
                    "value": ""
                },
                {
                    "name": "Custom Field 9",
                    "value": ""
                },
                {
                    "name": "Custom Field 10",
                    "value": ""
                },
                {
                    "name": "Custom Field 11",
                    "value": ""
                },
                {
                    "name": "Custom Field 12",
                    "value": ""
                },
                {
                    "name": "Custom Field 13",
                    "value": ""
                },
                {
                    "name": "Custom Field 14",
                    "value": ""
                },
                {
                    "name": "Custom Field 15",
                    "value": ""
                }
            ],
            "email_addresses": [
                "test@test.com"
            ],
            "first_name": "Bob",
            "home_phone": "1234567891",
            "job_title": "",
            "last_name": "Smith"
        }
    ],
    "lists": [
        "67"
    ]
}

Dave Berard
Senior Product Manager, Constant Contact
Highlighted
Member

Re: Bulk Activities - Add Contacts API example request

Thanks for the reply!

 

Couple Questions:

  1. The column names though it says they are required - in my testing are not required. If I omit - the company name but still add company_name and value to import data - the information is added for that contact. Are they required? How is it mapped or what are they used for. Noticed column names are now not related or used with addresses?
  2. How do we add a state that is outside US?
  3. When adding an individual contact you can add cell_phone or fax - is this not allowed for bulk imports?

Thanks Again!

Highlighted
Moderator

Re: Bulk Activities - Add Contacts API example request

Quick update, though still checking on our side to make sure all this is correct.

 

1. The goal was to have them mandatory though in retrospect, not sure it matters and doesn't seem to work as expected.  We are looking into this to see if it's needed at all and, if not, updating documentation to reflect changes.

2. You can use the field "state" instead of "state_code" for international. 

3. This is not available in the bulk activities yet due to a roll out of our new Contact Management System.  When that roll out is complete, we will be updating the bulk activities to add some additional fields like those.

Dave Berard
Senior Product Manager, Constant Contact
Highlighted
Moderator

Re: Bulk Activities - Add Contacts API example request

Update on number 1: we did some testing and in our rests the column names do indeed control which fields we import and don't.  You can completely control how much of the JSON we pay attention to using this. 

 

We're still investigating your second question, looks like we may have a defect that is preventing state from working correctly.  Will update soon.

Dave Berard
Senior Product Manager, Constant Contact
Developer Portal

View API documentation, code samples, get your API key.

Visit Page

Constant Contact 2020 End of Summer Community Sweepstakes!

The Constant Contact User Community is hosting a sweepstakes. The more you participate, the more chances you have to win! Read on to learn more...

Read More
Featured