> ## 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.

# Create scheduled message

> Schedule a manual or AI-generated CloseBot lead message.

`closeBot.createScheduledMessage` schedules a message for a future time.

```ts automations/schedule-closebot-message.automation.ts theme={null}
import { automation, onDashboardRun } from "automate.ax"
import { closeBot } from "automate.ax/closebot"

export default automation("Schedule CloseBot message", () => {
  onDashboardRun({ title: "Schedule CloseBot message" })

  closeBot.createScheduledMessage({
    leadId: "lead-id",
    kind: "manual",
    body: "Checking in after your consultation",
    sendAt: new Date("2026-09-10T16:00:00Z"),
  })
})
```

## Inputs

Provide `leadId`, `kind` (`manual` or `ai`), and `sendAt`. Manual messages require `body`; AI messages generate their body at send time. Optional `cancelOnReply` defaults in CloseBot to `false` for manual messages and `true` for AI messages.

## Output

Returns the scheduled message.
