# Text the caller from an ElevenLabs agent

Source: https://jointextkit.com/integrations/elevenlabs-agents
Index: https://jointextkit.com/llms.txt

Give an ElevenLabs agent a webhook tool that texts the caller a link, an
address or a confirmation through TextKit while they are still on the phone.

## How it works

The tool is one HTTP request to `POST https://api.jointextkit.com/v1/messages`. ElevenLabs fills
`to` with `system__caller_id`, the caller's number, when the tool runs. The agent
writes only `body`, the text itself. So the agent can text the person on the
call and nobody else, and you never have to read a phone number out loud or
trust the agent to copy one correctly.

The request carries your key in an `Authorization: Bearer` header, stored on
the ElevenLabs side. TextKit answers with the message (`id`, `status`), which
the agent can use to say "Sent."

## 1. Store the key as a secret

In the tool's headers you will add `Authorization` with the header type set
to **Secret**. Click **Create New Secret** and paste the whole header value,
`Bearer ssms_sk_test_...`, including the word `Bearer` and the space.

## 2. Add the webhook tool

In your agent's settings, on the Agent section, choose **Add Tool** and pick
**Webhook**:

| Field | Value |
|---|---|
| Name | `text_caller` |
| Description | Text the caller a link, an address or a confirmation. Use only after the caller agrees to get a text. |
| Method | `POST` |
| URL | `https://api.jointextkit.com/v1/messages` |
| Headers | `Authorization`, type Secret, the secret from step 1 |
| Content type | JSON (the default) |

Add two body parameters:

| Identifier | Type | Value type | Value |
|---|---|---|---|
| `to` | string | Dynamic variable | `system__caller_id` |
| `body` | string | LLM Prompt | "The full text to send, under 300 characters, with the link or details the caller asked for." |

`system__caller_id` is a system variable ElevenLabs fills with the caller's
phone number. Because it is bound to the tool parameter, it resolves when the
tool runs and the agent never handles it.

## 3. Tell the agent when to use it

Add this to the agent's system prompt:

```text
When the caller asks for a link, an address or a confirmation in writing,
offer to text it to the number they are calling from. If they say yes, call
text_caller with the full text, under 300 characters, and say "Sent." when it
returns. Never read the caller's number back to them.
```

## Test it in the sandbox

Use a test key (`ssms_sk_test_...`) from the [API keys](/console) page and
verify your own cell under Settings in the console. Then call your agent from
that phone and ask for the text. A test key delivers to your verified phone
for real (up to 10 a day, ending "- via TextKit sandbox"); a call from any
other phone is simulated, and the message shows in the console's log tagged
`Test · simulated`. Browser and web test calls have no caller number, so test
with a real phone call.

## Before you go live

- Swap in a live key (`ssms_sk_live_`) and [buy a number](/docs/numbers);
  with one number on the account, `from` is optional.
  [Register your use case](/docs/compliance) so carriers accept the texts.
- Have the agent offer the text and send it only after the caller says yes.
  STOP and HELP replies are handled for you ([opt-out](/docs/opt-out)).
- [Quiet hours](/docs/compliance-checks#quiet-hours) apply: a text sent
  during a call after 9pm in the caller's local time is held until 8am, unless
  it is a one-time code.
- US and Canadian numbers only. A send to any other number is refused, and the
  agent gets the error back in the tool result.

## Sources

- [ElevenLabs: Webhook tools](https://elevenlabs.io/docs/eleven-agents/customization/tools/webhook-tools)
- [ElevenLabs: Dynamic variables](https://elevenlabs.io/docs/eleven-agents/customization/personalization/dynamic-variables)
- [ElevenLabs: Cal.com integration (Bearer secrets)](https://elevenlabs.io/docs/eleven-agents/customization/integrations/calcom)
