API Reference - Add Leads and Contacts

This guide explains how to programmatically add leads and contacts to your SandeshAI account. The API allows seamless integration with your CRM, website, or other systems for efficiently managing your contact database.


Prerequisites

Before using this API, ensure the following are set up:

1. Generate an API Key

  1. Log in to your dashboard here.
  2. Navigate to Settings > API Keys.
  3. Click Generate API Key, save the key securely.
  4. Use this key in the apiKey field of the request.

POSThttps://api.sandeshai.com/whatsapp/contact/api/

API Endpoint

Use this endpoint to add contacts to your SandeshAI account.

Request Payload

Required Fields

  • Name
    apiKey
    Type
    string
    Description

    Your unique API key for authentication. Obtainable from your SandeshAI dashboard under Settings > API Key.

  • Name
    contactName
    Type
    string
    Description

    Full name of the contact.

  • Name
    whatsappNumber
    Type
    string
    Description

    Contact's WhatsApp number, including the country code. Example: 917805076045.

Optional Fields

  • Name
    attributes
    Type
    object
    Description

    Key-value pairs of custom attributes associated with the contact. Example: {"Source": "Instagram", "City": "Mumbai", "Age": "25"}.

Request Example

POST
/whatsapp/contact/api/
import requests

url = "https://api.sandeshai.com/whatsapp/contact/api/"
data = {
    "apiKey": "your_api_key_here",
    "contactName": "Rishabh Gupta",
    "whatsappNumber": "917805076045",
    "attributes": {"Source": "Instagram", "City": "Mumbai", "Age": "25"} # Optional
}
response = requests.post(url, json=data)
print(response.json())

Success Response: 201 Created

{
  "msg": "Contact created successfully!"
}

Duplicate Response: 200 OK

{
  "msg": "Contact already exists."
}

Error Response: 500 Internal Server Error

{
  "msg": "An error occurred: <error_details>"
}

Notes

  1. If the contact already exists ( based on whatsappNumber ), the API will return 200 OK with the message “Contact already exists.”.
  2. Custom attributes ( attributes ) do not have to be predefined in the system. The API will create them if they don’t exist.
  3. If the contact already exists, any new attributes provided will be added to the contact, and existing attributes with the same key will be updated with the new values.
  4. Ensure the whatsappNumber is valid, including the country code.
  5. An inactive or invalid API key will return a 401 Unauthorized error.

Feel free to reach out to SandeshAI Support if you have further questions or need assistance!

Was this page helpful?