Skip to main content

Recently, someone was asking about adding contacts to SendGrid when that person signed up for one of their Viral Loops campaigns:

The SendGrid integration doesn’t have a Create Contact action:

But! That doesn’t mean the workflow is impossible. We just have to get a little creative.

Let’s Check the SendGrid API

When you go here, you’ll see this:

Of the options shown there, I find it easiest to use the CURL option to get the pieces we need.

What Do We Do in Zapier?

We’re going to use Webhooks by Zapier to perform this action. Make sure to choose the Custom Request option:

 

Looking at that SendGrid screenshot, here’s how it translates to the Webhooks step in Zapier:

What Do We Put in the Data Field?

The code in that Data box is JSON, which you can get by clicking on this (from this page):

 

BUT, that gives you way more than you’ll likely need. If all you need is the email address, you can use this:

{ "contacts":  c { "email": ""  } ]
 

In between the “ “ for email you’ll map the field from your trigger (in this screenshot, it’s Viral Loops) that has the email address:

 

If you needed something like a first name, you’d add it under email address, like this:

 

{ "contacts":  r { "email": "",

"first_name”: ""  } ]

Getting the API Key from SendGrid

So, where do you get the API key that goes here:

 

To create your API key in SendGrid, go here: https://app.sendgrid.com/settings/api_keys

I’d strongly suggest giving it restricted access, to only what you need in order to add a contact. That’s this:

Make Sure to Test Your Zap

Make sure to test the Webhooks step to make sure that it does, in fact, add that contact to SendGrid. If you’ve followed along with the instructions above, you should be seeing that contact. You may have to refresh the Contacts page in order to see it :)

So, What Have We Learned?

With a little creativity and a bit of knowledge about how to use webhooks, you can get around missing actions in Zapier integrations. Once you get comfortable doing this, you’ll have so many more options open up!

Do you know if there is a way to take this a step further and add new contacts to a contact list within SendGrid?

For example, want to group contact based on how they answer a question within the form, and then add them to the correct contact list automatically based on how they answer.

 

Is this possible?


Hi,

 

I don't see the “Custom Request” under the event list.

Did the Webhook by Zapier changed and that was removed?


This is the API url in case you want to copy it: https://api.sendgrid.com/v3/marketing/contacts

And here is some copyable request JSON, the JSON in the post has some some errors:

 

{ "contacts": :{ "email": "{{168959771__Email}}", "first_name": "{{168959771__First name}}", "last_name": "{{168959771__Last name}}" }]}

 


Do you know if there is a way to take this a step further and add new contacts to a contact list within SendGrid?

For example, want to group contact based on how they answer a question within the form, and then add them to the correct contact list automatically based on how they answer.

 

Is this possible?

I would like to know the same… the point is to segment. Does anyone have an update on this question?

 


Reply