Marketing Team
Marketing Team

Reputation: 1

List ID & Custom Field Not Pulling Into SendGrid via Zapier

Hi Stack Overflow Community,

I am a marketer by trait, with some technical skills, but not a developer by nature; so I wanted to reach out to a developer community to help me. I am currently setting up a process to run a pre-launch email referral campaign through viral loops (https://viral-loops.com/templates/startup-prelaunch) and am using Zapier to connect it to the ESP we are using, SendGrid, since there is no direct integration.

I am trying to pass over the following information

I have set up the zap successfully so that it is passing through the first name, last name, and adding contacts to our ESP. However, I cannot figure out, why I cannot get it to add to the specific audience list or add the participant URL.

For the list id, I thought I have followed this step properly -- https://docs.sendgrid.com/api-reference/contacts/add-or-update-a-contact#body

For the participant URL, I created a custom field in SendGrid and then use the above doc. and thought it should pull in.

I have attached the current Zap setup in this link:

Update after hopscotch

Thanks in advance for the help!

Zapier Error Message

Zapier Trouble Shoot Details

Hopscotch JSON Error

Upvotes: 0

Views: 611

Answers (1)

philnash
philnash

Reputation: 73075

A few things here, the shape of your JSON isn't exactly right, I'll show you that in a bit. Your participant_URL field is a custom field, so it needs to go in the custom_fields property of a contact and use the ID of the custom field. And your list IDs should be IDs and not names.

For the custom field ID, the easiest way to get the ID is by calling the API to get the field definitions. You could likely do this with another Zap to the API. Or the following curl command in your terminal:

curl -X GET https://api.sendgrid.com/v3/marketing/field_definitions \
--header "Authorization: Bearer <<YOUR_API_KEY_HERE>>"

The List ID is easier to get. Just go to your lists in the Marketing Campaigns section of the SendGrid dashboard and click on the list. The ID is in the URL: https://mc.sendgrid.com/contacts/lists/<<YOUR_LIST_ID>>.

For the JSON, it should look like this:

{
  "list_ids": ["YOUR_LIST_ID"],
  "contacts": [{
    "email": "[email protected]",
    "first_name": "Alice",
    "last_name": "Franks",
    "custom_fields": [{
      "CUSTOM_FIELD_ID_FOR_URL": "https://vrips.co/XXXXX"
    }]
  }]
}

Upvotes: 0

Related Questions