Skip to content

HenrikFricke/telegram-geo-quiz

Repository files navigation

Telegram Geo Quiz

Dependencies

Development

The setup is very test-driven: In theory, you could start a local environment with Sam, but it's not very helpful as the communication to Telegram is not working locally. The recommended approach is to implement new features with unit tests and then create a bot instance to test it directly in Telegram.

# Local dev environment
$ > make start

# Run unit tests
$ > make test

# Build TypeScript
$ > make build

Setup bot instance

  1. Use Telegram's BotFather to create a bot.
  2. Take the generated token of the new bot and create a .env file:
TELEGRAM_BOT_TOKEN=
ENVIRONMENT=staging
  1. Make sure you have AWS credentials in your environment
  2. Create a S3 bucket for your Cloudformation stack: make create-bucket
  3. Deploy the stack: make deploy
  4. After the deployment, you should receive a URL in the terminal. Copy it.
  5. Set the webhook to integrate the stack with Telegram:
curl -X POST https://api.telegram.org/bot{{ TELEGRAM_BOT_TOKEN }}/setWebhook\?url\={{ encoded url }
  1. Upload locations to the DynamoDB table: make upload-dynamodb-data
  2. Now you should be able to interact with the bot. Send some messages to the bot in Telegram.

Next time, you just need to execute make deploy to update your tech stack.

Resources