π§βπΌ Integrate a CRM Workflow with WhatsApp
This tutorial guides you through integrating a CRM system with Lipachat to allow operators to respond to WhatsApp messages in real time. It includes logic for handling both 24-hour session replies and template-based messages.
πͺ Step 1: Set Up Webhook
Set your webhook endpoint in the Lipachat Dashboard β Settings. This allows Lipachat to notify your CRM when a customer sends a WhatsApp message.
Example:
https://yourcrm.com/api/whatsapp-webhook
When a message is received, a POST request will be made to this URL with the message details.
π₯ Step 2: Receive and Display Incoming Messages
Display the message in your CRMβs chat interface and associate it with the appropriate customer profile.
π§ Step 3: Determine Session Status
Check whether the 24-hour session window is still valid. If the current timestamp is beforesession_expires_at, respond with a free-form message. Otherwise, use a pre-approved template.
Session expires at should hold the timestamp of the last message time + 24 hours.
E.g., if a customer's last message is 27th May 2025 9.00 am, the 'session_expires_at' will be 28th May 2025 9.00 am
π Step 4A: Respond Within 24-Hour Session (Free Form)