Setup your Telegram Bot
1
Create a Telegram Bot with BotFather
- Open Telegram and search for “@BotFather”
- Start a conversation by clicking “Start” or typing
/start
- Create a new bot by typing
/newbot
- Follow the prompts:
- Enter a name for your bot
- Choose a username (must end in ‘bot’)
2
Obtain Required Tokens
After creating your bot, BotFather will provide:
- Bot Token (HTTP API Token)
- Bot Username
Prepare your Unity WebGL Project
1
Install Sequence's Unity SDK
Use one of our recommend installation options for your existing project or use our
Unity Boilerplate if you want to start a project from scratch.
2
UI for Mobile Layouts
Ensure that your game’s UI is optimized for mobile aspect ratios. We recommend using the
Device Simulator for Unity.
Additionally, ensure your input handling is set up for touch controls.
3
Configure Sequence's React Template for WebGL
Sequence’s Unity SDK includes a WebGL Template for exporting as a React project.
Copy the
WebGLTemplates
folder from Packages/Sequence Embedded Wallet SDK/
into your project’s Assets/
directory.
Go to Project Settings
-> Player
-> WebGL
-> Resolution and Presentation
and select the SequenceReact
template.4
Cloudflare Configuration
Inside the React project’s root directory, create a
wrangler.toml
file and include the following content.5
Build your WebGL game as a React project
Open the root directory of your React project in a CLI or an IDE like Visual Studio Code, and run the following
command to test your game in the browser.
Deploy your Telegram Mini-Game
1
Authenticate with Cloudflare Account
From the React project’s root directory, deploy the app and functions logic to Cloudflare.
- Run
pnpm wrangler pages deploy
2
Register Webhook with Telegram
Now we call our
registerWebhook
endpoint on our app to register the webhook function with the URL of your deployed
application to enable access for the Telegram API.3
Update Allowed Origins
Ensure in Sequence Builder that your wallet configuration includes the URL of your deployed application
as an allowed origin.