Adding a contact to a specific list #413
Answered
by
Jericho
davidjnevin
asked this question in
Q&A
-
Hi Jericho, var strongGridClient = new Client(Options.ApiKey);
var contactId = await strongGridClient.Contacts.UpsertAsync(email, firstName, lastName); but I don't know how to pass in my listId eg. 12345678-1234-1234-1234-12345678910 Any help would be greatly appreciated David |
Beta Was this translation helpful? Give feedback.
Answered by
Jericho
Feb 5, 2022
Replies: 1 comment 1 reply
-
Glad you find StrongGrid useful! To answer your question: the 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 ); |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
davidjnevin
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Glad you find StrongGrid useful!
To answer your question: the
UpsertAsync
method accepts a parameters calledlistIds
which allows you to add the contact to one or multiple lists. So your code should look something like this: