I want to use SendinBlue API on my website but I am facing two problems. I want to create a new contact from an email and add this new contact to a contact list on the SendinBlue website. In order to do it, I am following this page https://developers.sendinblue.com/reference/createcontact
First problem: When I am trying to execute the code, an error occured telling me that the key is already in the dictionnary on this line (I obviously replaced "YOUR API KEY" by v3 API Key) :
Configuration.Default.ApiKey.Add("api-key", "YOUR API KEY");
Second problem: After that, when I am addign the new created contact to the API, I have an error on this line telling me that "One or mutliple erros occured" :
CreateUpdateContactModel result = apiInstance.CreateContact(createContact);
Here is my code:
// I replaced "YOUR API KEY" with my private api key
sib_api_v3_sdk.Client.Configuration.Default.ApiKey.Add("api-key", "YOUR API KEY");
var apiInstance = new ContactsApi();
JObject attributes = new JObject();
List<long?> listIds = new List<long?>();
listIds.Add(2);
bool emailBlacklisted = false;
bool smsBlacklisted = false;
bool updateEnable = true;
List<string> smtpBlacklistSender = new List<string>();
try
{
var createContact = new CreateContact(email, attributes, emailBlacklisted,
smsBlacklisted, listIds, updateEnable, smtpBlacklistSender);
CreateUpdateContactModel result = apiInstance.CreateContact(createContact);
Debug.WriteLine(result.ToJson());
Console.WriteLine(result.ToJson());
Console.ReadLine();
}
catch (Exception exc)
{
Debug.WriteLine(exc.Message);
Console.WriteLine(exc.Message);
Console.ReadLine();
}
Does anyone already faced one of this problem ?
Thank you