Verify Student
Student enters an SMU number in Telegram. n8n checks it against the existing student database and links the Telegram user ID.
A polished implementation blueprint for a Telegram bot that verifies SMU students, presents available gyms, collects PayNow proof, supports payment verification, and issues a one-time pass for counter staff redemption.
The first version can support one gym, while the schema and routing are designed to scale when additional gyms are onboarded.
Student enters an SMU number in Telegram. n8n checks it against the existing student database and links the Telegram user ID.
The bot displays gym options, confirms the chosen gym, creates an order, then shows price, PayNow number, and no-refund terms.
After payment proof is approved, the bot sends a unique pass code or QR/image that the student shows at the gym counter.
Each step maps directly to an n8n branch, node group, or sub-workflow.
Capture text, photo, document, Telegram user ID, and chat ID. Route /start or new users to the login step.
Retrieve the current stage from conversation_states. If none exists, create awaiting_smu_number.
Validate the format, then query active student records. If invalid, ask the student to try again.
Query active gyms and present a numbered list. In MVP mode, show one gym and ask the student to reply with 1.
Save the selected gym temporarily, then ask the student to reply YES or NO before creating the order.
Generate an order reference, freeze the selected gym price, and set status to pending_payment.
Send PayNow number, amount, order reference, and no-refund warning. Wait for an image upload.
MVP path: forward screenshot to an admin Telegram group. Admin approves or rejects using the order reference.
Create a unique code, optional QR/pass image, expiry time, and one-time-use redemption status.
Staff checks or redeems the pass code. n8n rejects expired, already used, or invalid passes.
Use these tables in PostgreSQL, MySQL, Supabase, Airtable, or Google Sheets depending on your stack.
| Field | Purpose |
|---|---|
smu_number | Student card number for login verification. |
full_name | Displayed on final pass. |
telegram_user_id | Links Telegram account after verification. |
status | active, inactive, or blocked. |
| Field | Purpose |
|---|---|
gym_name | Shown in Telegram selection list. |
price | Per-entry pass price. |
paynow_number | Payment recipient number. |
is_active | Controls availability. |
| Field | Purpose |
|---|---|
order_reference | Payment note and admin approval key. |
status | pending_payment, verified, redeemed, expired. |
pass_code | Unique one-time verification code. |
expires_at | Optional pass expiry timestamp. |
| Field | Purpose |
|---|---|
telegram_user_id | Identifies the active conversation. |
current_step | Routes the next message. |
selected_gym_id | Stores temporary gym choice. |
active_order_id | Connects payment upload to an order. |
Recommended nodes for the MVP workflow and future-ready payment verification.
Drop these into n8n Code or database nodes and adapt field names to your actual database.
// Generate a pass code in n8n Code node
function randomCode(length = 8) {
const chars = 'ABCDEFGHJKLMNPQRSTUVWXYZ23456789';
let result = '';
for (let i = 0; i < length; i++) {
result += chars[Math.floor(Math.random() * chars.length)];
}
return result;
}
return [{
json: {
pass_code: `GYM-${randomCode(8)}`,
expires_in_hours: 24
}
}];