Lead - Register / AutoLogin [code]

Mandatory (MUST HAVE) Parameters:
password (String),
name (String),
email (String),
source_id (Integer as String),

Optional Parameters:

phone (String),
description (String),
username (String) (if not passed it will contain passed email by default),
country (String) (iso2 format) (for example "UA" - Ukraine) (country can be defined by phone),
website (String),
tags (String) (if you need tags more then 1 you have to divide it with "," for example "tag1,tag2")

Custom fields:

You can also use Custom fields as optional parameters
To do so - just add key-value pair to your POST data, where Custom field slug is the key and your data - is the value


REGISTER method -> client will fill your form -> your form will POST to https://{{crm_system.com}}/nanza/webhooks/register ->
client will be automatically redirected to the platform after sign up to CRM as lead and to platform as Client.


PHP EXAMPLE:

<?php

$curl = curl_init();

curl_setopt_array($curlarray(
  CURLOPT_URL => 'https://{{crm_system.com}}/nanza/webhooks/register',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => 'username=user%40email.com&source_id=19&email=user%40email.com&name=USER_FULL_NAME&password=USER_PASSWORD',
  CURLOPT_HTTPHEADER => array(
    'authtoken: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyIjoiZ2FwdHJhZGVfYWZmMSIsIm5hbWUiOiJHYXBUcmFkZSIsIkFQSV9USU1FIjoxNjM5NTcyMzk1fQ.mdTZhumtFzVGgPkYZ6GAiGfKvu1ekmYOt23DWZUTWv8',
    'Content-Type: application/x-www-form-urlencoded'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
?>

CURL EXAMPLE:

curl --location --request POST 'https://{{crm_system.com}}/nanza/webhooks/register' \
--header 'authtoken: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyIjoiZ2FwdHJhZGVfYWZmMSIsIm5hbWUiOiJHYXBUcmFkZSIsIkFQSV9USU1FIjoxNjM5NTcyMzk1fQ.mdTZhumtFzVGgPkYZ6GAiGfKvu1ekmYOt23DWZUTWv8' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'username=user@email.com' \
--data-urlencode 'source_id=19' \
--data-urlencode 'email=user@email.com' \
--data-urlencode 'name=USER_FULL_NAME' \
--data-urlencode 'password=USER PASSWORD'


Response:
{
    "success":"test@test.com had been successfully
    registered",
    "autologin_link":"http://app.cn.loc/app/modules/nz-user/src/actions/get_login.php?token=cng4TzU1aU0zZmJ1d2dTMXlvZ1RvZz09",
    "lead_id":25105
}

{"error":"Lead with email test@gmail.com already exists!"}

Did you find this article useful?

 
0 Console 0.0921 s Load Time 2.97 MB Memory Used 50 Queries Database 0 Eloquent Illuminate\Database vars & Config 469 Files