Install Serverless CLI
curl -o- -L https://slss.io/install | bash
Install dependencies
npm install
To deploy (defaults to development stage)
npm run deploy
To deploy to production
npm run deploy:prod
Alternatively, you can set the stage
property in serverless.yml
. By default, stage
is set to dev
.
For development, create a .env
file and add your environment variables.
For production, create a env.prod
file and add your environment variables.
Environment variables are handled by serverless-dotenv-plugin. See example usage.
When we first deploy to an environment, we must setup a webhook so that Telegram knows where to send bot requests to. This is a one time setup.
We use AWS EventBridge to trigger our functions. Note that AWS EventBridge does not use the standard cron format so you cannot rely on online cron editors. Instead refer to their documentation for cron and rate expressions.
To configure your Serverless project you need to include a serverless.yml
file. For more information, see this reference.
View all available plugins.
- Programmatically set environment variables
- Prune older deployment versions
- Add Prettier code formatter
- Use different schedules for each stage
- Add Webpack
- Add ESLint
- Rewrite code for TypeScript
- Add TSLint