Create contact in HubSpot when new user messages your WhatsApp number

Jahnavi Prasad Updated by Jahnavi Prasad

Use case: When someone sends a message to your WhatsApp number for the very first time, automatically create a contact in Hubspot with their Name and Phone Number.

Prerequisites: Create an account with Retool. (Free account is enough if you expect <100,000 Hubspot contacts/ month)

Part 1: Create a Hubspot Private App and API key

  1. Go to your HubSpot Account -> Settings -> Integrations -> Private Apps -> Click 'Create a private app
  2. Under Basic Info, enter a Name -> Under Scopes, enable Read and Write for crm.objects.contacts
  3. Click Create App, copy the API Key/Token and save it in a text editor

Part 2: Create workflow in Retool

  1. Create an https://retool.com/ account. Go to Workflows -> Create New Workflow
  2. Delete everything except the startTrigger. Click on startTrigger and change the Trigger to Webhook.
  3. Click the + icon on the top left and choose Resource Query. Place the Resource Query node beside the startTrigger and connect both of them together.
  4. In the Resource Query node:
    Action type: POST
    URL: https://api.hubapi.com/crm/v3/objects/contacts
    Headers: authorization Bearer <Hubspot token from Part 1>
    Headers: content-type application/json
    Body: Raw
    {
    "properties": {
    "firstname": "{{startTrigger.data.senderName}}",
    "phone": "{{startTrigger.data.waId}}"
    }
    }
  5. Enable the Workflow on the top right and Click Deploy

Part 3: Add the Webhook URL to your WATI account

  1. From the startTrigger node, copy the Example cURL
  2. Paste it into a text editor and extract only the URL
  3. For example, in the below cURL, remove the orange part and keep the green part:
    curl -X POST --url "https://api.retool.com/v1/workflows/a58c1217-325c-4819-8cf0-0f5173d0a695/startTrigger?workflowApiKey=retool_wk_b69000ebf3254e86a5341b69b86f2e3" --data 'null' -H 'Content-Type: application/json'
  4. Go to your WATI Dashboard -> Webhooks -> Add a Webhook
  5. Paste the URL here, set the Status as Enabled, select the event as “New Contact Message”, and Click Save.

That's it. All new users reaching out to your WATI phone number will be added as contacts in your Hubspot account.

How did we do?

HubSpot WhatsApp Integration: Capture New WhatsApp Contacts To HubSpot For Free [Deprecated]

Contact