Connection - Lead Generating
π Connection β Lead Generating Message Sequence (LinkedIn Only)
This flow describes how to generate leads using Salesflow API through LinkedIn by automating:
-
Sending a connection request
-
Detecting when the connection is accepted
-
Sending follow-up messages
-
Receiving replies
-
Marking a lead
Prerequisites
-
Ensure the LinkedIn account is onboarded via the iFrame flow.
-
You have a valid
X-AccountId
header for all API requests. -
Webhooks for New Connection and New Message are configured.
High-Level Flow
-
Send the connection request (with or without a note).
π https://salesflow.apidocumentation.com/documentation/messaging-chats/send-connection-request -
Detect acceptance of the invite.
π https://salesflow.apidocumentation.com/documentation/webhooks-triggers/new-connection -
Deliver the first message based on how you sent the invite:
-
Invite without a message: send a regular follow-up. If no conversation exists, create one.
π https://salesflow.apidocumentation.com/documentation/messaging-chats/send-regular-message-follow-up (Create a new conversation) -
Invite with a message: first sync to get the
conversationId
, then send to the existing conversation.-
Prefer Inbox Sync (walks newest β down to your last stored date).
-
Note: Specific Conversation Sync currently returns the entire thread; use it only if you actually need full history.
π Sync: https://salesflow.apidocumentation.com/documentation/messaging-chats/sync-inbox-or-specific-conversation
π Send: https://salesflow.apidocumentation.com/documentation/messaging-chats/send-regular-message-follow-up (Send to an existing conversation)
-
-
-
(Recommended) Sync again to refresh the thread and track replies.
π https://salesflow.apidocumentation.com/documentation/messaging-chats/sync-inbox-or-specific-conversation
Step-by-Step
1) Send the connection request
Choose with/without note.
π https://salesflow.apidocumentation.com/documentation/messaging-chats/send-connection-request
Notes
-
Use an idempotency key on your side to avoid duplicates.
-
Respect daily limits (see LinkedIn Limits).
2) Detect acceptance
Handle the New Connection webhook in your backend.
π https://salesflow.apidocumentation.com/documentation/webhooks-triggers/new-connection
Youβll know:
-
The newly connected profile IDs/metadata.
-
Itβs OK to proceed to messaging.
3) First message (branch)
A) Invite was sent without a message
Send a regular follow-up. If thereβs no conversation yet, create one.
π https://salesflow.apidocumentation.com/documentation/messaging-chats/send-regular-message-follow-up
B) Invite was sent with a message
Run a Sync to get the conversationId
, then send to the existing conversation.
-
Prefer Inbox Sync (newest β down to your last stored date) to discover the conversation efficiently.
-
Note: Specific Conversation Sync returns the full thread; call it only if you need the entire history (heavier operation).
π Sync: https://salesflow.apidocumentation.com/documentation/messaging-chats/sync-inbox-or-specific-conversation
π Send to existing conversation: https://salesflow.apidocumentation.com/documentation/messaging-chats/send-regular-message-follow-up
4) Keep state fresh
After sending, sync again (newest β down to your last stored date) to update message state and detect replies.
π https://salesflow.apidocumentation.com/documentation/messaging-chats/sync-inbox-or-specific-conversation
Sync Best Practices (important)
Inbox Sync
-
Runs top-down: starts from the newest conversations/messages and continues backward in time until the βlast processed dateβ you provide.
-
Store your last processed timestamp (UTC) per account (optionally per conversation). Example:
{ "lastSyncedAtUtc": "2025-08-12T10:15:00Z" }
-
On each sync request, include this timestamp as your βuntilβ value (see request fields on the Sync page).
-
Use a small overlap window for safety (e.g.,
until = lastSyncedAtUtc - 1β2 minutes
). -
Update your marker only after sync finished to avoid missing late arrivals.
Specific Conversation Sync
-
Currently returns the entire conversation (from the first message to the latest).
-
Thereβs no partial windowing by date for this call.
-
Use it sparingly (e.g., initial hydration after acceptance with a note, or when you truly need full history).
-
For ongoing updates and UI refreshes prefer Inbox Sync; on your side, dedupe by the last seen message ID/timestamp.
Typical Timeline (example)
-
T0 β Send connection request (with/without note).
-
T+? β Receive New Connection webhook.
-
Then:
-
If no note: send follow-up (create conversation if needed).
-
If with note: Inbox Sync (newest β until last stored date) β get
conversationId
β send to existing conversation.
(Use Specific Conversation Sync only if full history is required.)
-
-
T+5β10 min: Inbox Sync again to refresh message state; repeat as needed.
Common Pitfalls & Fixes
-
Expecting a partial window for Specific Conversation Sync.
Not supported now β it always returns the full thread; use Inbox Sync for incremental updates. -
No
conversationId
after acceptance.
Expected for invites without a note β use the create new conversation flow. -
Missing replies.
Schedule periodic Inbox Syncs and track your last sync timestamp with a small overlap.