How to Build an Interactive Price Quoting Application over Telegram in Python

Using the WhatsMate Telegram Gateway REST API

Posted on November 14, 2016

Last Modified: March 31, 2017

This article shows you how to build an interactive price quoting application over Telegram in Python. The application responds to user’s requests for price quotes interactively. Don’t know what I am talking about? The following screenshot should explain it more clearly:

Explanation:

If you are new to Python and want to understand how the script enterprise-demo-app.py works, we are here to help:

Lines 3-4 import the required dependent libraries.

Lines 50-71 define the utility function sendTelegramMessage. Its name already tells you what it does. You don’t need to change it.

Line 75 creates the Flask web framework instance.

Lines 86-103 are the gist of the application. You define how you want to respond to your user’s messages here. The sample program implements a simplistic price quoting engine. Feel free to change it to fit your own needs.

Lines 106-108 kick start the Flask web application server so that it listens on the specified port for incoming webhook events.

What’s Next:

If you are keen to implement an automated interactive application that talks to your users on Telegram, get in touch with one of our technical representatives to sign up for an Enterprise account now.