MailChimp Net V3 - Merge Fields not populating. C#

25 Views Asked by At

I am using MailChimp.Net (nuget MailChimp.Net.V3). I'm trying to add a person to a list including first and last name. I have looked over the docs at https://github.com/brandonseydel/MailChimp.Net and what I have seems correct, however, the contact is created, but the merge fields are not added. Here's my code:

var api = new MailChimpManager(apiKey);
var list = await api.Lists.GetAsync(opt.ListId);
if (list == null)
    return;

// add the user to the list
var member = new Member
{
    EmailAddress = email,
    StatusIfNew = Status.Subscribed,
    Status = Status.Subscribed,
    FullName = $"{firstname} {lastname}"                    
};
member.MergeFields.Add("FNAME", firstname);
member.MergeFields.Add("LNAME", lastname);
var res = await api.Members.AddOrUpdateAsync(list.Id, member);

I have verified that list.Id, firstname, lastname are all valid strings. Again, the contact is created in MailChimp, but it only has an email address, not first, last, or full name.

Can anyone help? I feel like I'm messing something very obvious. TIA.

0

There are 0 best solutions below