> ## Documentation Index
> Fetch the complete documentation index at: https://docs.automate.ax/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Automate.ax automations are TypeScript programs.
> Use Bun for installation and command examples.
> Use Automate.ax for the product name and automate.ax for the package, CLI, and domain.
> Treat documented public APIs as current; do not invent transitional or deprecated names.

# Open direct message

> Open or resume a one-to-one Slack direct message.

`openDirectMessage` resolves the DM conversation for one Slack member. Use it
before sending a direct message when you only have the person's Slack user ID.

## Example

```ts automations/open-slack-dm.automation.ts theme={null}
import { automation } from "automate.ax"
import { openDirectMessage } from "automate.ax/slack"

export default automation("Open Slack DM", () => {
  openDirectMessage({ userId: "U01234567" })
})
```

## Inputs

| Input             | Type                                             | Required | Default         | Description                                       |
| ----------------- | ------------------------------------------------ | -------- | --------------- | ------------------------------------------------- |
| `userId`          | `string`                                         | Yes      | —               | Slack user ID of the other participant.           |
| `preventCreation` | `boolean`                                        | No       | `false`         | Fails rather than creating a DM when none exists. |
| `account`         | `string \| IntegrationAccountReference<"slack">` | No       | Project default | Slack workspace binding.                          |

## Output

Returns `{ alreadyOpen: boolean; conversation: SlackConversation }`. Pass
`conversation.id` to `sendMessage`. With `preventCreation`, Slack can reject the
request if the two users have no existing DM.
