Here’s how to token-gate a Telegram chat with Unlock Protocol and Guild.xyz. There are just a few steps to token-gating Telegram with Unlock Protocol. You’ll be up and running in no time! The steps are:
- Set up a smart contract (we call them Locks) with Unlock Protocol
- Create a Guild
- Set up Telegram to token-gate
- Connect Guild to the Telegram chat
Let’s get to it.
Please note: The power of doing things onchain is that different systems can work together. That said, it’s easy to inadvertently skip a step or two in here, since we’re wiring together components from three different onchain systems. You’ll need to do all the steps in this guide, and do them in order, to make sure your setup goes smoothly.
Set up your smart contract with Unlock Protocol
To create a new Lock, go to the Unlock Protocol homepage, connect your wallet and launch the app. On the Unlock Protocol dashboard, click the “Create Lock” button.
The deployment process can be tracked on the relevant block explorer, and once the contract has been deployed, it will appear on the lock list on the Unlock Protocol dashboard. You can view the details of the lock and confirm all of the terms that have been set.
See the video below for a quick walkthrough of the membership setup process.
You’ll need to copy the smart contract address for the subscription smart contract you just created. Click on the copy icon in the Unlock dashboard and save that smart contract address. You’ll need it in a later step when you are setting up Guild.
If you’d like to dig deeper into all the details on how to set up a membership program with Unlock Protocol, see our comprehensive guide on How To Create a Membership Program.
Create a Guild
Now, create a guild on Guild.xyz. Connect your wallet, name your guild, give it a description, and select Telegram.
Set up Telegram
Now, open Telegram and start a new chat.
First, add the Guild bot (@guildxyz_bot) to your Telegram chat.
Then, in Telegram, configure the settings to allow the Guild bot to manage the chat.
Adjust the chat settings (set to Public, add a name, click “Done,” then set the chat back to Private and click “Done”).
Then, set the Guild bot as an admin on the chat.
After you’ve done the above, there will be a chat ID in the Telegram chat. (It’ll look something like -12345678
.) Copy the chat ID, hop back over the the Guild.xyz site, paste the chat ID into the box, and save.
Ok! The Telegram side is in good shape now.
Connect Guild up to the Telegram chat
Head back over the the Guild.xyz site, and set up the token gate using the smart contract address you saved in the first step at the top of this guide.
- Click “Add a role”
- Click “Add a requirement”
- Click “NFT”
- Choose your chain — this will be the chain your smart contract was set up on (Base, Polygon, etc.)
- Paste in the contract address you copied/saved in the first step of this guide
- Requirement type is “Amount”
- Minimum amount is “1”
Save your updates, and you should be all set!
To invite someone to the token-gated chat, direct them to the Guild site for your guild. When someone attempts to join, Guild will manage the process and, if the visitor has the correct Unlock key in their wallet, Guild will link the new member over to the Telegram chat for you, seamlessly.
That’s it! You now have a token-gated Telegram chat.
Related
In a related guide, we showed you how to token-gate a Discord server using Unlock and Guild.xyz.