Category: Chat

  • How to code a cryptocurrency trading bot to buy Bitcoin when Musk Tweets about it

    Why would someone do this?

    The answer is a simple one — the Techno King of Tesla has a history of influencing crypto markets whenever he tweets about them, to the point where a movement in the market is almost expected when he picks up is phone and starts expressing his opinions on the blockchain technology over twitter.

    By creating a crypto trading bot that buys bitcoin every time the Tesla boss tweets about it you can rest assured that you are going to catch a VIP seat on the rocket that will slingshot right past the moon and make its way directly to Mars, where Elon spends most of the summer months due to its cold weather and dry climate.

    Will this actually work?

    The quick answer is “not sure” — as no one tested this strategy before. The longer answer is probably — as long as we’re talking about Bitcoin. Statistically speaking, regardless of the time you bought your bitcoin, you are most likely in profit (excluding the recent all time high around the time of writing).

    So if nothing else, you will at least spice up your BTC HODLing strategy with a bit of help from Elon. This article won’t go into a detailed analysis to show whether this strategy actually works or not. This article is about building it for fun, but it does have serve as a powerful reminder of just how many resources we have at our disposal and that you can build just about any crypto trading bot you can think of.

    You will also be able to see and use the code so you can test it or improve it.

    How to set your bitcoin bot up

    What this article is focused on is the actual technical building of the bitcoin trading bot, and how to set it up in a safe test environment, so let’s get to it.

    You will need the following resources:

    • A MetaTrader5 account
    • A demo account with XBTFX so you can safely test your strategy
    • A Twitter Dev Account
    • A Tweepy API account

    Setting up MetaTrader5 and XBTFX

    As the name suggests, MT5 is a platform which supports multiple brokers along with detailed technical analysis — the main reason to start your crypto bot building journey with MT5 is due to it’s easy integration with Python and out-of-the-box support for a demo or virtual account so that you can test in a safe demo environment.

    There are detailed instructions on how to install and configure MetaTrader5 as well as the XBTFX crypto broker in the previous post that covers how to build a crypto trading bot in python, so we’ll only briefly going over these steps in this article. If you need more information on how to do it, as well as why those two platforms were chosen, please refer back to the linked article above.

    Start by downloading and installing MetaTrader5 and create an account on their platform. The next thing you need is a broker that you can place your trades with — I recommend XBTFX as they offer the most crypto-pairs of all brokers that work with the MT5 terminal. Register with XBTFX and create a demo account.

    You can now connect to your demo account via MT5 by navigating over to File > Open an Account and searching for XBTFX. If you have registered using the referral link above you will need to select “Connect to Existing Account”, otherwise proceed to create a new account.

    Trending Bot Articles:

    1. Chatbot Trends Report 2021

    2. 4 DO’s and 3 DON’Ts for Training a Chatbot NLP Model

    3. Concierge Bot: Handle Multiple Chatbots from One Chat Screen

    4. An expert system: Conversational AI Vs Chatbots

    Apply for a Dev Account with Twitter

    Before you can use Twitter’s API or the Tweepy Python module, you need a developer account with Twitter. Luckily the application process is quick and easy, and you will probably be accepted as long as you describe why you need the access to the Twitter API.

    Nativate over to twitter’s dev platform and click Apply in the top right corner of the navigation menu.

    On the next page click Apply for a Developer account and you will be prompted to sign in with your twitter account.

    Follow the registration process and explain your intentions with the API

    After you have completed all the necessary information, it may take anywhere between a couple of hours to a couple of days before you can get access to the platform. In my experience it was only a few hours.

    Once your dev account is ready navigate over to the Projects & Apps tab open Project 1, if this is not available go ahead and create one. Under your project go to Keys and Tokens and generate the following (make sure to save them or you will need to regenerate the keys!):

    Defining bot parameters

    • The bot will open a buy position on bitcoin every time Elon mentions bitcoin in his tweet
    • Take profit is set to 10% and stop loss to 5%
    • The bitcoin bot will not place another trade if there is already an active trade (can be adjusted)

    Coding for your bitcoin trading bot

    Preliminary set-up

    First off you need to import the MetaTrader5 and Tweepy modules using PyPi.

    pip install tweepy
    pip install MetaTrader5
    pip install — upgrade MetaTrader5

    The next step is to import these modules along with a few others into your Python interpreter.

    #Twitter Scraper module
    import tweepy
    from tweepy import OAuthHandler
    #dates module
    from datetime import datetime, date
    from itertools import count
    import timeimport re
    #trading terminal
    import MetaTrader5 as mt5

    We now need to store the secret keys and tokens that you generated using the Twitter Dev platform in order to use them with Tweepy.

    # Store Twitter credentials from dev account
    consumer_key = “CONSUMER_KEY”
    consumer_secret = “CONSUMER_SECRET”
    access_key = “API_KEY”
    access_secret = “API_SECRET”
    # Pass twitter credentials to tweepy via its OAuthHandler
    auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
    auth.set_access_token(access_key, access_secret)
    api = tweepy.API(auth)

    In the last part of the preliminary set up you need to connect to the MT5 terminal, store your account’s equity and define the trading instrument that we will be working with — in this case it’s Bitcoin. We will also create a short list of keywords to query Elon’s last tweet against.

    # connect to the trade account without specifying a password and a server
    mt5.initialize()
    # account number in the top left corner of the MT5 terminal window
    # the terminal database password is applied if connection data is set to be remembered
    account_number = 555
    authorized = mt5.login(account_number)
    if authorized:
    print(f’connected to account #{account_number}’)
    else:
    print(f’failed to connect at account #{account_number}, error code: {mt5.last_error()}’)
    # store the equity of your account
    account_info = mt5.account_info()
    if account_info is None:
    raise RuntimeError(‘Could not load the account equity level.’)
    else:
    equity = float(account_info[10])

    Now let’s define the coin that we’ll be placing trades on and the keywords that we’ll be searching for.

    #crypto sign and keywords
    CRYPTO = ‘BTCUSD’
    keywords = [‘Bitcoin’, ‘bitcoin’, ‘BITCOIN’, ‘btc’, ‘BTC’]

    Getting Elon’s latest tweet

    With all the preliminary stuff out of the way, it’s time to focus on the cool parts of this bot. Let’s start by getting Elon’s last tweet with Tweepy as shown below in the get_elons_tweet() function.

    During testing, emojis and other invalid characters would break the script, so each tweet is re formatted to only contain alpha-numeric characters.

    #Get Technoking’s latest tweet
    def get_elons_tweet():
    “””Get Elon’s last tweet by user ID — retry until tweepy returns tweet”””
    tweets = tweepy.Cursor(api.user_timeline,id=”44196397", since=date.today(), tweet_mode=’extended’).items(1)
    #remove all invalid characters
    elons_last_tweet = [re.sub(‘[^A-Za-z0–9]+’, ‘ ‘, tweet.full_text) for tweet in tweets]
    #re-try until it returns a value — tweepy API fails to return the tweet sometimes
    while not elons_last_tweet:
    tweets = tweepy.Cursor(api.user_timeline,id=”44196397", since=date.today(), tweet_mode=’extended’).items(1)
    elons_last_tweet = [re.sub(‘[^A-Za-z0–9]+’, ‘ ‘, tweet.full_text) for tweet in tweets]
    return elons_last_tweet[0]

    Logic check and preparing the trading request

    Now that we have Elon’s last tweet we can start preparing the logic and the trading request in function trade(). For more information regarding the format of the trade request, have a look at the MT 5 documentation.

    what_musk_said contains the last tweet and the logic will check whether any of the keywords defined in our keywords variable above are present in Elon’s tweet. If that is true, the bitcoin trading bot will place a buy order on bitcoin with instant execution. In case it’s false it will simply return to us the tweet.

    #buy bitcoin
    def trade():
    “””Check if Musk mentioned bitcoin and open a buy position if so”””
    what_musk_said = get_elons_tweet()
    # used to check if a position has already been placed
    positions = mt5.positions_get(symbol=CRYPTO)
    orders = mt5.orders_get(symbol=CRYPTO)
    symbol_info = mt5.symbol_info(CRYPTO)
    price = mt5.symbol_info_tick(CRYPTO).bid
    # perform logic check
    if any(keyword in what_musk_said for keyword in keywords):
    print(f’the madlad said it — buying some!’)
    # prepare the trade request
    if not mt5.initialize():
    raise RuntimeError(f’MT5 initialize() failed with error code {mt5.last_error()}’)
    # check that there are no open positions or orders
    if len(positions) == 0 and len(orders) < 1:
    if symbol_info is None:
    print(f’{CRYPTO} not found, can not call order_check()’)
    mt5.shutdown()
    # if the symbol is unavailable in MarketWatch, add it
    if not symbol_info.visible:
    print(f’{CRYPTO} is not visible, trying to switch on’)
    if not mt5.symbol_select(CRYPTO, True):
    print(‘symbol_select({}}) failed, exit’, CRYPTO)
    #this represents 5% Equity. Minimum order is 0.01 BTC. Increase equity share if retcode = 10014
    lot = float(round(((equity / 5) / price), 2))
    # define stop loss and take profit
    sl = price — (price * 5) / 100
    tp = price + (price * 10) / 100
    request = {
    ‘action’: mt5.TRADE_ACTION_DEAL,
    ‘symbol’: CRYPTO,
    ‘volume’: lot,
    ‘type’: mt5.ORDER_TYPE_BUY,
    ‘price’: price,
    ‘sl’: sl,
    ‘tp’: tp,
    ‘magic’: 66,
    ‘comment’: ‘python-buy’,
    ‘type_time’: mt5.ORDER_TIME_GTC,
    ‘type_filling’: mt5.ORDER_FILLING_IOC,
    }
    # send a trading request
    result = mt5.order_send(request)
    # check the execution result
    print(f’1. order_send(): by {CRYPTO} {lot} lots at {price}’)
    if result.retcode != mt5.TRADE_RETCODE_DONE:
    print(f’2. order_send failed, retcode={result.retcode}’)
    #print the order result — anything else than retcode=10009 is an error in the trading request.
    print(f’2. order_send done, {result}’)
    print(f’ opened position with POSITION_TICKET={result.order}’)
    else:
    print(f’BUY signal detected, but {CRYPTO} has {len(positions)} active trade’)
    else:
    print(f’He did not say it, he said: {what_musk_said}’)

    Putting it all together

    We now need to decide how often we should be iterating through the code below. By default, it pull and analyse Elon’s last tweet once every 5 seconds, but this can be adjusted in the time.sleep function below.

    #execute code every 5 seconds
    if __name__ == ‘__main__’:
    print(‘Press Ctrl-C / Ctrl-Q to stop.’)
    for i in count():
    trade()
    print(f’Iteration {i}’)
    time.sleep(5)

    Additional Resources:

    It was a fun project work on and I hope that you enjoyed this article. Please follow me if you enjoyed this article. For more crypto bot projects, check out my blog for more cryptocurrency trading bots in Python

    Don’t forget to give us your 👏 !


    How to code a cryptocurrency trading bot to buy Bitcoin when Musk Tweets about it was originally published in Chatbots Life on Medium, where people are continuing the conversation by highlighting and responding to this story.

  • How to build your own chatbot

    With a touch of Huggingface and Cloud run

    The use of chatbots has increased drastically in recent years and almost all major companies use some form of chatbot in their business, and it is not hard to understand why this is the case. Since BERT was delivered by google, the performance of NLP models has seen impressive progress. The latest state-of-the-art model GPT-3 has a breathtaking 175 billion parameters in its model, which makes interactions with the model almost indistinguishable from a human being.

    So in this article I would like to demonstrate how to build your own chatbot and have it wrapped as an API service.

    The project is divided into two parts. First we need to have a trained chat model that can make predictions, then a server that can handle requests to our model.

    There are several models available that can be used to build a chatbot. We will use blenderbot, created by facebook’s research team in 2019. The model is an open ended chatbot, which means that it is not created to handle certain given actions in the backend, which is the more common use case for businesses. Instead this model is only focused on imitating human communication.

    We will use a small implementation of the model with no additional fine tuning. However this is heavily desirable for a more sophisticated chatbot.

    We start by creating a file that we will use to download the model. To help us, we use Huggingface, a python library that provides various high quality NLP models.

    Then we create a python class that we will use to handle the logic from converting our english text to create our word tokens that we will use as inputs for our model.

    We then build a Flask API with two endpoints, one for checking if the service is working and one for integrating with our chatbot.

    Finally we generate a Dockerfile that when being built will pre-download the chat model so that when we send request to our API it can make quick responses, instead of reloading the model every single time. This will drastically improve the performance of our bot. To host the API we use gunicorn as our wsgi server with no additional web server framework.

    From our local machine to production

    The steps from running your model on your local machine to have it running in production can see daunting. However several services have done this step a lot easier in recent years.

    We are going to work with google cloud run for this project. Googles “serverless” platform, I don’t like the word serverless since of course there has to be a server running the code, but it is serverless in the sense that it doesn’t save any client data from session to another session and that we get whatever server is available at any given time.

    Trending Bot Articles:

    1. Chatbot Trends Report 2021

    2. 4 DO’s and 3 DON’Ts for Training a Chatbot NLP Model

    3. Concierge Bot: Handle Multiple Chatbots from One Chat Screen

    4. An expert system: Conversational AI Vs Chatbots

    In order to run our code on google cloud run we have to provide it with our docker image that we will create with the build command. Make sure to execute the command in the same folder where the Dockerfile is located.

    docker build -t <docker_name> .

    Next we need to push our image to google container registry. This could be done directly in the web GUI or as we will do here, via the gcloud SDK.

    gcloud builds submit --tag gcr.io/<PROJECT-ID>/<docker_name>

    Now, we are almost ready to go. The last step is to create our cloud run service, which again could be done with either the GUI or the cloud SDK. Here we specify that we want two cpu with 4G ram in each container running our docker image.

    cloudrun_example$ gcloud run deploy chatbot 
    --image=gcr.io/$PROJECT_ID/chatbot:latest
    --platform=managed
    --concurrency=1
    --set-env-vars=MKL_NUM_THREADS=2,OMP_NUM_THREADS=2,NUMEXPR_NUM_THREADS=2
    --cpu=2
    --memory=4G
    --allow-unauthenticated

    If you set it up correctly you will receive an URL with the address to your service. Like the one below for our chatbot.

    https://chatbot-5vvmts3sdf-lz.a.run.app/

    Now, let’s try sending a CURL request to our chatbot.

    Hi, how are you?

    curl --location --request POST 'https://chatbot-5vvmts3sdf-lz.a.run.app/query' 
    -H 'Content-Type: application/json' 
    --data-raw '{"lastConversations": ["Hi, how are you?"]}'

    {“botResponse”: “i’m good. just got back from a long day at work. how are you?”}

    There we go!

    We managed to create a high performance general purpose chatbot with an associated API.

    Full code can be found here:

    Resources:

    https://huggingface.co/transformers/model_doc/blenderbot.html

    A state-of-the-art open source chatbot

    Don’t forget to give us your 👏 !


    How to build your own chatbot was originally published in Chatbots Life on Medium, where people are continuing the conversation by highlighting and responding to this story.

  • Chat bot to add all occurrences of a string.

    I am wanting to write a simple chatbot that polls a chat and adds up all occurrences of a string at the end of the day and displays how many it was.

    Example. Chat bot monitors a chat thread, check every so often for new occurrences of X and adds its to the running total. at the end of the day lets say midnight is writes a message the number of times X was mentioned that day.

    I dont really know where to start with this however I am a computer engineer and very tech savy. any insight would be great.

    submitted by /u/GrandWizardZippy
    [link] [comments]

  • Library Telegram Bot

    Here we will create a telegram bot which will send random book of given genre to user.

    We will use an open source project “draw your bot” (https://github.com/Tsitko/drawyourbot) to generate a bot. It allows to draw a bot structure in draw.io instead of coding it.

    So we need to clone drawyourbot project and install its requirements (the instructions of how to install requirements are here: https://github.com/Tsitko/drawyourbot#install-requirements).

    And we also need to register our bot in telegram (the instruction is here: https://core.telegram.org/bots#6-botfather)

    As we have a project we need a library (books sorted by genre). For this bot I will use a very small library like that:

    Project and library structure

    And we also need a function which will get one of those book so we could send it to user. Here is that function code (you should put it into bots directory to the file book_funcs.py):

    Trending Bot Articles:

    1. Chatbot Trends Report 2021

    2. 4 DO’s and 3 DON’Ts for Training a Chatbot NLP Model

    3. Concierge Bot: Handle Multiple Chatbots from One Chat Screen

    4. An expert system: Conversational AI Vs Chatbots

    And the only thing left is todraw a bot structure:

    bot structure in drawio

    You need to change bot_token to your bots token and if you are using your own function, you need to change _functions_book_funcs::find_book(genre) to your own function.

    And as you are done, you need just to generate a bot (instructions: https://github.com/Tsitko/drawyourbot#generating-bot-code).

    And you have a bot which you can run and test:

    Don’t forget to give us your 👏 !


    Library Telegram Bot was originally published in Chatbots Life on Medium, where people are continuing the conversation by highlighting and responding to this story.

  • How Chatbot’s Voice Commerce Revolutionizing Live Commerce

    In the neck-throat competition of the e-commerce industry, the business offering the best and time-savvy customer support often wins the race. It is precisely why the customer support sector has seen such a wide range of innovations in recent years.

    And even though you may feel that your e-commerce venture is foolproof, there’s always scope for improvements and refinement. The defining part of any business is how available are your services or products for the customer if they require your assistance.

    Employing a dedicated person delivering 24×7 customer service is unrealistic and expensive. That’s where chatbots solve the problem and take care of consumer needs round the clock.

    As is the rule of any conversation, chatbots are a two-way thing — that offers benefits for both brands and users. Chatbot help in interacting with new, current, and future consumers channeling them into the sales funnel without directly interacting with them. You get to send personal messages without actually hiring a dedicated person for the job.

    So what are chatbots?

    Chatbots are pre-programmed software bots that interact with customers via an automated chat interface and carefully scripted conversations. Interacting with a chatbot is like talking to real-life customer support as you get prompt replies to queries or feedback.

    And though they can be deployed for different purposes, they are primarily used in customer service-related settings. However, there’s a razor’s edge difference between a fully automated chatbot and a semi-automated chatbot as they are categorized into –

    1. Decision tree or rule-based chatbots — These Chatbots work according to a predefined set of rules fed into them beforehand. They are designed like flowcharts delivering readymade responses to problems. Rule-based chatbots are not capable of answering outside the domain of predefined rules. It is because they answer only according to the set-ups you train them for.
    2. AI or NLP (natural language processing) based chatbots — These are ML (machine learning) enabled chatbots that offer interactions just like we humans do. They respond mindfully, extracting meaning and context from previous interactions and specific phrases to provide suitable responses. NLP and ML let them learn from every interaction, enhancing their performance with every response.
    3. Multi-linguistic Chatbots — Using a combination of NLP and ML, this bot can interact within their language. Bots with this feature are capable of switching languages according to consumer’s utterances.

    Trending Bot Articles:

    1. Chatbot Trends Report 2021

    2. 4 DO’s and 3 DON’Ts for Training a Chatbot NLP Model

    3. Concierge Bot: Handle Multiple Chatbots from One Chat Screen

    4. An expert system: Conversational AI Vs Chatbots

    Decoding the link: Live Commerce & Chatbots

    Live commerce is a product of two ingredients — e-commerce and live streaming. In other words, when you market products live through e-commerce platforms utilizing real-time interaction between buyers and sellers, that is called live commerce.

    The concept first originated in China, where products were promoted and sold by influencers on their social media platforms. Live streaming emerged as an alternative for businesses to transport surplus inventory, spreading their reach, especially for small and local enterprises under prevailing pandemic conditions.

    How chatbots overhauled e-commerce?

    Cutting-edge technologies like ML and AI have marked their presence in almost every aspect of human lives. So why leave customer care untouched. Gartner had predicted that by the year 2020, more than 80 percent of client interaction in the e-commerce business would be managed using AI, which became evident.

    Today, chatbots are extremely popular in the e-commerce industry, but why let’s find out:-

    1. Surge in the use of online messaging platforms — Did you know approximately 63 percent of consumers are of the opinion of letting businesses run on messenger. That is why online messaging platforms like WhatsApp, Telegram, and Facebook Messenger etc. have become instant hit amongst people. Deploying Chatbots on these apps can prove to be a potent medium in helping consumers regardless of their presence on online portals.

    2. Dedicated support and cuts waiting time — Chatbots efficiently manoeuvre that task of giving personalized attention to every customer delivering uninterrupted customer support. They also reduce time wasted by consumers in waiting for an appropriate response.

    A survey states that roughly 40 percent of customers of all age groups favour using chatbots for online shopping. They offer instant support, available round the clock and provide complete satisfaction to clients. And 64 percent of users online find 24-hour service to be the best feature of Chatbots.

    3. Help in resuming of shopping — When people shop online they often compare several brands, and might not finalize a purchase early. Moreover, there are going to be lot of queries and page visits that may not get converted into successful deals.

    Using a conversational chatbot, you get an opportunity to get those buyers back and finalize shopping. Personalized messages can be sent via chatbot giving product recommendations, similar products, discounts and offers etc. This gives you an opportunity to build profits and earn money from a deal as good as lost.

    4. Minimizing operational overheads — The money and manpower that you would have invested in employing a customer support executives is reduced by using a single software agent for your business. Chatbots are said to reduce operational cost by up to 30 percent.

    5. Product Notifications — Sending suggestion and recommendations through mails and other means becomes somewhat repetitive and uninteresting. Instead brands can utilize chatbots for advertising products in real-time which seem more appealing and conversational.

    6. Order Processing and tracking — Customers can even make online purchases through bots and check information about their product without visiting the site directly. They can even track their purchase using a bot without having to call a customer executive or posting a query online

    7. Holiday Promotions — Remember ecommerce bots work on ML and AI. Therefore they learn and keep track of your queries and suggestions. This way they help buyers look for specific products more easily.

    Bots in travel sites work in this manner, they look for destinations and sites entered by you. They even compare prices, checks reviews and offer the best decision. They can be deployed for delivering offers and discounts and even promote holiday packages.

    8. Choosing the best chatbot — There are lot of options available while choosing a right chatbot for your venture. It is always recommended to make final selection after proper research and analysing the requirements. The following points should be kept in mind before coming to any conclusion

    • Information repository — If you want your chatbot to work as a self-sufficient tool then it should have a rich repository of knowledge. The repository should be well framed and should have scope for all scenarios. If you can assimilate the information repository with your chatbot, this can prove to be good solution.

    Third-party integrations — To enable your chatbot to process business automation smoothly and resolve recurring issues, it needs third-party integration with different applications like inventory management, CRM, software management, etc.

    • Code free bot builder — An intelligent code free bot builder is the best option to develop bot workflows. A ready to use bot builder is basically multiple nested if-then-else conditions which try covering all scenarios.
    • Detailed analysis — A good reporting mechanism and analytics are required for Chatbot optimization. A typical Chatbot solution will give detailed analysis along with reports that can be utilized for measuring performance.

    9. Optimising social media marketing and other channels — Already crossing the mark of 3.5 billion user mark, social media is now one of the most powerful digital marketing tools. By integrating chatbots to your social media and other channel marketing strategies you can just imagine the impact it can create for your business and brand.

    Future looks bright for Live Commerce with chatbots

    Live streaming e-commerce is a rapidly growing industry. Statistics reveal the annual growth has reached nearly $60 billion. Successful deals obtained via live commerce reach about 100 percent mark in 2020 unlike 2019 which was almost 9 percent of total sales online.

    Chatbots significantly alter how businesses are done, be it engaging customers, handling campaigns, converting sales, lead generation, or payment automation.

    The future of chatbots is intensely moving towards payment automation and allowing consumers to make payments directly over live chat or messenger apps.

    Recently, MasterCard launched a chatbot, especially for customer payments, to answer account-related queries, assist customers in setting payment alerts, and collecting final payments from customers.

    Live e-commerce and interactive commerce are the future of the retail industry. The chatbots are forecasted to double this impact every year to a whopping $112 billion by 2023. And businesses that have invested in conversational commerce early witnessed a steep rise in profits, deal conversions, and optimizing resources.

    Don’t forget to give us your 👏 !


    How Chatbot’s Voice Commerce Revolutionizing Live Commerce was originally published in Chatbots Life on Medium, where people are continuing the conversation by highlighting and responding to this story.

  • Support Telegram Bot For Github Project

    Here we will build a support telegram bot which will search users question keywords in your Readme.md and will send a link to the most relevant part of your md to the user.

    We will use an open source project “draw your bot” (https://github.com/Tsitko/drawyourbot) to generate a bot. It allows to draw a bot structure in draw.io instead of coding it.

    So we need to clone drawyourbot project and install its requirements (the instructions of how to install requirements are here: https://github.com/Tsitko/drawyourbot#install-requirements).

    And we also need to register our bot in telegram (the instruction is here: https://core.telegram.org/bots#6-botfather)

    To search in Readme.md we will use a function from draw your bot standardfucs (https://github.com/Tsitko/drawyourbot#search_md). But you can use your own function (just code that function, add and add a .py file with that function to ‘bots’ folder).

    And as we have a draw your bot project and a function to search in md file, we only need to draw our bot structure in draw.io:

    drawio source: https://github.com/Tsitko/drawyourbot/blob/main/examples/support_md.drawio

    You need to change bot_token to your bots token and if you are using your own function, you need to change _functions_standardfuncs::search_md(query, “https://github.com/Tsitko/drawyourbot/blob/main/README.md”) to your own function.

    If you are ok to use the standard search_md function, you just need to change https://github.com/Tsitko/drawyourbot/blob/main/README.md to the link to your projects md.

    So the bot will just ask the user what he/she is looking for and will get the user’s answer. After that it will find a link to the part of your Readme.md which is the most relevant to the user (if it will not find such a part it will return a link to Readme.md start line). And in the end it will ask the user to push /start command if he wants to search again. The /start command is to start from the first message (what are you looking for?).

    Trending Bot Articles:

    1. Chatbot Trends Report 2021

    2. 4 DO’s and 3 DON’Ts for Training a Chatbot NLP Model

    3. Concierge Bot: Handle Multiple Chatbots from One Chat Screen

    4. An expert system: Conversational AI Vs Chatbots

    And as you are done, you need just to generate a bot (instructions: https://github.com/Tsitko/drawyourbot#generating-bot-code).

    And you have a bot which you can run and test:

    Don’t forget to give us your 👏 !


    Support Telegram Bot For Github Project was originally published in Chatbots Life on Medium, where people are continuing the conversation by highlighting and responding to this story.

  • How to use custom logic with Chatbot frameworks

    I am working on a Chatbot, I have implemented it with Dialogflow (Dialogflow ES). I found that Dialogflow has the following Pros

    • Easy to use
    • Good at Intent classification
    • Good at extracting Entities (prebuilt/custom)
    • Conversations can be chained to a certain extent using input/output contexts and lifespan
    • Less flexible

    But in my use case, there are certain situations where human level judgment is required and it cannot be done using Dialogflow. Can we add our custom logic to process certain user requests in Dialogflow or any other Chatbot framework which provide more flexibility

    submitted by /u/arush1836
    [link] [comments]