This integration enables a fun and competitive speed game in Telex, where users race to type a message first. The bot detects duplicate messages and announces the first person who sent it.
- Detects duplicate messages within a configurable time window (default: 10 seconds).
- Announces the first user who typed a message.
- Responds to all users who send the duplicate message within the window.
- FastBot announces the winner.
- Supports configurable webhook endpoints for Telex.
- Includes error handling and retry mechanisms.
- A user types a message in Telex.
- If it's the first occurrence, it gets recorded.
- If another user sends the same message within the 10-second window, FastBot announces the first user who typed it.
- All users who send the same message during this period will receive FastBot’s response.
- After the window expires, the message resets, allowing a new round to begin.
Endpoint:
GET /health
Response:
{
"status": "ok",
"timestamp": "2025-02-24T12:00:00.000Z"
}
Endpoint:
POST /process-message
Request Body:
{
"channel_id": "https://ping.telex.im/v1/webhooks/0195338c-9ee4-7a67-a2d5-4673dbf0cc22",
"message": "Hello world!",
"target_url": "https://ping.telex.im/v1/webhooks/0195338c-9ee4-7a67-a2d5-4673dbf0cc22",
"user_id": "user123",
"request_id": "req-abc-123"
}
Responses:
- First message recorded
{
"message": "Hello world!",
"metadata": {
"processed": true,
"user_id": "user123",
"request_id": "req-abc-123",
"timestamp": "2025-02-24T12:00:00.000Z"
}
}
- Duplicate detected (FastBot announces the winner)
{
"message": "Hello world!",
"metadata": {
"processed": true,
"user_id": "user456",
"request_id": "req-def-456",
"timestamp": "2025-02-24T12:00:05.000Z"
}
}
FastBot then sends:
{
"channel_id": "https://ping.telex.im/v1/webhooks/0195338c-9ee4-7a67-a2d5-4673dbf0cc22",
"message": "🏆 user123 typed it first!",
"event_name": "game_result",
"status": "success",
"username": "FastBot"
}
This integration uses environment variables to configure the bot.
Variable | Description | Default |
---|---|---|
PORT |
Server port | 5000 |
TELEX_WEBHOOK_URL |
Webhook URL for sending results to Telex | Required |
TELEX_CHANNEL_ID |
Telex Channel ID | Required |
TELEX_API_TOKEN |
API Token for authentication | Required |
DUPLICATE_TIME_WINDOW |
Time (seconds) before the message resets | 10 |
- The default time window is 10 seconds but can be configured.
- All duplicate messages within the time window get a response from FastBot.
- If Telex API fails, the bot retries 3 times before stopping.
- FastBot always announces the first user who sent the message.
- Clone the repository:
git clone https://github.com/telexintegrations/telex-who-typed-it-first.git cd telex-speed-game
- Install dependencies:
npm install
- Create a
.env
file and configure variables. - Start the server:
npm start
- Use Postman to test the
/process-message
endpoint.
MIT License This project is open-source and free to use.