Dial

Give your Chat SDK bot a phone number. Send and receive SMS, MMS, and iMessage, and receive inbound voice-call transcripts, through HMAC-signed webhooks without channel-specific handlers.

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

Create a new bot

Scaffold a Next.js bot with the Dial adapter using create-chat-sdk:

pnpm create chat-sdk@latest my-bot --adapter dial memory -y

The generated app uses the Memory state adapter for local development. To add the adapter to an existing app, start at Install.

Install

pnpm add @getdial/chat-sdk-adapter chat @chat-adapter/state-memory

The adapter is ESM-only, requires Node 18 or later, and has a peer dependency on chat ^4.20.0. For production, use a persistent state adapter such as @chat-adapter/state-redis instead of in-memory state.

Quick start

lib/bot.ts
import { Chat } from "chat";
import { createMemoryState } from "@chat-adapter/state-memory";
import { createDialAdapter } from "@getdial/chat-sdk-adapter";

export const bot = new Chat({
  userName: "mybot",
  state: createMemoryState(),
  adapters: {
    dial: createDialAdapter({
      apiKey: process.env.DIAL_API_KEY,
      fromNumberId: process.env.DIAL_FROM_NUMBER_ID,
      webhookSecret: process.env.DIAL_WEBHOOK_SECRET,
    }),
  },
});

bot.onNewMention(async (thread, message) => {
  await thread.post(`heard you: ${message.text}`);
});

The same onNewMention handler that answers Slack, Teams, or Discord messages fires for phone traffic to your Dial number. thread.post sends replies back over the same channel.

Bind the webhook in whichever HTTP framework you use. The adapter works in any framework Chat SDK supports:

// e.g. Next.js route handler
export async function POST(req: Request) {
  return bot.webhooks.dial(req);
}

Configuration

PropTypeDescription
apiKey?string
Dial API key (`sk_live_…`). Mint from the Dial dashboard. Falls back to `DIAL_API_KEY`.
fromNumberId?string
Dial's ID of the phone number the bot sends from. Copy from the Phone Numbers page in the Dial dashboard, or `dial number list --json`. Falls back to `DIAL_FROM_NUMBER_ID`.
webhookSecret?string
HMAC-SHA256 signing secret Dial issued when you created the webhook subscription. When set, incoming requests are verified against `X-Dial-Signature` and rejected `401` on mismatch. Falls back to `DIAL_WEBHOOK_SECRET`.
apiBaseUrl?string
Override the Dial API host. Defaults to `https://api.getdial.ai`. Falls back to `DIAL_API_URL`.
botName?string
Display name Chat SDK uses for the bot. Defaults to `"bot"`. Falls back to `BOT_USERNAME`.
logger?Logger
Chat SDK `Logger` instance. Defaults to `ConsoleLogger("info").child("dial")`.

Environment variables

VariableRequiredDescription
DIAL_API_KEYYesDial API key (sk_live_…). Used when apiKey isn't set.
DIAL_FROM_NUMBER_IDYesDial's ID of the phone number the bot sends from. Used when fromNumberId isn't set.
DIAL_WEBHOOK_SECRETNoWebhook signing secret (whsec_…). When set, the adapter verifies incoming requests. Used when webhookSecret isn't set.
DIAL_API_URLNoDial API host. Defaults to https://api.getdial.ai. Used when apiBaseUrl isn't set.
BOT_USERNAMENoBot display name. Defaults to "bot". Used when botName isn't set.

Webhooks

Point a Dial webhook subscription at the endpoint you handed to bot.webhooks.dial. Create the subscription from the Dial dashboard's Webhooks page or over the API:

curl -X POST https://api.getdial.ai/api/v1/webhooks \
  -H "Authorization: Bearer $DIAL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "targetUrl": "https://your-bot.example.com/webhook/dial", "eventTypes": ["*"] }'

Set DIAL_WEBHOOK_SECRET to the whsec_… secret returned when you create the subscription. See the Dial Webhooks reference for the signature format, retries, and delivery semantics.

Signature verification

When webhookSecret is set, every request must carry:

X-Dial-Signature: t=<unix_seconds>,v1=<hex-hmac-sha256(secret, `${t}.${rawBody}`)>

The adapter recomputes the HMAC with Node's crypto.createHmac and compares it with timingSafeEqual, the same HMAC-SHA256 primitive Dial's server signs with. It rejects timestamps older than 5 minutes to prevent replayed requests, and answers 401 on any mismatch.

Channels

DirectionChannelTextMedia
InboundSMSYes—
InboundMMSYesYes (image / video / audio / file)
InboundiMessageYesYes
InboundVoice callYes (as transcript)—
OutboundSMS / MMS / iMessageYesYes (via attachment URLs)

Inbound SMS, MMS, and iMessage messages become Chat SDK messages, with any media as attachments. Outbound sends go through the official @getdial/sdk Node SDK.

A voice call surfaces through the call.transcribed event. The adapter fetches the transcript with @getdial/sdk.getCall() and forwards it as a message on the caller's thread.

Thread IDs

A Chat SDK thread is a pair of phone numbers, your Dial-owned number and the peer's, encoded as:

dial:{yourDialNumber}:{peerNumber}

Every distinct pair is a distinct thread. Chat SDK's per-thread state (subscriptions, locks, conversation memory) is scoped to the pair, so concurrent conversations don't leak into each other. Subscriptions, handlers, posts, and per-thread state work the same as with any other adapter.

Feature support

Messaging

FeatureSupported
Post message
Message replies
Edit message
Delete message
File uploadsMMS & iMessage media
Streaming
Scheduled messages

Rich content

FeatureSupported
Card format
Buttons
Link buttons
Select menus
TablesFlattened to ASCII code blocks
Charts
Fields
Images in cards
Modals

Conversations

FeatureSupported
Slash commands
MentionsDMs only; every phone pair is 1:1
Add reactionsNative Tapbacks on iMessage, both directions; emoji delivered as text on SMS
Remove reactions
Typing indicatoriMessage numbers only; silently ignored on SMS
Mark as read
Message edit events
Message delete events
DMs
Ephemeral messages
User lookup
Parent subject
Native client
Custom API endpointapiBaseUrl override

Message history

FeatureSupported
Fetch messagesBackfills from the account's 100 most recent messages; no pagination
Fetch single message
Fetch thread info
Fetch channel messages
List threads
Fetch channel info
Post channel message

Resources

On this page