Official Unthread Extension for WhatsApp support via Twilio.
This integration does three core things:
- Converts inbound WhatsApp messages into Unthread conversations
- Sends agent replies from Unthread back to WhatsApp
- Sends automatic status system messages (created, closed, on hold, resumed)
π Platinum Sponsor |
|---|
![]() |
Unthread Streamlined support ticketing for modern teams. |
Customer (WhatsApp) -> Twilio -> Bot -> Unthread
|
Agent (Unthread) <- Webhook Server <- Redis Queue <- Bot
- Inbound path: Twilio calls
POST /webhooks/twilio, then the bot resolves/creates customer + conversation in Unthread. - Outbound path: unthread-webhook-server pushes Unthread events to Redis, then this bot forwards replies to WhatsApp.
- File support: inbound and outbound attachments are supported through media proxy links.
- Bun 1.x
- Twilio account with WhatsApp sandbox or approved number
- Unthread API key and channel ID
- PostgreSQL
- Redis for webhook queue (required for outbound events)
- Redis for platform cache (optional, recommended)
git clone https://github.com/wgtechlabs/unthread-whatsapp-bot.git
cd unthread-whatsapp-bot
bun installcp .env.example .envRequired variables:
| Variable | Purpose |
|---|---|
TWILIO_ACCOUNT_SID |
Twilio account SID |
TWILIO_AUTH_TOKEN |
Twilio auth token |
TWILIO_WHATSAPP_NUMBER |
Sender WhatsApp number (for example whatsapp:+14155238886) |
TWILIO_WEBHOOK_URL |
Public webhook URL for signature validation |
UNTHREAD_API_KEY |
Unthread API key |
UNTHREAD_SLACK_CHANNEL_ID |
Unthread target channel |
POSTGRES_URL |
PostgreSQL connection string |
Important optional variables:
| Variable | Default | Notes |
|---|---|---|
NODE_ENV |
dev |
dev, development, prod, production, test, staging |
PORT |
3000 |
App port |
REDIS_URL |
empty | Platform cache via Nuvex |
WEBHOOK_REDIS_URL |
empty | Required for webhook queue consumer |
WEBHOOK_QUEUE_NAME |
unthread-events |
Queue name used by webhook server |
UNTHREAD_WEBHOOK_SECRET |
empty | Optional webhook secret |
SLACK_TEAM_ID |
empty | Optional, auto-detected for Slack file downloads |
PUBLIC_BASE_URL |
derived from TWILIO_WEBHOOK_URL |
Base URL for media token links |
MEDIA_TOKEN_TTL_SECONDS |
600 |
Media proxy token TTL in seconds |
MAX_ATTACHMENT_SIZE_BYTES |
16777216 |
Max inbound attachment size |
Unthread API base URL is fixed internally to https://api.unthread.io/api.
# development
bun dev
# production
bun startIn Twilio WhatsApp Sandbox, set:
- URL:
https://your-domain.com/webhooks/twilio - Method:
POST
Run unthread-webhook-server with TARGET_PLATFORM=whatsapp, then in Unthread subscribe to:
message_createdconversation_updated
| Method | Path | Purpose |
|---|---|---|
POST |
/webhooks/twilio |
Inbound Twilio WhatsApp webhook |
GET |
/media/:token |
Short-lived media proxy for Twilio |
GET |
/health |
App, version, and storage health |
docker compose up -d
docker compose logs -f serverReset local data:
docker compose down -v && docker compose up -dbun run lint
bun run typecheck
bun run testJoin our community discussions to get help, share ideas, and connect with other users:
- π£ Announcements: Official updates from the maintainer
- πΈ Showcase: Show and tell your implementation
- π Wall of Love: Share your experience with the bot
- π Help & Support: Get assistance from the community
- π§ Ideas: Suggest new features and improvements
Need help? Check our Help & Support discussions or create a new issue.
Important: All pull requests must be submitted to the dev branch. PRs to main will be automatically rejected.
Contributions are welcome! Your code must pass bun run typecheck before merging.
Like this project? Leave a star! βββββ
There are several ways you can support this project:
- Become a sponsor and get some perks! π
- Buy me a coffee if you just love what I do! β
Found this project helpful? Consider nominating me (@warengonzaga) for the GitHub Star program! This recognition supports ongoing development of this project and my other open-source projects. GitHub Stars are recognized for their significant contributions to the developer community β your nomination makes a difference and encourages continued innovation!
This project is licensed under the GNU General Public License v3.0. See the LICENSE file for the full license text.
This project is created by Waren Gonzaga under WG Technology Labs, with the help of awesome contributors.
π» with β€οΈ by Waren Gonzaga under WG Technology Labs, and Him π
