Create Lead
Create New Lead Endpoint
Summary
This endpoint allows you to create a new lead in the CRM system.
HTTP Method
POST
API Endpoint
https://app.metocrm.com/api/third-parties-api-gateway/v1/custom/webhooks/lead-import
Authentication
- Use
Webhooktype private key. - Include the
api-keyin the header.
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| customer_name | string | Yes | Customer's name |
| customer_email | string | Conditional | Customer's email, required if no phone provided |
| customer_phone | string | Conditional | Customer's phone number, required if no email provided |
| notes | array | No | Additional notes |
| language_code | string | No | Language code, e.g., 'en' for English |
| advertisement_channel_code | string | No | Advertisement channel code |
| advertisement_code | string | No | Specific advertisement code |
| patient_status_code | string | No | Patient status code |
| salegroup_id | integer | No | Sale group ID |
Example Requests
Curl
curl --location 'https://app.metocrm.com/api/third-parties-api-gateway/v1/custom/webhooks/lead-import' \
--header 'api-key: {private-key}' \
--form 'customer_name="Jane Smith"' \
--form 'customer_email="[email protected]"' \
--form 'customer_phone="444"' \
--form 'language_code="es"' \
--form 'advertisement_channel_code="social_media"' \
--form 'advertisement_code="new-code"' \
--form 'salegroup_id="27"' \
--form 'notes[0][title]="Note 1 title"' \
--form 'notes[0][value]="Note 1 Value"' \
--form 'notes[1][title]="Note 2 title"' \
--form 'notes[1][value]="Note 2 Value"' \
--form 'notes[]="New Client"' \
--form 'patient_status_code="active"'
JavaScript
const axios = require("axios");
axios({
method: "post",
url: "https://app.metocrm.com/api/third-parties-api-gateway/v1/custom/webhooks/lead-import",
headers: {
"api-key": "{private-key}"
},
data: {
customer_name: "Jane Smith",
customer_email: "[email protected]",
customer_phone: "444",
language_code: "es",
advertisement_channel_code: "social_media",
advertisement_code: "new-code",
salegroup_id: "27",
notes: [{"title": "Note 1 Title", "value": "note 1 value"}, {"title": "Note 2 Title", "value": "note 2 value"}],
patient_status_code: "active"
}
});
PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.metocrm.com/api/third-parties-api-gateway/v1/custom/webhooks/lead-import",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => ["api-key: {private-key}"],
CURLOPT_POSTFIELDS => [
"customer_name" => "Jane Smith",
"customer_email" => "[email protected]",
"customer_phone" => "444",
"language_code" => "es",
"advertisement_channel_code" => "social_media",
"advertisement_code" => "new-code",
"salegroup_id" => "27",
"notes" => [{"title" : "Note 1 Title", "value" : "note 1 value" }, {"title" : "Note 2 Title", "value" : "note 2 value" }],
"patient_status_code" => "active"
]
]);
$response = curl_exec($curl);
curl_close($curl);
?>
Response Format
- JSON
Responses
Success
- Status Code: 201
- Message: "lead created successfully!"
- Data: Detailed lead information.
Error
- Status Code: 401
- Message: "Api Key is invalid!"
Example JSON Success Response
{
"status": 201,
"message": "lead created successfully!",
"data": {
"customer_name": "Jane Smith"
// ...
// Rest of the fields
// ...
}
}