---
title: Telegram Bot Using AWS API Gateway And AWS Lambda
date: 2016-03-11 09:44:50
permalink: https://lesterchan.net/blog/2016/03/11/telegram-bot-using-aws-api-gateway-and-aws-lambda/
author: Lester Chan
categories:
  - Programming
tags:
  - AWS
  - AWS API Gateway
  - AWS Lambda
  - Node.js
  - Telegram
  - Telegram Bot
---

After creating a [Slack Bot Using AWS API Gateway and AWS Lambda](https://lesterchan.net/blog/2016/03/09/slack-bot-using-aws-api-gateway-and-aws-lambda/), I decided to port the tutorial over so that it will work for [Telegram Bot](https://core.telegram.org/bots) too.

There are some differences between the two tutorials:

- Telegram requires you to get an API token so that you can post the response back to the user via another request.
- I am using [Telegram /command](https://core.telegram.org/bots#global-commands) (I might change it to be like my Slack Bot where it doesn’t need to start with a /).
- Less options for formatting since it is just text.

You can head over to the GitHub Repo at [github.com/lesterchan/telegram-bot](https://github.com/lesterchan/telegram-bot) to view the step-by-step tutorial.

There are five commands so far:

- Singapore Bus Arrival Timings: `/bus <busStopNo> <busNo>`, example: `/bus 1039 61`
- Singapore Haze Situation: `/haze`
- Singapore Weather 3 Hour Forecast: `/weather`
- IP Information: `/ipinfo <ip>`, example: `/ipinfo 8.8.8.8`
- Social Stats Count For Links: `/socialstats <url>`, example: `/socialstats https://lesterchan.net`

[![Telegram Bot](https://farm2.staticflickr.com/1528/25660481625_7fd558c83a_c.jpg "Telegram Bot")](https://farm2.staticflickr.com/1528/25660481625_8438a20584_o.jpg "Telegram Bot")

See also: [ Slack Bot Using AWS API Gateway and AWS Lambda](https://lesterchan.net/blog/2016/03/09/slack-bot-using-aws-api-gateway-and-aws-lambda/)