Skip to content

Adding a contact to a specific list #413

Answered by Jericho
davidjnevin asked this question in Q&A
Discussion options

You must be logged in to vote

Glad you find StrongGrid useful!

To answer your question: the UpsertAsync method accepts a parameters called listIds which allows you to add the contact to one or multiple lists. So your code should look something like this:

var listIds = new[]
{
     "12345678-1234-1234-1234-12345678910",
    ... feel free to add more ids if you want to add your contact to more than one list ...
};
var strongGridClient = new Client(Options.ApiKey);
var contactId = await strongGridClient.Contacts.UpsertAsync(email, firstName, lastName, listIds: listIds );

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@davidjnevin
Comment options

Answer selected by davidjnevin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants