Skip to main content
osky
Import Your B2B Database into SendPulse CRM and Fire It from Your WhatsApp Bot

Import Your B2B Database into SendPulse CRM and Fire It from Your WhatsApp Bot

SendPulse just shipped bulk company import directly inside the Contacts → Companies section of its CRM. For anyone managing a B2B database of hundreds or thousands of leads, this changes the workflow entirely: no more entering companies one by one, no complex integrations just to get data in. You import it, clean it, and hook it to your WhatsApp bot in a single afternoon. This tutorial walks you through the whole process with real code and zero fluff.

Flujo de datos desde CSV hasta bot de WhatsApp


Prerequisites

Before touching any button, confirm you have the following:

  • Active SendPulse account with CRM module access (Standard plan or higher).
  • WhatsApp bot configured in SendPulse or connected via API (verified number in Meta Business).
  • Your B2B database exported as CSV or XLSX from your previous platform (HubSpot, Zoho, Salesforce, whatever).
  • Access to the SendPulse API — you need client_id and client_secret from your panel under Settings → API.
  • Node.js 20+ or Python 3.11+ if you plan to automate message dispatch after import.

Step 1: Prepare Your CSV for Import

SendPulse expects specific columns. A malformed CSV will throw silent errors where it imports 0 records and gives you no indication why. Use this minimum schema:

company_name,phone,email,website,industry,city,country,notes
Example Company SA,+525512345678,contact@!zilch!example.com,example.com,Telecommunications,CDMX,Mexico,Q3 prospect
Northern Distributor,+528112345678,sales@!zilch!distnorte.mx,distnorte.mx,Distribution,Monterrey,Mexico,Met at trade show

Rules that actually matter in production:

  • The phone field must include the country code with +. Without it, the bot cannot match the contact.
  • company_name is mandatory. Without a name, the record is silently discarded.
  • Encoding: UTF-8 without BOM. If you export from Excel on Windows, explicitly save as "CSV UTF-8" or you will see broken characters in names with special characters.
  • Recommended maximum per batch: 5,000 records. Larger batches work, but if it fails midway you won't know where it stopped.

Step 2: Run the Import in the Dashboard

  1. Go to Contacts → Companies in your SendPulse dashboard.
  2. Click the Import button (top right corner).
  3. Upload your CSV or XLSX file.
  4. In the column mapping step, make sure phone maps to "Phone" and not to a custom field — that is what the bot uses to identify the contact.
  5. Select whether you want to update existing records or only add new ones. For an initial migration, enable "update if exists" to avoid duplicates.
  6. Confirm and wait. For 1,000 records the process takes under 2 minutes.

Step 3: Get Your API Token and Validate Access

curl -X POST https://api.sendpulse.com/oauth/access_token \
  -H "Content-Type: application/json" \
  -d '{
    "grant_type": "client_credentials",
    "client_id": "YOUR_CLIENT_ID",
    "client_secret": "YOUR_CLIENT_SECRET"
  }'

Save the access_token from the response. It expires in 3,600 seconds — in production implement automatic refresh, do not hardcode it.


Step 4: Query Imported Companies via API

Before firing any messages, verify the import came through clean:

// Node.js 20+
const fetch = (await import('node-fetch')).default;

const TOKEN = process.env.SENDPULSE_TOKEN;

async function getCompanies(page = 1, limit = 100) {
  const res = await fetch(
    `https://api.sendpulse.com/crm/v1/companies?page=${page}&limit=${limit}`,
    {
      headers: {
        Authorization: `Bearer ${TOKEN}`,
        'Content-Type': 'application/json',
      },
    }
  );
  const data = await res.json();
  return data;
}

const companies = await getCompanies();
console.log(`Total companies: ${companies.total}`);
console.log('First company:', companies.data[0]);

If total matches your CSV row count, you are good. If there is a discrepancy, check the import log in the dashboard — SendPulse keeps a report of rejected rows.


Step 5: Connect Companies to Your WhatsApp Bot

This is where it gets interesting. Each company has a phone field. When that number messages you on WhatsApp, SendPulse can automatically match it if you have "Link bot contact with CRM" enabled in the bot settings. But if you want to fire the first message yourself (outbound), you need to use the bulk send endpoint:

# Python 3.11+
import os, requests

TOKEN = os.getenv("SENDPULSE_TOKEN")
BOT_ID = os.getenv("SENDPULSE_BOT_ID")  # Found in Bots → Your Bot → Settings

def send_whatsapp_template(phone: str, template_id: str, variables: dict):
    payload = {
        "bot_id": BOT_ID,
        "phone": phone,
        "template_id": template_id,
        "variables": variables
    }
    r = requests.post(
        "https://api.sendpulse.com/whatsapp/contacts/sendByPhone",
        headers={"Authorization": f"Bearer {TOKEN}"},
        json=payload
    )
    return r.json()

# Example: fire to all imported companies
companies = get_companies_python()  # Your query function
for company in companies["data"]:
    phone = company.get("phone")
    if phone:
        result = send_whatsapp_template(
            phone=phone,
            template_id="YOUR_TEMPLATE_ID",  # Meta-approved template
            variables={"1": company["name"], "2": "May 2026"}
        )
        print(f"{phone}: {result.get('result')}")

Critical warning: you can only send outbound messages using Meta-approved templates. If you send free-form text to a number that has not messaged you in the last 24 hours, the message will not be delivered and you will accumulate penalties on your number. No shortcuts here.


Step 6: Automate with a Post-Import Bot Flow

Inside the SendPulse flow editor, create a flow that triggers when a company receives a specific tag (for example, imported_may_2026). This way follow-up is automatic:

  1. Trigger: Tag assigned = imported_may_2026
  2. Action 1: Send B2B welcome template
  3. Wait: 2 days
  4. Condition: Did they reply? → Yes: move to "Active Prospect" pipeline / No: send second follow-up template
  5. Final action: Assign to account executive via CRM

To assign the tag in bulk via API after import:

curl -X POST https://api.sendpulse.com/crm/v1/companies/bulk-tag \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"tag": "imported_may_2026", "company_ids": [101, 102, 103]}'

Production Warnings Nobody Tells You

  • Rate limits: the SendPulse API allows roughly 10 requests/second. If you have 5,000 companies and send one by one with no delay, you will start getting 429 errors around record 300. Implement a 150ms sleep between calls.
  • Invalid phone numbers: any phone without a country code or in local format (e.g., 5512345678 without +52) will fail silently during send. Validate with a library like libphonenumber before importing.
  • Duplicates by phone: SendPulse does not deduplicate companies by phone, only by email. You can end up with two different company records sharing the same number. Filter your CSV beforehand.
  • Templates under review: Meta can take up to 24 hours to approve a new template. Do not leave this for launch day.

Expected Result

When you finish this flow you have: your complete B2B database inside SendPulse CRM, each company linkable to WhatsApp conversations, and a bot that handles first contact and follow-up without your team touching a keyboard. That is real B2B automation, not the fairy tale they sell you in webinars.