AgentPhone

SMS, MMS, iMessage, and voice adapter for Chat SDK. Receive inbound messages and call transcripts via webhooks, send replies, and react to iMessages.

Vendor-official adapter maintained by AgentPhone, not Vercel or Chat SDK contributors. For feature requests, bug reports, and support, file an issue on the adapter's repo.

Install

pnpm add @agentphone/chat-sdk-adapter chat

Quick start

lib/bot.ts
import { Chat } from "chat";
import { MemoryStateAdapter } from "@chat-adapter/state-memory";
import { createAgentPhoneAdapter } from "@agentphone/chat-sdk-adapter";

const agentphone = createAgentPhoneAdapter({
  // apiKey: "...",          // or set AGENTPHONE_API_KEY
  // agentId: "agent_...",   // or set AGENTPHONE_AGENT_ID
  // webhookSecret: "whsec_...", // or set AGENTPHONE_WEBHOOK_SECRET
});

const chat = new Chat({
  userName: "my-bot",
  adapters: { agentphone },
  state: new MemoryStateAdapter(),
});

// Handles SMS, MMS, iMessage, and voice call transcripts
chat.onNewMention(async (thread, message) => {
  await thread.subscribe();
  await thread.post(`Got your message: ${message.text}`);
});

chat.onSubscribedMessage(async (thread, message) => {
  await thread.post(`Reply: ${message.text}`);
});

Point your AgentPhone webhook to your server's webhook endpoint. The adapter verifies HMAC-SHA256 signatures and routes events into the Chat SDK handler pipeline.

Configuration

Prop

Type

Environment variables

VariableDescription
AGENTPHONE_API_KEYAgentPhone API key. Overridden by config.apiKey.
AGENTPHONE_AGENT_IDAgent ID. Overridden by config.agentId.
AGENTPHONE_WEBHOOK_SECRETWebhook signing secret. Overridden by config.webhookSecret.

Channels

AgentPhone routes four channels through a single adapter:

ChannelSendReceiveMediaReactions
SMSYesYes----
MMSYesYesYes--
iMessageYesYesYesYes
Voice--Transcripts----

All inbound messages (SMS, MMS, iMessage) arrive as onNewMention or onSubscribedMessage events. Voice calls arrive as messages containing the full transcript and summary when the call ends.

iMessage reactions

AgentPhone is the only Chat SDK adapter that supports iMessage tapback reactions:

// Send a tapback reaction to a message
await chat.adapters.agentphone.addReaction(threadId, messageId, "love");

Supported tapbacks: love, like, dislike, laugh, emphasize, question. Custom emoji reactions (e.g. 🔥) are supported on newer devices.

Inbound reactions from users fire the onReaction handler.

Voice call transcripts

When a voice call ends, AgentPhone delivers the full transcript as a message:

chat.onNewMention(async (thread, message) => {
  if (message.raw.callId) {
    // This is a voice call transcript
    console.log("Call summary:", message.raw.summary);
    console.log("Transcript:", message.raw.transcript);
    console.log("Duration:", message.raw.durationSeconds, "seconds");
  }
});

Webhook events

The adapter handles three event types:

EventDescription
agent.messageInbound SMS, MMS, or iMessage
agent.call_endedVoice call completed with transcript
agent.reactioniMessage tapback reaction

All webhooks are signed with HMAC-SHA256 and include replay protection via a 5-minute timestamp window.

Limitations

SMS and voice have inherent platform constraints:

  • editMessage / deleteMessage -- not supported (SMS is fire-and-forget)
  • removeReaction -- not supported
  • startTyping -- no-op (no typing indicators in SMS)
  • streaming -- not supported

Feature support

Messaging

FeatureSupported
Post message
Edit message
Delete message
File uploadsMMS and iMessage
Streaming
Scheduled messages

Rich content

FeatureSupported
Card format
Buttons
Link buttons
Select menus
Tables
Fields
Images in cards
Modals

Conversations

FeatureSupported
Slash commands
Mentions
Add reactionsiMessage only
Remove reactions
Typing indicator
DMs
Ephemeral messages
User lookup
Parent subject
Native client
Custom API endpoint

Message history

FeatureSupported
Fetch messages
Fetch single message
Fetch thread info
Fetch channel messages
List threads
Fetch channel info
Post channel message

On this page