Webhooks & APIOutbound
Shared Types
Payload interfaces and enums used across outbound webhook events
Every outbound event's data is composed of these building blocks. Each event page links back here for the full type definitions.
ChatPayload
interface ChatPayload {
id: string; // Wexio chat id
integrationId?: string; // Owning messaging integration (Telegram bot, WhatsApp number, etc.)
channel?: WebhookChannel; // "WHATSAPP" | "TELEGRAM" | "VIBER" | "INSTAGRAM"
externalChatId?: string; // Provider-side chat id (WhatsApp chat, Telegram chat)
whatsappId?: string; // Derived from the contact; present when channel=WHATSAPP
telegramId?: string; // Telegram user id as string
viberId?: string; // Viber user id
instagramId?: string; // Instagram user id
firstName?: string;
lastName?: string;
photoUrl?: string;
username?: string;
title?: string; // Group/channel title
createdAt?: string; // ISO-8601 UTC
updatedAt?: string; // ISO-8601 UTC
archivedAt?: string | null; // ISO-8601 UTC, or null if not archived
}channel is inferred from the contact's channel-specific ID (whatsappId, telegramId, viberUserId, instagramUserId). Absent only when the chat lacks identifying channel info.
Slim variant — chat.deleted and message.*.deleted events carry only:
Pick<ChatPayload, "id" | "integrationId" | "channel">ContactPayload
interface ContactPayload {
peopleId: string; // Wexio People record id (always present)
phoneNumber?: string;
email?: string;
firstName?: string;
lastName?: string;
tags?: string[];
systemFields?: Record<string, string | number | boolean | null>;
customFields?: Record<string, string | number | boolean | null>;
createdAt?: string; // ISO-8601 UTC
updatedAt?: string; // ISO-8601 UTC
}Slim variant — contact.deleted events carry only { peopleId: string }.
MessagePayload
interface MessagePayload {
id: string; // Wexio message id
chatId: string; // Wexio chat id
integrationId?: string;
direction: "INBOUND" | "OUTBOUND";
type: MessageType; // see enum below
text?: string; // Plain text, or media caption
media?: MessageMediaItem[]; // For media/media-group types
receivedAt?: string; // Present on inbound
sentAt?: string; // Present on outbound
deliveredAt?: string; // When the provider confirmed delivery
readAt?: string; // When the contact read it
failedAt?: string; // On permanent failure
errorCode?: string;
errorMessage?: string;
raw?: { // Channel-specific provider IDs
providerMessageId?: string; // e.g. Telegram message_id, WhatsApp wamid
[k: string]: unknown;
};
}
interface MessageMediaItem {
url: string; // Resolvable URL to fetch the media
type?: MediaType; // see enum below
mimeType?: string;
filename?: string;
sizeBytes?: number;
caption?: string;
}Slim variant — message.*.deleted events carry only:
Pick<MessagePayload, "id" | "chatId" | "direction" | "type">Enums
type WebhookChannel = "WHATSAPP" | "TELEGRAM" | "VIBER" | "INSTAGRAM";
type MessageDirection = "INBOUND" | "OUTBOUND";
enum MessageType {
TEXT = "TEXT",
BUTTONS = "BUTTONS",
MEDIA = "MEDIA",
MEDIA_BUTTONS = "MEDIA_BUTTONS",
MEDIA_GROUP = "MEDIA_GROUP",
LOCATION = "LOCATION",
POOL = "POOL", // (sic — poll)
CONTACT = "CONTACT",
PIN = "PIN",
GAME = "GAME",
DICE = "DICE", // Telegram animated emoji
CHAT_UPDATE = "CHAT_UPDATE",
STORY = "STORY",
UNKNOWN = "UNKNOWN",
// WhatsApp-specific
LIST = "LIST",
TEMPLATE = "TEMPLATE",
CALLBACK = "CALLBACK",
CTA_URL = "CTA_URL",
LOCATION_REQUEST = "LOCATION_REQUEST",
// System messages (flow started/completed, assignment changed, etc.)
SYSTEM = "SYSTEM",
}
enum MediaType {
PHOTO = "photo",
VIDEO = "video",
VIDEO_NOTE = "video_note",
DOCUMENT = "document",
AUDIO = "audio",
VOICE = "voice",
ANIMATION = "animation",
STICKER = "sticker",
}Related
- Envelope & Delivery — the wrapping envelope that carries these payloads
- Outbound Webhooks — overview and the full event catalogue