When someone fills in a form on your website, your server can create a client in Estactics straight away.

What you need

  • An API key with the clients.MANAGE permission.
  • A marketing campaign, if you want to see which campaign each lead came from. Its code is the campaignCode.

Send the lead

Call Create a client from your server, never from the browser:

curl --request POST \
  --url http://localhost:4000/api/clients/create \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "firstName": "Alex",
    "lastName": "Morgan",
    "email": "alex.morgan@example.com",
    "phone": "+35799123456",
    "campaignCode": "x7Kq2p",
    "utmSource": "facebook",
    "throwErrorOnClientExists": false,
    "form": { "budget": "Up to 500,000" }
  }'

The response contains the id of the client.

Phone numbers

Send the phone in international format, such as +35799123456, and Estactics works out the country. For a number with no dial code, also send phoneDefaultCountry.

When the person already exists

Each email and phone can only belong to one client in your organization. By default, a second sign-up returns an error.

Set throwErrorOnClientExists to false to accept it instead. What happens next depends on your duplicate settings, which you can read and change with Update client settings.

Who gets the lead

With a campaignCode, the client goes to the team and agent set on that campaign. Without one, send assignedToHierarchyId to choose the team.