# st.sendMessage

> The API Reference is also the SDK and CLI reference. Consecutive code fences marked `tab=HTTP`, `tab=Node`, `tab=Python` and `tab=CLI` are the same call on each surface (a fence marked `tab=HTTP,CLI` is the same text for both), and a block between `:::surface <names>` and `:::` applies only to the surfaces it names. Identifiers in the text are written as in Node and in HTTP JSON (camelCase); the Python SDK spells methods, parameters and result attributes in snake_case (`sendMessage` → `send_message`, `reconnectionLink` → `reconnection_link`), while names inside HTTP JSON stay camelCase.

This action allows you to send a message to a person.

:::surface node,python
In the SDK this is the `sendMessage` method. It takes the parameters below except `label` and `then`, which exist only in workflow JSON. It returns no `data`: a failed action comes back in `errors`, with one of the error types below.

The SDK also takes `manageConversation`: it runs [`st.manageConversation`](/docs/action-st-manage-conversation) on the same conversation right after the message is sent, so no `threadId` is needed for it.
:::

:::surface cli
In the CLI this is `linkedin message send` – the command is below, under [Parameters](#parameters).
:::

## Constraints

> ⏺️ **Root Start:** allowed, when `personUrl` or `threadId` parameter is provided.

> ⬆️ **Parent Actions:** [st.openPersonPage](/docs/action-st-open-person-page).

> ⬇️ **Child Actions:** [st.manageConversation](/docs/action-st-manage-conversation).

## Parameters

```json tab=HTTP
{
  "actionType": "st.sendMessage",
  "label": "person1",
  "personUrl": "https://www.linkedin.com/in/person1",
  "text": "Hi! I'd love to connect and discuss some ideas.",
  "then": {
    "actionType": "st.manageConversation",
    "operation": "archive"
  }
}
```

```typescript tab=Node
const workflow = await linkedapi.sendMessage.execute({
  personUrl: "https://www.linkedin.com/in/person1",
  text: "Hi! I'd love to connect and discuss some ideas.",
  manageConversation: { operation: "archive" }
});

const { errors } = await linkedapi.sendMessage.result(workflow.workflowId);
```

```python tab=Python
from linkedapi import SendMessageParams

workflow = linkedapi.send_message.execute(
    SendMessageParams(
        person_url="https://www.linkedin.com/in/person1",
        text="Hi! I'd love to connect and discuss some ideas.",
        manage_conversation={"operation": "archive"},
    )
)

result = linkedapi.send_message.result(workflow.workflow_id)
```

```bash tab=CLI
linkedin message send \
  https://www.linkedin.com/in/person1 \
  "Hi! I'd love to connect and discuss some ideas." \
  --manage archive
```

In AI assistants, the MCP server runs this action as the `send_message` tool.

:::surface cli
In the CLI this is `linkedin message send`:

```bash
linkedin message send <person-url> <text>
```

| Arg | Required | Description |
| --- | --- | --- |
| `person-url` | conditional | LinkedIn profile URL of the recipient. Optional when `--thread-id` is provided |
| `text` | yes | Message text (up to 1900 characters) |

| Flag | Type | Description |
| --- | --- | --- |
| `--thread-id` | string | Reply into an existing conversation thread instead of passing `person-url` |
| `--manage` | string | Manage the conversation right after sending, acting on the same thread. One of `archive`, `unarchive`, `star`, `unstar`, `mute`, `unmute` |
:::

- `label` (optional) – custom label for tracking this action in workflow completion.
- `personUrl` (required for root start unless `threadId` is provided, forbidden for parent start) – [public or hashed](/faq/what-are-hashed-url-and-public-url) LinkedIn URL of the person you want to send a message to.
- `threadId` (optional) – identifier of an existing conversation thread to reply into, as returned by [inbox polling](/docs/monitoring-inbox), or read from the address bar of an open conversation — the `<id>` in `linkedin.com/messaging/thread/<id>`. Provide either `personUrl` or `threadId`; if both are given, `threadId` takes precedence.
- `text` – message text, must be up to **1900** characters.
- `then` (optional) – object or array of child actions to be executed within this action. Only [st.manageConversation](/docs/action-st-manage-conversation) is allowed as a child, and it acts on the conversation this message was sent into, so its `threadId` must be omitted — only `operation` is provided.

> 💡 Replying by `threadId` sends the message directly into a known conversation, which is convenient when reacting to an inbox event without resolving the person's profile URL first.

## Result options

1. **Successful message sending:**

```json
{
  "actionType": "st.sendMessage",
  "label": "person1",
  "success": true,
  "data": {
    "then": { ... }
  }
}
```

- `label` – included only if specified in the action parameters.
- `data.then` – included only when child actions are provided; contains the results of their execution.

2. **Failed message sending:**

```json
{
  "actionType": "st.sendMessage",
  "label": "person1",
  "success": false,
  "error": {
    "type": "personNotFound",
    "message": "The provided URL is not an existing LinkedIn person."
  }
}
```

- `label` – included only if specified in the action parameters.
- `error.type` – enum with the following possible values:
  - `personNotFound` – provided URL is not an existing LinkedIn person.
  - `personLikelyChangedPublicUrl` – the provided URL no longer opens, but this person appeared in your account's [network events](/docs/monitoring-network) before, so they most likely changed their public URL. Retry with their [hashed URL](/faq/what-are-hashed-url-and-public-url).
  - `selfProfileNotAllowed` – action cannot be performed on your own profile.
  - `messagingNotAllowed` – sending a message to the person is not allowed. This could happen for several reasons:
    - You are not connected to the person.
    - LinkedIn has restricted your ability to send messages to the person, for example, due to reaching message limits or the person’s privacy settings.
