Can’t add new contacts by programmatically

To Create contact please use this API: https://developers.fluentcrm.com/global-functions/contact-api-function/

$contactApi = FluentCrmApi('contacts');

/*
* Update/Insert a contact
* You can create or update a contact in a single call
*/

$data = [
'first_name' => 'Jhon',
'last_name' => 'Doe',
'email' => '[email protected]', // requied
'status' => 'pending',
'tags' => [1,2,3, 'Dynamic Tag'], // tag ids/slugs/title as an array
'lists' => [4, 'Dynamic List'] // list ids/slugs/title as an array,
'detach_tags' => [6, 'another_tag'] // tag ids/slugs/title as an array,
'detach_lists' => [10, 'list_slug'] // list ids/slugs/title as an array,
'custom_values' => [
'custom_field_slug_1' => 'custom_field_value_1',
'custom_field_slug_2' => 'custom_field_value_2',
]
];

$contact = $contactApi->createOrUpdate($data);

// send a double opt-in email if the status is pending
if($contact && $contact->status == 'pending') {
$contact->sendDoubleOptinEmail();
}

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer