Writing A Serverless Golang Wrapper Around Our CRM

Posted on March 07, 2019

The Need

At my work, we use a crm whose REST api is far from ideal.

  1. You can’t add tags while creating a contact.
  2. Contact email addresses are case sensitive. This reeks havoc when searching.
  3. The api for creating a contact errors out if someone with that email already exists.
  4. The endpoint for updating a contact takes an ID (not an email address). SO, you need to make an extra request to get that first.

Basically, to add a contact from the frontend of the site, you need to check for someone first, then go from there with 2-4 more if/thens.

You also need to always remember to lowercase the email before pushing it in.

This isn’t the most fun.

Mountain

Solution

So, I setup one endpoint that either creates or updates a contact. Then, adds a tag and/or associates whatever other info I pass in.

It’s pretty handy to have Lambda’s around to solve issues like this.

Before serverless, I’d have put this code on a random monolith we had lying around. Or, maybe not have thought to do it at all.

Now, we can update our CRM from one easier to use REST api wrapper.

The first place I used it was in a Lambda catching Stripe webhooks.

If that webhook is of a certain type, it sends post request to this new CRM lambda I wrote to add a tag to the customer.