Skip to main content

I recently created a Zap that adds contacts to a specific list in Sendgrid based on their Status in Salesforce. Now I want to make a Zap that will delete contacts from the same list if their Status changes and they no longer meet the criteria for the list. 

 

I know I can use a DELETE request to remove the contact from the list, but I need the Contact ID from Sendgrid to do so. Does anyone know how I can use a multi-step Zap to do the following?

  1. Trigger when a SFDC Contact Status changes to “Churned” 
  2. Take the contact’s email and search Sendgrid; then return the Sendgrid Contact ID
  3. Take the Contact ID and send it to Sendgrid through a DELETE request

Hi @Kiera 

Good question.

You can use the Webhooks app: https://zapier.com/apps/webhook/help

SendGrid API:

Steps

Action: Webook - POST

Action: Webhook - Custom Request (DELETE)

 

 


Hi Troy, thanks for this. I’m receiving an error when I try to set up the POST request — the error is either that it’s not in valid JSON format or that there is no email, which I don’t understand


@Kiera 

We would need to see detailed screenshots with how your Zap steps are configured along with the encountered errors.


Of course — this is what I have at the moment. 

 


@Kiera

Try changing it to Custom Request POST

Add this Header:

Content-Type: application/json

Add this as the Body.

Replace the email with the variable for the email.

{"emails": ["jane_doe@example.com"]}

@Troy Tessalone 

That worked, thank you!

 

Now my only other question is how to tell Zapier to pass the returned Contact ID through to the next step, with the DELETE request?

 

 


@Kiera 

Try following this SendGrid API endpoint documentation: https://docs.sendgrid.com/api-reference/contacts/delete-contacts

We would need to see screenshots of your Zap step and errors.


 


@Troy Tessalone Sorry, I just realized I was using the List ID instead of the Contact ID in the screenshots above. I’ve changed it to Contact ID but it still doesn’t seem to be working. In the body, I have:

{contact_ids=VARIABLE”}


@Troy Tessalone Ah, I figured it out. I just needed to append the contact id to the end of the url, rather than in the body.

 

Thanks so much for your help today!


@Kiera 

Try this…

Remove the Body values.

In the URL, append this: ?delete_all_contacts=true&ids=dEMAIL]

Replace cEMAIL] with the mapped variable.