Cara Balas WA Otomatis dengan Integrasi CRM

Tutorial auto reply WhatsApp dengan integrasi CRM. HubSpot, Salesforce, Zoho. Sync data, track leads. Panduan lengkap!

Cara Balas WA Otomatis dengan Integrasi CRM
Cara Balas WA Otomatis dengan Integrasi CRM

CRM + WhatsApp = Complete picture!

Integrasi auto reply dengan CRM membuat semua conversation tersimpan, leads tertrack, dan follow up terautomate.


Kenapa Integrasi CRM?

📊 BENEFITS:

TANPA CRM INTEGRATION:
❌ Chat history hilang
❌ Leads tidak tertrack
❌ Manual input data
❌ No unified view
❌ Miss follow up

DENGAN CRM INTEGRATION:
✅ Semua chat tersimpan
✅ Lead auto-created
✅ Data sync otomatis
✅ 360° customer view
✅ Auto follow up

CRM Options

🗄️ POPULAR CRM:

HUBSPOT:
- Free tier tersedia
- Good API
- Marketing + Sales + Service

SALESFORCE:
- Enterprise standard
- Powerful tapi kompleks
- Mahal

ZOHO CRM:
- Affordable
- Good for SMB
- Lengkap

FRESHSALES:
- Simple & clean
- Good for startups
- Affordable

PIPEDRIVE:
- Sales-focused
- Visual pipeline
- Easy to use

Integrasi HubSpot

Setup Connection:

javascript

const hubspot = require('@hubspot/api-client');

const hubspotClient = new hubspot.Client({
    accessToken: process.env.HUBSPOT_ACCESS_TOKEN
});

// Saat ada pesan masuk dari WhatsApp
async function handleIncomingMessage(from, message, customerName) {
    // Cari atau buat contact
    const contact = await findOrCreateContact(from, customerName);
    
    // Log conversation di HubSpot
    await logConversation(contact.id, message, 'incoming');
    
    // Update last contact date
    await updateContactProperty(contact.id, 'last_whatsapp_contact', new Date());
}

Create/Update Contact:

javascript

async function findOrCreateContact(phone, name) {
    // Search existing contact
    const searchResponse = await hubspotClient.crm.contacts.searchApi.doSearch({
        filterGroups: [{
            filters: [{
                propertyName: 'phone',
                operator: 'EQ',
                value: phone
            }]
        }]
    });
    
    if (searchResponse.results.length > 0) {
        return searchResponse.results[0];
    }
    
    // Create new contact
    const newContact = await hubspotClient.crm.contacts.basicApi.create({
        properties: {
            phone: phone,
            firstname: name,
            lead_source: 'WhatsApp',
            lifecyclestage: 'lead'
        }
    });
    
    return newContact;
}

// Update contact properties
async function updateContactProperty(contactId, property, value) {
    await hubspotClient.crm.contacts.basicApi.update(contactId, {
        properties: {
            [property]: value
        }
    });
}

Log Conversation:

javascript

async function logConversation(contactId, message, direction) {
    // Create engagement/note
    await hubspotClient.crm.objects.notes.basicApi.create({
        properties: {
            hs_timestamp: Date.now(),
            hs_note_body: `[WhatsApp ${direction}] ${message}`
        },
        associations: [{
            to: { id: contactId },
            types: [{
                associationCategory: 'HUBSPOT_DEFINED',
                associationTypeId: 202 // Note to Contact
            }]
        }]
    });
}

Integrasi Zoho CRM

Setup:

javascript

const axios = require('axios');

class ZohoCRM {
    constructor(accessToken, refreshToken) {
        this.accessToken = accessToken;
        this.refreshToken = refreshToken;
        this.baseUrl = 'https://www.zohoapis.com/crm/v2';
    }
    
    async request(method, endpoint, data = null) {
        const response = await axios({
            method,
            url: `${this.baseUrl}${endpoint}`,
            headers: {
                'Authorization': `Zoho-oauthtoken ${this.accessToken}`
            },
            data
        });
        
        return response.data;
    }
    
    async findContact(phone) {
        const response = await this.request('GET', 
            `/Contacts/search?phone=${phone}`
        );
        
        return response.data?.[0] || null;
    }
    
    async createLead(data) {
        const response = await this.request('POST', '/Leads', {
            data: [data]
        });
        
        return response.data[0];
    }
    
    async addNote(module, recordId, noteContent) {
        await this.request('POST', `/Notes`, {
            data: [{
                Note_Title: 'WhatsApp Conversation',
                Note_Content: noteContent,
                Parent_Id: recordId,
                se_module: module
            }]
        });
    }
}

Auto-create Lead:

javascript

const zoho = new ZohoCRM(accessToken, refreshToken);

async function handleWhatsAppLead(from, message, name) {
    // Check if contact exists
    let contact = await zoho.findContact(from);
    
    if (!contact) {
        // Create as Lead
        contact = await zoho.createLead({
            First_Name: name.split(' ')[0],
            Last_Name: name.split(' ').slice(1).join(' ') || '-',
            Phone: from,
            Lead_Source: 'WhatsApp',
            Lead_Status: 'New'
        });
    }
    
    // Add conversation note
    await zoho.addNote('Leads', contact.id, 
        `[WhatsApp] ${message}`
    );
    
    return contact;
}

Sync Data Two-Way

WhatsApp → CRM:

javascript

// Setiap message masuk, sync ke CRM
async function syncToCRM(whatsappMessage) {
    const { from, message, timestamp, customerName } = whatsappMessage;
    
    // Find/create contact
    const contact = await crm.findOrCreateContact(from, customerName);
    
    // Log message
    await crm.logActivity({
        contactId: contact.id,
        type: 'whatsapp_message',
        direction: 'incoming',
        content: message,
        timestamp
    });
    
    // Update contact fields
    await crm.updateContact(contact.id, {
        last_whatsapp_message: timestamp,
        whatsapp_message_count: contact.whatsapp_message_count + 1
    });
    
    // Check for deal/opportunity updates
    await checkAndUpdateDeals(contact.id, message);
}

CRM → WhatsApp:

javascript

// Trigger WhatsApp dari CRM action
// Contoh: Deal stage changed → kirim WA

// HubSpot Webhook handler
app.post('/hubspot/webhook', async (req, res) => {
    const event = req.body[0];
    
    if (event.subscriptionType === 'deal.propertyChange' &&
        event.propertyName === 'dealstage') {
        
        const dealId = event.objectId;
        const newStage = event.propertyValue;
        
        // Get deal dan contact
        const deal = await hubspotClient.crm.deals.basicApi.getById(dealId);
        const contacts = await getAssociatedContacts(dealId);
        
        // Send WhatsApp based on stage
        for (const contact of contacts) {
            const message = getStageMessage(newStage, deal);
            await sendWhatsApp(contact.phone, message);
        }
    }
    
    res.sendStatus(200);
});

function getStageMessage(stage, deal) {
    const messages = {
        'qualifiedtobuy': `Hai! Terima kasih sudah tertarik dengan ${deal.dealname}. Ada yang bisa kami jelaskan lebih lanjut?`,
        'presentationscheduled': `Reminder: Demo ${deal.dealname} dijadwalkan besok. Siap?`,
        'closedwon': `🎉 Selamat! Order ${deal.dealname} sudah dikonfirmasi. Terima kasih!`
    };
    
    return messages[stage] || null;
}

Auto Response from CRM Data

Personalized Response:

javascript

async function generatePersonalizedResponse(from, message) {
    // Get contact dari CRM
    const contact = await crm.findContact(from);
    
    if (!contact) {
        return getDefaultGreeting();
    }
    
    // Get recent activities
    const activities = await crm.getContactActivities(contact.id);
    const recentDeals = await crm.getContactDeals(contact.id);
    
    // Build personalized context
    const context = {
        name: contact.firstname,
        isExistingCustomer: recentDeals.length > 0,
        lastPurchase: recentDeals[0]?.dealname,
        totalSpent: contact.total_spent || 0,
        tier: contact.customer_tier || 'regular'
    };
    
    // Generate response based on context
    return buildResponse(message, context);
}

function buildResponse(message, context) {
    let greeting = `Hai Kak ${context.name}! `;
    
    if (context.tier === 'vip') {
        greeting += '⭐ ';
    }
    
    if (context.isExistingCustomer) {
        greeting += 'Senang bisa melayani lagi! ';
    }
    
    return greeting + 'Ada yang bisa kami bantu?';
}

Pipeline Automation

Auto Move Pipeline Stage:

javascript

// WhatsApp interaction → Update deal stage
async function updateDealFromWhatsApp(contactId, message) {
    const deals = await crm.getContactDeals(contactId, { status: 'open' });
    
    if (deals.length === 0) return;
    
    const deal = deals[0];
    const intent = analyzeIntent(message);
    
    // Auto-progress based on intent
    if (intent === 'interested' && deal.stage === 'new') {
        await crm.updateDeal(deal.id, { stage: 'qualified' });
    }
    
    if (intent === 'wants_demo' && deal.stage === 'qualified') {
        await crm.updateDeal(deal.id, { stage: 'demo_scheduled' });
    }
    
    if (intent === 'ready_to_buy') {
        await crm.updateDeal(deal.id, { stage: 'proposal' });
        // Auto-send proposal
        await sendProposalViaWhatsApp(contactId, deal);
    }
}

function analyzeIntent(message) {
    const lower = message.toLowerCase();
    
    if (lower.includes('tertarik') || lower.includes('mau tau')) {
        return 'interested';
    }
    if (lower.includes('demo') || lower.includes('coba')) {
        return 'wants_demo';
    }
    if (lower.includes('beli') || lower.includes('order') || lower.includes('harga deal')) {
        return 'ready_to_buy';
    }
    
    return 'unknown';
}

Reporting Dashboard

javascript

// Unified reporting: CRM + WhatsApp
async function getUnifiedReport(startDate, endDate) {
    // WhatsApp metrics
    const waMetrics = await getWhatsAppMetrics(startDate, endDate);
    
    // CRM metrics
    const crmMetrics = await crm.getMetrics(startDate, endDate);
    
    // Combined analysis
    return {
        conversations: {
            total: waMetrics.totalConversations,
            avgResponseTime: waMetrics.avgResponseTime,
            botResolved: waMetrics.botResolved
        },
        leads: {
            fromWhatsApp: crmMetrics.leadsFromWhatsApp,
            converted: crmMetrics.convertedLeads,
            conversionRate: crmMetrics.conversionRate
        },
        revenue: {
            fromWhatsApp: crmMetrics.revenueFromWhatsApp,
            avgDealSize: crmMetrics.avgDealSize
        }
    };
}

Best Practices

DO ✅

- Sync semua conversations
- Auto-create leads
- Track attribution
- Bidirectional sync
- Use CRM data for personalization
- Regular data cleanup

DON'T ❌

- Manual data entry
- Ignore CRM updates
- One-way sync only
- Generic responses
- Duplicate contacts
- Stale data

FAQ

CRM mana yang paling mudah diintegrasikan?

HubSpot karena free tier dan API documentation bagus.

Perlu developer untuk integrasi?

Untuk custom, ya. Tapi banyak no-code tools (Zapier, Make) yang bisa.

Data privacy gimana?

Pastikan comply GDPR jika ada customer EU. Encrypt sensitive data.


Kesimpulan

CRM integration = Complete customer view!

Tanpa CRMDengan CRM
Scattered dataUnified view
Manual trackingAuto tracking
Miss follow upsAuto follow ups
No insightsData-driven

Integrasi CRM Sekarang →


Artikel Terkait