Duplicate Contact Records with Identical Email Addresses were created using Contact API

I am having a duplicate issue whenever I create test contact records from a csv file having the same email address.

I am using AWS Lambda python code to automatically POST contact records to a client’s HubSpot server using the Contact API:

  1. I put the csv file containing the records with emails, into the AWS FTP location and it posts the contact successfully to HubSpot.

  2. To test if HubSpot prohibits duplicate records having the same email address, I load the same file onto the AWS FTP location and it creates duplicates.

  3. I manually create a raw JSON Body string - using Postman - of the same data from the csv file.

  4. I submit the POST method for this record and I get a 409 Error Code indicating this:

    “status”: “error”,

“message”: “Contact already exists. Existing ID: 131879551”,

“correlationId”: “5dd9efd8-21e2-4bb0-adc8-5b4556a3f538”,

“category”: “CONFLICT”

}

  • Note:

    This is exactly what I also want to see happen with AWS calls to HubSpot

    but instead of Error Code 409 as in Postman , I get 201 using AWS.

    Q) Why doesn’t hubspot send the same error response back in AWS when emails are identical for contact records in the csv file? Here are two duplicate contacts. The emails for both of these were set to this address:

    Thanks

    << TOKEN RESPONSE >>

    {

    “id”: “135312001”,

    “properties”: {

    “business_name”: “Makinac Island Fudge Emporium”,

    “createdate”: “2021-12-21T18:01:41.245Z”,

    “eog”: “gas”,

    “hs_all_contact_vids”: “135312001”,

    “hs_is_contact”: “true”,

    “hs_is_unworked”: “true”,

    “hs_marketable_until_renewal”: “false”,

    “hs_object_id”: “135312001”,

    “hs_pipeline”: “contacts-lifecycle-pipeline”,

    “lastmodifieddate”: “2021-12-21T18:01:41.245Z”,

    “proposal_date”: “2021-12-09”,

    “proposal_start_date”: “2021-12-21”,

    “smbapi”: “yes”,

    “srvc_address_1”: “2628 Crest View Dr”,

    “srvc_city_1”: “Mackinac Island”,

    “srvc_state_1”: “MI”,

    “srvc_zip_1”: “49757”,

    “term_1”: “12”,

    “term_2”: “24”,

    “term_3”: “36”,

    “udc_code_1”: “AGL”

    },

    “createdAt”: “2021-12-21T18:01:41.245Z”,

    “updatedAt”: “2021-12-21T18:01:41.245Z”,

    “archived”: false

    }

    << TOKEN RESPONSE >>

    {

    “id”: “135313401”,

    “properties”: {

    “business_name”: “Makinac Island Fudge Emporium”,

    “createdate”: “2021-12-21T18:01:41.245Z”,

    “eog”: “gas”,

    “hs_all_contact_vids”: “135312001”,

    “hs_is_contact”: “true”,

    “hs_is_unworked”: “true”,

    “hs_marketable_until_renewal”: “false”,

    “hs_object_id”: “135312001”,

    “hs_pipeline”: “contacts-lifecycle-pipeline”,

    “lastmodifieddate”: “2021-12-21T18:01:41.245Z”,

    “proposal_date”: “2021-12-09”,

    “proposal_start_date”: “2021-12-21”,

    “smbapi”: “yes”,

    “srvc_address_1”: “2628 Crest View Dr”,

    “srvc_city_1”: “Mackinac Island”,

    “srvc_state_1”: “MI”,

    “srvc_zip_1”: “49757”,

    “term_1”: “12”,

    “term_2”: “24”,

    “term_3”: “36”,

    “udc_code_1”: “AGL”

    },

    “createdAt”: “2021-12-21T18:05:26.388Z”,

    “updatedAt”: “2021-12-21T18:05:26.388Z”,

    “archived”: false

    }

OK I found out what was wrong and it was a big oversight on my part. I knew that HubSpot uses email addresses as unique key fields but I was so sure that I had provided an email that I felt I did not need to check the code. Wrong! So, I updated the AWS ETL integration code making sure that the email was extracted from the csv file and then added to the dictionry used to construct the pay load for the HubSpot Contact API . This problem is solved because HubSpot now sends the erorr code 409 message indicating that a duplicate record was attempting to be inserted. It now functions the same way as Postman does for these scenarios.