This project is a demonstration of serverless Discord Bot that uses World ID to verify humans. Verified humans get a special role assigned which can then be used to manage special permissions.
Project is built using AWS CDK IaC and projen.
npx projen
cd src/landing-page
npm run src/dev
Note We are working on publishing this bot on Discord so it can be installed in your own server with one-click. Coming soon! You can deploy your own version in the meantime.
- Head over to Worldcoin's Developer Portal and create an action.
- You'll need to create an action that runs on Cloud. Select Production mode if you want to run it with actual human verification, otherwise use Staging to test with the simulator.
- Go to Discord Developer Portal and create new application.
- Take note of the application ID (e.g.
984381699360161823
)
- Take note of the application ID (e.g.
- Create a new Bot for the application and make sure your save the Bot Token!
- Take note of the Bot public key (e.g.
aa4f7f5e1affd2c054ca07a2733007d44775826c821f6c0ddc3d3826a54eeb1a
)
- Take note of the Bot public key (e.g.
- Go to the OAuth2 page and create a client secret.
- Take note of the OAuth2 client secret (e.g.
4CqPc0000UwqP1234Wd7r81kUm6k3LA
)
- Take note of the OAuth2 client secret (e.g.
-
Make sure you have Node.js installed. Version 16.14.0 recommended (or above).
-
Install project dependencies:
npm install npx projen
-
Ensure you have latest version of AWS CLI and configure your AWS CLI (we recommend you create a profile specific for your AWS account). If you create a named profile instead of using
default
, be sure to use that profile name in allaws
orcdk
commands below:brew update && brew upgrade awscli aws configure # or aws sso login (if applicable)
-
If this is your first deployment using AWS CDK, you'll need to bootstrap it in your AWS account:
cdk bootstrap
-
Create relevant secrets.
a) Create secret with name
WorldIdDiscordBotToken
and the bot token as the value:aws secretsmanager create-secret --name WorldIdDiscordBotToken --description "Bot token for World ID Discord Bot" --secret-string <your 60+ chars long bot token saved during bot creation> --profile default
b) Create secret with name
WorldIdDiscordBotClientSecret
and the OAuth2 client secret as the value:aws secretsmanager create-secret --name WorldIdDiscordBotClientSecret --description "Client secret for World ID Discord Bot" --secret-string <your bot client secret> --profile default
-
[Optional]. Set CDK Context values at
project.ts
(or set them below using the CLI command) -
Install project dependencies:
npx projen
-
Run CDK deployment (set the proper deployment values if you didn't set them in
project.ts
):npx cdk deploy --context bot_app_id=12345678 \ --context bot_public_key=fdced6398cf4c6c96700069237df19ed393083f \ --context roles_for_verified_user="Validated Human,World ID" \ --context signal="<none>" \ --context action_id="wid_XC36mm99KFeXh2p9P" \ --profile=default
-
Grab
WorldID-Discord-Bot.discordbotapiEndpoint<some hash>
output (it should be an url similar tohttps://3dhsrvte6f.execute-api.us-east-1.amazonaws.com/prod/
) and save it into Interactions endpoint URL on your Bot settings at Discord Developers Portal.If you are seeing
interactions_endpoint_url: The specified interactions endpoint url could not be verified
error during this step then make sure that you provided properbot_app_id
andbot_public_key
CDK context values (carefully review steps above). -
Grab
OAuth2CallbackUrl
output (similar tohttps://2rrg16x6qh.execute-api.us-east-1.amazonaws.com/prod/oauth2callback
) and save it intoRedirects
field on the botOAuth2
General settings. -
Head over to the URL Generator tab of OAuth2 and create a link with the following scopes:
- Scopes:
guilds
,bot
,applications.commands
- Redirect URL: Select the URL you added in the previous step.
- Bot permissions:
Manage Roles
,Send Messages
,Embed Links
,Attach Files
.
- Scopes:
-
Visit the generated URL to install the bot in your server.
World ID is a protocol that lets you prove a human is doing an action only once without revealing any personal data. Stop bots, stop abuse.
World ID uses a device called the Orb which takes a picture of a person's iris to verify they are a unique and alive human. The protocol uses Zero-knowledge proofs so no traceable information is ever public.
World ID is meant for on-chain web3 apps, traditional cloud applications, and even IRL verifications.
Regardless of how you landed here, the easiest way to get started with World ID is through the the Dev Portal.
Want to see World ID in action? We have a bunch of Examples.
We have comprehensive docs for World ID at https://id.worldcoin.org/docs.
World ID is in Beta, help us improve! Please share feedback on your experience. You can find us on Discord, look for the #world-id channel. You can also open an issue or a PR directly on this repo.