Lead Capture Integration
Integrating lead capture functionality into your website allows for seamless collection of lead data through Rechat's API. This guide provides step-by-step instructions and a sample code snippet to facilitate this process.
Requirements
Before proceeding, ensure you have:
URL Endpoint: Contact Rechat's support team to obtain your unique endpoint URL. sample: https://api.rechat.com/leads/channels/dc8bf004-6897-1231-bd0f-8837b426602a/webhook
Web Page: A web page where the lead capture form will be hosted.
Basic Knowledge: Familiarity with HTML and JavaScript
To obtain your URL endpoint, contact our support team.
Data Structure
The Rechat API accepts lead data in JSON, XML (LTS format), or URL-encoded formats. For this example, we'll use a JSON payload with the following potential fields:
first_name:
stringlast_name:
stringemail:
stringphone_number:
stringtag:
string[]lead_source:
stringnote:
stringaddress:
stringreferer_url:
stringlisting_number:
stringagent_emails:
string[]source_type:
string (required)
Note: All fields are optional with this exception of source_type
, which must be specified.
HTML Form Setup
Create a form on your webpage. This form should include input fields corresponding to the data structure provided by Rechat.
Example HTML form:
JavaScript for Form Submission
Use JavaScript to handle form submission and send data to the Rechat API.
Example JavaScript code:
Server-Side Considerations
If your website requires additional server-side processing or if you prefer to keep API keys confidential, you may want to handle the API request on the server side. In this case, modify your server's endpoint to accept form submissions and forward the data to Rechat's API.
Last updated