AgentPhone
SMS, MMS, iMessage, and voice adapter for Chat SDK. Receive inbound messages and call transcripts via webhooks, send replies, and react to iMessages.
Create a new bot
Scaffold a Next.js bot with the AgentPhone adapter using create-chat-sdk:
pnpm create chat-sdk@latest my-bot --adapter agentphone memory -yThe generated app uses the Memory state adapter for local development. To add the adapter to an existing app, start at Install.
Install
pnpm add @agentphone/chat-sdk-adapter chatQuick start
Then create the webhook route:
Point your AgentPhone webhook at this route's deployed URL, and set AGENTPHONE_WEBHOOK_SECRET so the adapter can verify each request. See Webhooks.
Configuration
| Prop | Type | Description |
|---|---|---|
apiKey? | string | AgentPhone API key. Required. Auto-detected from `AGENTPHONE_API_KEY`. |
agentId? | string | Agent ID to send messages from. Required. Auto-detected from `AGENTPHONE_AGENT_ID`. |
webhookSecret? | string | Webhook signing secret. When set, the adapter verifies each request's signature and timestamp. Auto-detected from `AGENTPHONE_WEBHOOK_SECRET`. |
apiUrl? | string | API base URL. Defaults to `https://api.agentphone.ai`. |
userName? | string | Bot display name. Auto-detected from `BOT_USERNAME`. Defaults to `bot`. |
Environment variables
| Variable | Required | Description |
|---|---|---|
AGENTPHONE_API_KEY | Yes | AgentPhone API key. Overridden by config.apiKey. |
AGENTPHONE_AGENT_ID | Yes | Agent ID. Overridden by config.agentId. |
AGENTPHONE_WEBHOOK_SECRET | For webhook verification | Webhook signing secret. Overridden by config.webhookSecret. |
Webhooks
The adapter handles three webhook event types:
| Event | Description |
|---|---|
agent.message | Inbound SMS, MMS, or iMessage |
agent.call_ended | Voice call completed with transcript |
agent.reaction | iMessage tapback reaction |
AgentPhone signs each webhook with HMAC-SHA256. Copy the signing secret from your AgentPhone webhook configuration into AGENTPHONE_WEBHOOK_SECRET. With a secret set, the adapter returns 401 for a request with a missing or invalid signature, or with a timestamp outside a 5-minute window, which blocks replayed deliveries.
Without a signing secret, the adapter accepts unsigned requests. Set one before you expose the route publicly.
Channels
One adapter handles all four AgentPhone channels:
| Channel | Send | Receive | Media | Reactions |
|---|---|---|---|---|
| SMS | Yes | Yes | -- | -- |
| MMS | Yes | Yes | Yes | -- |
| iMessage | Yes | Yes | Yes | Yes |
| Voice | -- | Transcripts | -- | -- |
Inbound SMS, MMS, and iMessage messages arrive as onNewMention or onSubscribedMessage events. A voice call arrives as a message containing the full transcript and summary after the call ends.
iMessage reactions
Send an iMessage tapback with addReaction:
Supported tapbacks: love, like, dislike, laugh, emphasize, question. Newer devices also accept custom emoji reactions such as 🔥.
When a user reacts to a message, the adapter fires your onReaction handler.
Voice call transcripts
When a voice call ends, AgentPhone delivers the full transcript as a message. Check message.raw.callId to tell a transcript apart from a text message:
Limitations
SMS and voice constrain what the adapter can do:
editMessageanddeleteMessagearen't supported, because an SMS can't be changed after it's sent.removeReactionisn't supported.startTypingis a no-op, because SMS has no typing indicator.- Streaming isn't supported.
Feature support
Messaging
| Feature | Supported |
|---|---|
| Post message | |
| Message replies | |
| Edit message | |
| Delete message | |
| File uploads | MMS and iMessage |
| Streaming | |
| Scheduled messages |
Rich content
| Feature | Supported |
|---|---|
| Card format | |
| Buttons | |
| Link buttons | |
| Select menus | |
| Tables | |
| Charts | |
| Fields | |
| Images in cards | |
| Modals |
Conversations
| Feature | Supported |
|---|---|
| Slash commands | |
| Mentions | |
| Add reactions | iMessage only |
| Remove reactions | |
| Typing indicator | |
| Mark as read | |
| Message edit events | |
| Message delete events | |
| DMs | |
| Ephemeral messages | |
| User lookup | |
| Parent subject | |
| Native client | |
| Custom API endpoint |
Message history
| Feature | Supported |
|---|---|
| Fetch messages | |
| Fetch single message | |
| Fetch thread info | |
| Fetch channel messages | |
| List threads | |
| Fetch channel info | |
| Post channel message |