Skip to content
Denne side findes på dansk. Læs på dansk
HeyMySocial
Guides

Connect your CRM by webhook

Create a CRM connection, sign and send a first record, map your statuses, send lead status back to the CRM, and clear reconciliation errors.

20 minutes Updated November 25, 2026

At the end of this guide your CRM, or the automation tool in front of it, sends lead, opportunity and sale changes to HeyMySocial as signed requests, and HeyMySocial can tell it when a lead's status changes here. This is the route that works today for any CRM that can send an HTTPS request; the direct HubSpot and Pipedrive connector is built but switched off. The reference is in CRM webhook, inbound and CRM webhook, outbound.

What you need

  • The right to manage integrations in the workspace (Manager, or owner or admin of the organization).
  • A CRM or automation tool that can send a POST request with a header it computes.
  • curl and openssl, or Node.js, for the first test.

Create the connection

  1. Open Settings, then Connections. Under CRM by webhook press Connect.
  2. Leave CRM by webhook selected (it carries the chip Works today), give it a Name of this connection, for example the name of your CRM, and press Connect the CRM.
  3. The next screen shows two values. Send webhooks to is the inbound address: https://heymysocial.com/crm/ followed by the connection's key. Signing secret begins with hmscrm_.
  4. Copy the secret now. It is shown this once and stored encrypted; nobody can read it back. If you lose it, press Rotate the secret on the connection page: the old one stops working at once.

The key in the address only finds the connection and is not a secret. Only the signature is trusted.

Sign a request

Every request carries the header X-HMS-Signature with two parts: t, the time in Unix seconds, and v1, the HMAC-SHA256 of the text t.body with your signing secret, in lowercase hex. body is the raw request body, byte for byte as you send it.

Put the two values from the screen in HMS_CRM_URL and HMS_CRM_SECRET, then run one of these:

BODY='{"event_id":"evt_1001","type":"lead.updated","external_id":"L-17","updated_at":"2026-11-25T10:00:00Z","data":{"status":"Qualified","name":"Anna Jensen","email":"anna@example.com","company":"Jensen Byg"}}'
T=$(date +%s)
SIG=$(printf '%s.%s' "$T" "$BODY" | openssl dgst -sha256 -hmac "$HMS_CRM_SECRET" | sed 's/^.* //')

curl -sS -X POST "$HMS_CRM_URL" \
  -H "Content-Type: application/json" \
  -H "X-HMS-Signature: t=$T,v1=$SIG" \
  --data-raw "$BODY"
const crypto = require('node:crypto');

const body = JSON.stringify({
  event_id: 'evt_1001',
  type: 'lead.updated',
  external_id: 'L-17',
  updated_at: '2026-11-25T10:00:00Z',
  data: { status: 'Qualified', name: 'Anna Jensen', email: 'anna@example.com', company: 'Jensen Byg' },
});
const t = Math.floor(Date.now() / 1000);
const v1 = crypto.createHmac('sha256', process.env.HMS_CRM_SECRET).update(`${t}.${body}`).digest('hex');

fetch(process.env.HMS_CRM_URL, {
  method: 'POST',
  headers: { 'Content-Type': 'application/json', 'X-HMS-Signature': `t=${t},v1=${v1}` },
  body,
}).then(async (res) => console.log(res.status, await res.text()));

A timestamp more than 5 minutes from the server's clock is refused, so a captured request cannot be replayed later. Sign the body you actually send: if a tool reformats the JSON afterwards, the signature no longer matches.

Send a first record

A record names what changed in the CRM:

  • event_id: your id for this event. The same id twice is answered duplicate and changes nothing.
  • type: contact, lead, opportunity or sale, then .created, .updated, .deleted or .merged. Or send object and action (upsert, delete, merge).
  • external_id: the CRM's own id. Required.
  • updated_at: when it changed in the CRM. For lead status the newest change wins.
  • data: the fields. For a lead: status, reason, contact_external_id, lead_ref, name, email, phone, company, captured_at, first_contacted_at.

Send several records in one request as {"events": [ … ]}. A sale points at its lead:

{
  "event_id": "evt_1002",
  "type": "sale.created",
  "external_id": "S-204",
  "updated_at": "2026-11-25T14:30:00Z",
  "data": { "lead_external_id": "L-17", "amount": 12500, "currency": "DKK", "occurred_at": "2026-11-25T14:30:00Z" }
}

You should get a 200 with one result for each record:

{
  "status": "processed",
  "event_id": "evt_1001",
  "results": [
    { "object": "lead", "external_id": "L-17", "result": "created", "id": "01kb2t6m9q4w8x0y3z5a7c1def" }
  ],
  "request_id": "01KB2T6M7H3J5K8M0N2P4Q6RST"
}

Press Open the connection (later: Settings, Connections, Mapping and reconciliation). The lead is listed under Mapped records. If a lead with the same email was already open here, the CRM record is tied to that lead instead of creating a second one.

Map your statuses and fields

Lead statuses here are new, contacted, qualified, disqualified, opportunity, won and lost. Common CRM words such as open, sales_qualified and closed_won are understood as they are; capitals, spaces and dashes do not matter. The full list is on the connection page under Statuses understood without a mapping.

For anything else, go to Mapping, press Add a status, fill in Status in the CRM and Status here, and press Save the mapping. Field names work the same way under Fields. A mapping applies to records that arrive from then on.

Send lead status back to your CRM

  1. On the connection page, under Send status back, enter the Address that receives status changes. It must be an https address on the public internet.
  2. Tick Send lead status changes to this address and press Save.

From then on a status change made here is posted there, signed with the same secret and header:

{
  "event": "lead.status_changed",
  "lead_id": "01kb2t6m9q4w8x0y3z5a7c1def",
  "external_id": "L-17",
  "status": "won",
  "crm_status": "closed_won",
  "previous_status": "qualified",
  "occurred_at": "2026-11-25T14:31:07+00:00",
  "delivery_id": "01kb2t9a7r2n5p8s1v4x6z0bcd"
}

crm_status is your own word for the status when your mapping has one, in lowercase with underscores, otherwise null. Answer with a 2xx status. Anything else is retried with growing pauses, a limited number of times, and every attempt is in the Delivery log, where Send again retries by hand. A status that just arrived from the CRM is not sent back to it.

Work through reconciliation errors

A record that cannot be applied, or only in part, still gets a 200. Its result carries a detail, with the result error when nothing was applied. It is kept under Reconciliation errors until a person decides, and what was not applied is missing from your results until then.

Detail What happened What to do
unknown_lead A sale or opportunity names a lead this connection has not sent Send the lead first, then the record again
unmapped_status The CRM status has no mapping; the lead keeps its status here Add the status under Mapping
unknown_contact The lead carries no contact details and names an unknown contact Send email or name with the lead
invalid_record No usable external_id, type, or amount and currency Correct the record
merge_review Two CRM records point at one lead here, or were merged in the CRM Check which one to keep

Press Resolve when it is fixed, or Ignore for a record that should stay out.

The file route as a fallback

A webhook that never arrived is not asked for again. On the same connection page, Reconcile from a file takes a CSV export from the CRM with one row for each lead or sale. Choose What the file contains, upload the CSV file and press Reconcile the file. Uploading the same file twice changes nothing. The columns are in CRM files. A CRM that cannot send requests at all can be connected as CRM by file instead.

With an assistant

get_crm_status tells your assistant when something last arrived, how many records are linked, the state of outbound deliveries and the open reconciliation errors. It changes nothing and never returns the secret. The connection, the mapping and the decisions on errors are made in the app.

When it differs

Answer Meaning
401 signature_invalid The header is missing or does not match. Check the secret and that you signed the exact body.
401 timestamp_stale t is more than 5 minutes off. Check the sender's clock.
404 not_found The address is wrong, or the connection was disconnected.
413 or 422 validation_failed The body is too large, is not a JSON object, or holds more than 500 events.
429 More than 600 requests a minute to one address from one sender.
500 server_error Nothing was applied. Send the same event again.

Try it on the demo workspace

A labelled demo workspace is offered when you set up your account, so you can follow this guide before you connect anything real.