Adding more contacts to the Sendgrid list

I created a new list using the Sendgrid Python module, but I am confused about how to add emails to this list using the API. According to the Sendgrid documentation, I need to send a POST request with the list_id and recipient_id parameters. I do not understand where I will look for this recipient_id when I try to add email addresses for the first time?

I managed to add individual recipients following this documentation and sample code from Github :

response = sg.client.contactdb.recipients.post(request_body=[{'email': 'test@email.com'}])

This adds an email address to what appears to be a complete list of email addresses ever stored in my Sendgrid account. I probably run into this problem because I'm new to using the API, although the documentation is really very bad.

+4
source share
1 answer

Recipients are separate from lists because they can belong to many lists or segments. Before you can add recipients to the list, you need to create recipients. You can do this with a type query POST https://api.sendgrid.com/v3/contactdb/recipients. The response body will contain recipient identifiers. You can find more information in SendGrid Docs .

, , , , .

+3

All Articles