I would like to know how to insert data into a list, createcontact (), now I can insert the email to a certain list but, I want to upload more data besides the email, data such as name, phone, etc ... are custom fields that append in the web platform. I was investigating the attributes value when creating contact but when inserting it must be of type object, I do not understand what object or how? Could you help me?
require_once ('./ autoload.php');
// Configure API key authorization: api-key
SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer');
$api_instance = new SendinBlue\Client\Api\ContactsApi();
$createContact = new \SendinBlue\Client\Model\CreateContact(); // \SendinBlue\Client\Model\CreateContact | Values to create a contact
$createContact['email'] = '[email protected]';
$createContact['attributes'] = array("NOMBRE"=>"contacto contacto", "SMS"=>"9998887772", "PERFIL"=>"ALGO");
$createContact['listIds'] = array(7);
try {
$result = $api_instance->createContact($createContact);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling ContactsApi->createContact: ', $e->getMessage(), PHP_EOL;
}