Mautic Community Forums

Custom Contact Sync via API

Hey fam :) I’m developing a custom contact sync with a clients booking system, so that when a booking is made the contact is either:

• Imported into Mautic if they don’t exist

• Updated with latest booking info if they do exist



What’s the best way to check if a contact exists before doing anything via the API?



As a slight side note, with Mailchimp this process is super simple. A contacts ID is simply the MD5 hash of the lowercase version of their email address, so if you do a PUT request with that ID, it does the above automatically - i.e. updates if exists, or create if doesn't. See here: https://developer.mailchimp.com/documentation/mailchimp/reference/lists/members/#

Hey fam :slight_smile: I’m developing a custom contact sync with a clients booking system, so that when a booking is made the contact is either:
• Imported into Mautic if they don’t exist
• Updated with latest booking info if they do exist

What’s the best way to check if a contact exists before doing anything via the API?


As a slight side note, with Mailchimp this process is super simple. A contacts ID is simply the MD5 hash of the lowercase version of their email address, so if you do a PUT request with that ID, it does the above automatically - i.e. updates if exists, or create if doesn’t. See here: https://developer.mailchimp.com/documentation/mailchimp/reference/lists/members/#

Well, I don’t know if it’s the best way to do it but seen as the email address field is unique I did it this way:

  1. Search for EMAIL with GET request to /contacts
  2. a) If the contact exists, update it with PATCH request
    b) If the contact doesn’t exist (i.e. search comes back empty), create it with POST request

Yep thats the way I tend to go

Thanks @kgroves - I appreciate the response!! :slight_smile: