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

# Write your first automation

> Build, deploy, and invoke an HTTP-triggered TypeScript automation.

In this guide, you will build an automation that receives an HTTP request and emails your organization members.

## Create a project

Create an empty directory, sign in, and initialize an Automate.ax project:

```bash theme={null}
mkdir hello-automate
cd hello-automate
bunx automate.ax login
bunx automate.ax init
```

Select or create a project when prompted. The command installs `automate.ax`, creates `automate.config.ts`, and adds an example at `automations/example.automation.ts`.

## Write the automation

Replace the example with this program:

```ts automations/example.automation.ts theme={null}
import { automation, onHttpRequest, sendEmail, t } from "automate.ax"

export default automation("Send an email from an HTTP request", () => {
  const request = onHttpRequest()

  sendEmail({
    subject: "Hello from Automate.ax",
    text: t`Received a ${request.method} request at ${request.path}.`,
    to: "*",
  })
})
```

This file contains the three parts of an automation:

* `automation` defines the program and its description.
* `onHttpRequest` declares the trigger that starts a run.
* `sendEmail` declares the action that performs work.

The trigger returns a [signal](/concepts/signals), a typed reference to data that will exist when a request arrives. The `t` template preserves the signal dependency inside the email body, so the action waits for the request data before it runs.

Keep side effects inside actions. The automation callback composes durable work synchronously, so do not `await` triggers or actions.

## Deploy the project

Deploy every `*.automation.ts` file beneath `automate.config.ts`:

```bash theme={null}
bunx automate.ax deploy
```

The CLI plans the automation, publishes the project, and prints the URL for the HTTP trigger. It also records deployment details in `.automate/deployment.md`.

## Invoke the automation

Send a request to the deployed trigger URL:

```bash theme={null}
curl YOUR_TRIGGER_URL
```

The endpoint accepts the work immediately, and the automation emails every member of the project's organization with the request method and path.

## Continue building

* Learn how [automations](/concepts/automations), [triggers](/concepts/triggers), [actions](/concepts/actions), and [signals](/concepts/signals) work together.
* [Use multiple accounts from the same service](/guides/use-multiple-accounts) when a project needs separate identities.
* [Call an external API with a custom action](/guides/call-an-external-api) when the packaged actions do not cover your use case.
