The designed chatbot follows the guides for connecting the APIs of Telegram, Wolframalpha and Twitter.
- The idea behind this project is to show the conversational skills of the Wolframalpha artificial intelligence by means of Telegram. It can be also used as a bot for data inquiries to search in both Wolframalpha and Wikipedia search engines.
- This bot is also designed for predicting the real risk transmitted by a Twitter post with a logistic regression estimator.
This bot is currently available in telegram and mounted on AWS-EC2 free instance.
A diagram of the implementation is shown below:
Install or upgrade python-telegram-bot by the command:
$ pip install python-telegram-bot --upgrade
Wolframalpha libraries are required. Install them with:
$ pip install wolframalpha
Install twitter libraries by:
$ pip install tweepy
After creating a bot in telegram with the help of @BotFather. Insert your token in the line:
updater = Updater('', use_context=True) # Insert here API code of telegram
Moreover, you should be registered as Wolframalpha developer, then insert your token in line:
app_id = '' # Insert here API code of wolframalpha
client = wolframalpha.Client(app_id)
Finally, you should log in as Twitter developer, then insert your keys in lines:
consumer_key = ""
consumer_secret = ""
access_token = ""
access_token_secret = ""
# authorization of consumer key and consumer secret
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
# set access to user's access key and access secret
auth.set_access_token(access_token, access_token_secret)
# calling the api
api = tweepy.API(auth)