Skip to main content

Send your first message

This tutorial walks you through sending your first DM using the Inbox API. You’ll learn the core workflow: authenticate, find an account, locate or create a thread, and send a message.
Before starting, make sure you have an API token. See the Authentication guide to get one.

Prerequisites

Set your API token as an environment variable:

Step 1: Verify authentication

Confirm your API token works by fetching your team information:
Response:
Account links are X accounts connected to your team. You need one to send messages:
Response:

Step 3: Find or create a thread

Option A: Lookup an existing thread

If you know the prospect’s X user ID:

Option B: Create a new thread

Creating a thread doesn’t send a message. Use the messages endpoint to send a DM.

Step 4: Send a message

Replying to contacts who have already messaged you works on all plans. Sending the first message to a new contact requires the Outbound Messages addon on a paid plan. See Working with messages for details.
Response:

Complete example

Quick send alternative

For one-off messages, quick send combines thread lookup/creation and sending in one request:
Response:
Use quick send for simple scenarios. For more control over thread management, use the standard create/lookup + send workflow.

Next steps

Core concepts

Understand threads, prospects, and the data model

Managing threads

Learn thread operations and filtering

Working with prospects

Manage prospect data and context

Rate limits

Understand API limits