EVMSolana
Overview
Configure a Telegram bot to enable Telegram authentication for Embedded Wallets. This guide walks you through creating a bot via BotFather, configuring its domain, and integrating with CDP. Time to complete: ~10 minutesPrerequisites
Before you begin, ensure you have:- Telegram account: An active Telegram account
- CDP Project ID: Available in your CDP Portal dashboard
- Access to CDP Portal: Permission to configure Embedded Wallets settings
Step 1: Create a Telegram bot
- Open Telegram and search for @BotFather, or navigate directly to BotFather
-
Start a conversation and send
/newbot -
Follow the prompts:
- Name: Enter a display name for your bot (e.g., “My App Login”)
- Username: Enter a unique username ending in
bot(e.g.,myapp_auth_bot)
- BotFather will respond with your bot token — copy and save it immediately
Step 2: Configure bot branding
The bot’s profile picture and name are displayed to users during the Telegram login flow. Configure these to match your application’s branding:- In BotFather, send
/setuserpicand select your bot - Upload your application logo or brand image
- Optionally, send
/setdescriptionto set a description users see when they open the bot
Step 3: Set the bot domain
Link your bot to the CDP callback domain so Telegram can route authentication requests:- In BotFather, send
/setdomain - Select your bot from the list
- Enter the domain of your application
Step 4: Configure CDP Portal
Now that your bot is configured, add the credentials to CDP Portal:Configure Telegram in CDP Portal
Configure Telegram in CDP Portal
- Navigate to the CDP Portal
- Select your project
- Go to Embedded Wallets > Authentication
- Find the Telegram section
- Toggle Enable Telegram to on
- Paste your Bot Token from Step 1
- Enter your Bot Username (e.g.,
myapp_auth_bot) - Click Save Changes
Step 5: Verification
Test your Telegram configuration:- In your application, ensure you’re calling the Telegram sign-in method (see SDK Integration below)
- Click “Sign in with Telegram”
- Verify that the Telegram login widget shows your bot’s name and profile picture
- Complete the authentication flow
- Check that the user successfully signs in and their wallet is accessible
SDK Integration
Integrate Telegram authentication in your application using CDP’s SDK:The SDK automatically uses your Telegram bot configuration when available. No code changes are needed when updating your bot settings.
Production considerations
Bot token security
Bot token security
The bot token is the most critical credential in Telegram authentication:
- Store securely: Use environment variables or a secrets manager — never commit to source control
- Rotate periodically: Use BotFather’s
/revokecommand to generate a new token if compromised - Limit access: Restrict who can access the bot token in your organization
- Monitor activity: Watch for unexpected authentication patterns that could indicate token compromise
Branding and user experience
Branding and user experience
Users see your bot’s profile during the Telegram login flow:
- Bot name: Use your official product name for brand recognition
- Profile picture: Upload a high-quality logo that matches your app’s branding
- Bot username: Choose something recognizable (e.g.,
yourapp_auth_bot) - Description: Set a clear description explaining the bot’s purpose
Security best practices
Security best practices
- Domain verification: Ensure only
api.cdp.coinbase.comis set as the bot domain - Token rotation: Rotate the bot token periodically and update CDP Portal accordingly
- Access control: Limit who can manage the bot via BotFather
- Monitoring: Track authentication attempts for anomalous patterns
Troubleshooting
Error: Domain mismatch
Error: Domain mismatch
Cause: The bot domain in BotFather doesn’t match the URL of your application.Solution:
- Open BotFather and send
/setdomain - Select your bot
- Set the domain to exactly match the URL you are initiating Telegram authentication from
- Try authentication again
Error: Invalid bot token
Error: Invalid bot token
Cause: The bot token in CDP Portal is incorrect, expired, or has been revoked.Solution:
- Open BotFather and send
/tokento view your current token - If the token was revoked, send
/revoketo generate a new one - Update the token in CDP Portal
- Ensure no extra spaces or characters were copied
Error: Bot not found
Error: Bot not found
Cause: The bot username in CDP Portal doesn’t match the actual bot username.Solution:
- Open BotFather and send
/mybotsto see your bots - Verify the exact username (including the
botsuffix) - Update the username in CDP Portal to match exactly
User sees wrong bot name or image
User sees wrong bot name or image
Cause: The bot’s profile hasn’t been configured or was recently changed.Solution:
- In BotFather, use
/setuserpicto set or update the bot’s profile picture - Use
/setnameto update the display name - Changes may take a few minutes to propagate
Authentication works but wallet doesn't load
Authentication works but wallet doesn't load
Cause: This is likely an issue with your CDP configuration, not Telegram.Solution:
- Check CDP status page for potential outages
- Verify your CDP Project ID is correct in your application
- Ensure you’re using the latest SDK version
- Contact CDP support if the issue persists