The main flow
User taps the sign-in button
In your app — whether a web page, mobile screen, or any other surface — the user taps your “Sign in with Telegram” button. This triggers a call to generate a new Bondify session. If you are using an SDK, the SDK handles the next two steps automatically.
Your app creates a session
Call Bondify responds with a Store the
POST /api/v1/generate/public with your project_id:session_token and a Telegram deeplink:session_token — you will need it for polling and proof verification.Telegram opens
Your app opens the
deeplink in Telegram (the SDK does this automatically). Bondify’s bot sends the user a confirmation message showing your project name and the data it is requesting (profile info, phone number, etc.).User confirms or cancels
Inside Telegram, the user taps either ✅ Confirm to approve the login or ❌ Cancel to decline. No passwords, no SMS — just one tap.
Your app polls for the result
While Telegram is open, your app polls While the user is deciding, you receive:Once the user confirms, the response includes the full session data and a signed proof:Stop polling as soon as you receive any terminal status:
POST /api/v1/verify/public every 2 seconds, passing the session_token:confirmed, cancelled, expired, or used.Your server verifies the proof
Send the
proof string to your backend and call verifyProof() from @bondify/server:verifyProof() validates the HMAC-SHA256 signature against your project’s secret key. If the proof is invalid or tampered with, it throws — reject the request with a 401.Webhook alternative
Instead of polling, you can configure a Webhook URL on your project to receive real-time push events from Bondify. When the user confirms or cancels in Telegram, Bondify immediately sends aPOST request to your endpoint.
X-Bondify-Signature header. Always verify this signature before processing the event:
Error handling
- User cancelled
- Session expired
- Invalid proof
- Already used
When
status === 'cancelled', stop polling immediately and display a user-friendly message:Never trust
telegram_id or telegram_name values passed directly from the client without verifying the proof server-side first. Client-supplied values can be fabricated. Only values returned by a successful verifyProof() call are trustworthy.Flow summary
Next steps
Projects
Set up your project ID and secret key before making your first API call.
Security
Review the security model and best practices for a safe integration.