Public
Like
App
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data β all from the browser, and deployed in milliseconds.
index.ts
https://CHUKSINHO_KEYD--3cfa67a03f4e11f0b25676b3cceeab13.web.val.run
A web application that tracks deleted messages from WhatsApp using the WhatsApp Business API.
- Receives WhatsApp messages via webhook
- Tracks when messages are deleted by senders
- Provides a web interface to view deleted messages
- Stores message history and deletion events
-
WhatsApp Business API Setup:
- Create a WhatsApp Business account
- Set up a webhook URL pointing to this app
- Configure the webhook to receive message events
- Get your access token and verify token
-
Environment Variables:
WHATSAPP_VERIFY_TOKEN
: Token for webhook verificationWHATSAPP_ACCESS_TOKEN
: Access token for WhatsApp APIWHATSAPP_PHONE_NUMBER_ID
: Your WhatsApp Business phone number ID
-
Webhook Configuration:
- Webhook URL:
https://your-app-url.web.val.run/webhook
- Verify Token: Use the same token as
WHATSAPP_VERIFY_TOKEN
- Subscribe to:
messages
events
- Webhook URL:
βββ backend/
β βββ database/
β β βββ migrations.ts # Database schema
β β βββ queries.ts # Database operations
β βββ routes/
β β βββ webhook.ts # WhatsApp webhook handler
β β βββ api.ts # API routes for frontend
β βββ index.ts # Main server entry point
βββ frontend/
β βββ components/
β β βββ App.tsx # Main app component
β β βββ MessageList.tsx # Deleted messages list
β β βββ MessageItem.tsx # Individual message display
β βββ index.html # Main HTML template
β βββ index.tsx # Frontend entry point
βββ shared/
βββ types.ts # Shared TypeScript types
- WhatsApp sends webhook events when messages are received or deleted
- The app stores all incoming messages in the database
- When a deletion event is received, the message is marked as deleted
- Users can view deleted messages through the web interface
- The app maintains a history of all messages and their deletion status
GET /
- Web interfacePOST /webhook
- WhatsApp webhook endpointGET /webhook
- Webhook verificationGET /api/deleted-messages
- Get all deleted messagesGET /api/messages/:chatId
- Get messages for a specific chat
This app requires proper WhatsApp Business API setup and webhook configuration to function correctly.