# Messaging: SMS and email from any agent

Source: https://docs.autessa.com/docs/features/messaging

> Send SMS and email from an AI agent built anywhere, through your company's Autessa numbers and sending setup, with one API call.

# Messaging

Let your agent send a text message or an email with one call. Autessa sends it from your company's phone number or email setup, and keeps a record.

Agents built in Autessa can already send SMS and email with [tools](/docs/tools/phone-sms.md).

## When to use it

- Your agent confirms an appointment or sends a link by text.
- Your agent emails a summary or a receipt after a conversation.
- You want SMS without signing up for a separate carrier account.

## Quickstart

1. [Get a free API key](https://builder.autessa.com/get-api-key). New accounts get $100 of free credits for your first month, no card needed. This developer key works for this feature; see [Keys](/docs/start/keys.md).
2. Set up a [phone number for SMS](/docs/guide/agentic/sms-setup.md) in the Builder.
3. Call the built-in `send_sms` or `send_email` tool.

**curl:**

```bash
curl -X POST https://api.autessa.com/clients/agent-tools/send_sms/invoke \
  -H "Authorization: $AUTESSA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"input": {"to": "+12065550100", "body": "Your appointment is confirmed for 3 PM tomorrow."}}'
```

**Python:**

```python
import os
import requests

res = requests.post(
    "https://api.autessa.com/clients/agent-tools/send_email/invoke",
    headers={"Authorization": os.environ["AUTESSA_API_KEY"]},
    json={"input": {"to": "customer@example.com", "subject": "Your receipt", "body": "Thanks for your order."}},
    timeout=30,
)
print(res.json())  # {"output": ..., "isError": false}
```

**TypeScript:**

```typescript
const res = await fetch("https://api.autessa.com/clients/agent-tools/send_sms/invoke", {
  method: "POST",
  headers: { Authorization: process.env.AUTESSA_API_KEY!, "Content-Type": "application/json" },
  body: JSON.stringify({ input: { to: "+12065550100", body: "Your order has shipped." } }),
});
console.log(await res.json());
```

**Java:**

```java
var body = """
    {"input": {"to": "+12065550100", "body": "Your order has shipped."}}
    """;
var req = java.net.http.HttpRequest.newBuilder(java.net.URI.create(
        "https://api.autessa.com/clients/agent-tools/send_sms/invoke"))
    .header("Authorization", System.getenv("AUTESSA_API_KEY"))
    .header("Content-Type", "application/json")
    .POST(java.net.http.HttpRequest.BodyPublishers.ofString(body))
    .build();
System.out.println(java.net.http.HttpClient.newHttpClient()
    .send(req, java.net.http.HttpResponse.BodyHandlers.ofString()).body());
```

## How it works

| Tool | Input |
| --- | --- |
| `send_sms` | `to` (E.164 number), `body`, optional `from` (defaults to your company's number). |
| `send_email` | `to`, `subject`, `body`, optional `html` (true when `body` is HTML). |

- Messages go through your company's tools, so consent rules and opt-outs you set up still apply. See [SMS consent](/docs/guide/agentic/sms-consent.md).
- When your firewall policy checks tool calls, it checks these too. New email domains can be held for approval.
- The response is `output` plus `isError`.

## Libraries

| Language | Package | Call |
| --- | --- | --- |
| Python | `autessa-messaging` | `Messaging().send_sms(to, body, from_=None)`, `send_email(to, subject, body, html=False)` |
| TypeScript | `@autessa/messaging` | `new Messaging().sendSms({ to, body, from? })`, `sendEmail({ to, subject, body, html? })` |
| Java | `com.autessa:autessa-messaging` | `Messaging.fromEnv().sendSms(to, body)`, `sendEmail(to, subject, body)` |

```python
from autessa.messaging import Messaging

messaging = Messaging()  # reads AUTESSA_API_KEY
messaging.send_sms(to="+12065550100", body="Your appointment is confirmed for 3 PM tomorrow.")
```

Each call takes an optional session ID (`session_id` in Python, `{ sessionId }` in TypeScript) to tie the message to a conversation. If the message tool reports a problem, such as no SMS number set up, the call raises an error with the reason: `AgentToolError` in Python, `ToolError` in TypeScript, `ToolInvocationException` in Java.

The libraries are in private preview and not yet on PyPI, npm, or Maven Central. Install from GitHub as each library's README describes, for example:

```bash
pip install "autessa-core @ git+https://github.com/Autessa-Inc/autessa-python#subdirectory=packages/autessa-core"
pip install "autessa-messaging @ git+https://github.com/Autessa-Inc/autessa-python#subdirectory=packages/autessa-messaging"
```

## Limits

- SMS needs a number with SMS turned on, and US numbers need carrier registration. See [SMS setup](/docs/guide/agentic/sms-setup.md).
- Messages are billed to your company. See [Billing](/docs/guide/company/billing.md).

## API reference

[Agent Tools API](/docs/reference/agent-tools.md)

## Benchmarks

None for messaging. See [Benchmarks](/docs/benchmarks.md).

## Example

- [Spring AI bank assistant](https://github.com/Autessa-Inc/autessa-examples/tree/main/examples/spring-ai-bank-assistant): a Spring AI assistant that can send SMS and email with the built-in tools.
- [Vercel AI chat](https://github.com/Autessa-Inc/autessa-examples/tree/main/examples/vercel-ai-chat): a Next.js chat that sends email with the built-in `send_email` tool.

## Related

- [Agent tools and MCP](/docs/features/agent-tools-mcp.md)
- [Approvals](/docs/features/approvals.md)
- [Phone](/docs/features/phone.md)

