The Basics
Wire a gateway
Pick a platform adapter, point it at your function. Messages arrive normalized — your handler never knows which platform sent them.
wireGateway({
name: 'whatsapp',
type: 'webhook',
route: '/webhooks/whatsapp',
adapter: whatsAppAdapter,
func: handleMessage,
})
const handleMessage = pikkuFunc({
func: async ({ database, logger }, { senderId, text }) => {
logger.info(`Message from ${senderId}: ${text}`)
await database.saveMessage(senderId, text)
return { text: `Got it! You said: ${text}` }
}
})
Normalized messages
Every platform delivers the same GatewayInboundMessage — senderId, text, attachments
Auto-send responses
Return an outbound message and Pikku sends it via the adapter automatically
Same middleware
Auth, permissions, rate limiting — everything you already use carries over
Transport Types
Three ways to connect
Webhook, WebSocket, or listener — pick the transport that matches your platform. The handler function stays the same.
Webhook
Platform POSTs to you. Auto-registers POST and GET routes. Handles verification challenges (WhatsApp, Slack, Telegram).
wireGateway({
name: 'slack',
type: 'webhook',
route: '/webhooks/slack',
adapter: slackAdapter,
func: handleMessage,
})
WebSocket
Client connects via WebSocket. Uses Pikku's Channel wiring internally. Ideal for web chat widgets.
wireGateway({
name: 'webchat',
type: 'websocket',
route: '/chat',
adapter: webChatAdapter,
func: handleMessage,
})
Listener
Standalone event loop with no HTTP routes. For platforms that need a persistent connection — Baileys, Signal CLI, Matrix.
wireGateway({
name: 'signal',
type: 'listener',
adapter: signalAdapter,
func: handleMessage,
})
Features
Adapters, verification, context
Everything you need to integrate with messaging platforms — without platform-specific boilerplate.
Platform adapters
Each platform gets a simple adapter: parse inbound, send outbound. Swap adapters without touching your handler.
Auto-verification
Webhook verification challenges handled automatically — WhatsApp GET challenges, Slack url_verification, and more.
wire.gateway context
Access gatewayName, senderId, platform, and send() inside any handler or middleware via wire.gateway.
Attachments
Images, files, and media normalized into GatewayAttachment — same interface across WhatsApp, Slack, and Telegram.
Lifecycle management
GatewayService handles listener startup, shutdown, and reconnection. LocalGatewayService included out of the box.
Multi-gateway
Register multiple gateways with the same handler. One function serves WhatsApp, Slack, and WebChat simultaneously.
Start building messaging integrations
One handler for every messaging platform. No platform-specific boilerplate.
MIT Licensed · WhatsApp, Slack, Telegram & more