Webhooks
Get a real-time HTTP notification on your own server whenever a LinkedIn message or InMail arrives. Beginner-friendly guide with examples in Node.js and Python.
What's a webhook?
A webhook is a URL that ConnectSafely calls when something happens — instead of your code having to keep asking "anything new yet?".
When a LinkedIn message lands on one of your connected accounts, ConnectSafely sends an HTTP POST request to a URL you control. The body of that request is JSON that describes the message. You write a small endpoint that receives the POST and does whatever you want with it: store it, reply, ping Slack, hand it to an AI agent.
Status: Webhooks are in Beta. The shape and headers documented here are stable — only new event types may be added.
Why bother?
Without webhooks, you'd have to poll our API every few seconds to see if there's a new message. That's slow, wastes quota, and you'll still miss things.
With a webhook, your code only runs when there's actually something to react to. Common things people build:
- Auto-reply to LinkedIn DMs with an AI assistant
- Route inbound InMail to a Slack channel
- Sync new conversations into a CRM (HubSpot, Salesforce, etc.)
- Trigger downstream automations in n8n, Make.com, or Zapier
Before you start
You'll need:
- An active ConnectSafely API subscription on the LinkedIn account you want events from. Non-API seats can't subscribe to message webhooks.
- A public HTTPS URL that can accept
POSTrequests and reply with2xxin under 15 seconds.
New to this? While developing locally, use ngrok or Cloudflare Tunnel to expose
localhostto the public internet temporarily.
The simplest possible receiver
Here's a Node.js / Express server that just logs every event it gets:
import express from "express";
const app = express();
app.post("/webhook", express.json(), (req, res) => {
console.log("Got event:", req.body.event);
console.log("From:", req.body.data.sender.name);
console.log("Body:", req.body.data.body);
res.sendStatus(200); // <- tell ConnectSafely we got it
});
app.listen(3000, () => console.log("Listening on :3000"));That's it. Not safe for production — anyone who guesses your URL can fake events. We fix that on the Security & auth page. For now, this is enough to see real events flowing.
Quick start
1. Create a webhook in the dashboard
Open the Webhooks dashboard and click Create Webhook:
- Name — anything that helps you find it later in logs (e.g.
Lead → CRM). - URL — your public HTTPS endpoint (the one ngrok / your server gives you).
- Event — pick
message.received. That covers regular DMs and InMail. - LinkedIn account — pick a specific account, or leave blank to subscribe to every account in your workspace.
- (Optional) Auth header — extra security if your endpoint already expects an Authorization header. See Security & auth.
- Save. ConnectSafely shows you a signing secret one time only — copy it now into a password manager or env var. You'll need it to verify incoming events.
2. Send a test event
On the webhook row, click Test. ConnectSafely sends a fake-but-realistic message.received payload to your URL and shows you the status code and round-trip time inline. If you don't get a 200 back, the Logs button on the same row tells you why.
3. Wait for a real message
Send yourself a LinkedIn message from another account. Within a couple of seconds you should see the event hit your endpoint. 🎉
Supported events
| Event | Fires when |
|---|---|
message.received | Someone sent a LinkedIn message or InMail to a connected account |
More events will appear in the dashboard as we ship them.
What to read next
What's in the payload
The fields ConnectSafely sends you and what each one means.
Security & auth
Verify the signature so attackers can't fake events to your endpoint.
Retries & logs
What happens when your endpoint is down, and where to look when something breaks.
Open the dashboard
Create, edit, test, and view delivery logs for your webhooks.
HubSpot Integration - Features
Discover all features available when connecting ConnectSafely with HubSpot. Sync LinkedIn leads, enrich contacts, and automate outreach.
What's in the payload
Beginner-friendly walkthrough of the JSON ConnectSafely sends to your webhook URL — every field explained, with an example you can copy and a tip on deduplicating retries.
