Authentication
All requests to CleverApp's Sales Automation API must be authenticated using an API key. You can obtain your API key by visiting the API settings section of your CleverApp account.
About the API Key
The API key consists of a series of characters, including letters (both uppercase and lowercase) and numbers.
It may also include special characters such as dots (.) or underscores (_), depending on the service provider's formatting.
API keys are typically long to enhance security and reduce the likelihood of brute-force attacks.
Endpoints
Lead Capture Endpoint
Endpoint: /api/leads
Method: POST
Description: Capture a new lead by providing relevant information such as name, email, and source.
Request Parameters:
name (string): The name of the lead.
email (string): The email address of the lead.
source (string): The source from which the lead was captured (e.g., website, email campaign).
Example Request
{ "name": "John Doe", "email": "john@example.com", "source": "Website Form" }
Example Response
{ "id": "123456789", "name": "John Doe", "email": "john@example.com", "source": "Website Form", "timestamp": "2024-04-08T12:00:00Z" }
Follow-up Email Endpoint
Endpoint: /api/follow-up
Method: POST
Description: Send a follow-up email to a lead.
Request Parameters:
lead_id (string): The ID of the lead to whom the follow-up email will be sent.
subject (string): The subject of the email.
body (string): The body content of the email.
Example Request
{ "lead_id": "123456789", "subject": "Follow-up Email", "body": "Hi John, thank you for your interest in our product. Please let me know if you have any questions." }
Example Response
{ "message": "Follow-up email sent successfully to lead with ID: 123456789" }
Update Lead Information
Endpoint: /api/leads/{lead_id}
Method: PUT
Description: Update the information of a specific lead in CleverApp's database.
Request Parameters:
lead_id (string, required): The unique identifier of the lead whose information will be updated.
name (string): The updated name of the lead.
email (string): The updated email address of the lead.
phone (string): The updated phone number of the lead.
status (string): The updated status of the lead (e.g., "Qualified", "Contacted").
Example Request
{ "name": "Jane Smith", "email": "jane@example.com", "phone": "+1234567890", "status": "Qualified" }
Example Response
{ "id": "123456789", "name": "Jane Smith", "email": "jane@example.com", "phone": "+1234567890", "status": "Qualified", "timestamp": "2024-04-08T12:00:00Z" }
Error Handling
When interacting with CleverApp's Sales Automation API, it's important to handle errors gracefully to ensure smooth integration with your application. The API follows standard HTTP status codes for indicating the outcome of a request. Below are the possible error scenarios along with their corresponding HTTP status codes and descriptive error messages.
Error Codes
400 Bad Request
Description: The request is malformed or missing required parameters.
Error Message: "Bad Request: The request is missing required parameters or contains invalid data."
401 Unauthorized
Description: Authentication credentials are missing or invalid.
Error Message: "Unauthorized: Authentication credentials are missing or invalid. Please provide a valid API key."
403 Forbidden
Description: The authenticated user does not have permission to access the requested resource.
Error Message: "Forbidden: You do not have permission to access the requested resource."
404 Not Found
Description: The requested resource does not exist.
Error Message: "Not Found: The requested resource could not be found."
5xx Server Error
Description: An internal server error occurred while processing the request.
Error Message: "Internal Server Error: An unexpected error occurred while processing your request. Please try again later."