Skip to main content
This guide sends a DM from one of your connected accounts to a lead, then reads the reply.

Before you start

  • A connected X or LinkedIn account in your workspace.
  • A lead list with at least one lead.
  • An API key. See Authentication.
Save the key in your terminal so the commands below can use it:

Send your first DM

1

Pick the account to send from

List your connected accounts:
Keep the id of an account whose status is connected:
2

Pick a lead

List your lead lists, then the leads in one of them:
Keep the id of a lead on the same network as your account.
3

Find or start the conversation

Keep conversation.conversationId. If you have never messaged this person, ReachHunt creates a draft that becomes a real conversation when you send the first message.Check canSend before you send. When it is false, blockedReason says why, such as peer_unreachable.
4

Send the message

URL-encode the conversation ID in the path. X conversation IDs contain :, which becomes %3A. The response has the new messageId.
5

Read the reply

Messages come newest first. fromMe is false on the messages the lead sent.
Instead of checking for replies, add a webhook for message.received. ReachHunt sends each new message to your server as it arrives.

Next steps

Core concepts

How accounts, conversations, leads and campaigns fit together.

Receiving webhooks

Get replies and other events on your server.

Errors

What each status code and message means.

Rate limits

How much each account can send.