Rules to Better Bots

Bots promote an effective and productive work place. Many companies are already using them more than regular 'search' functionality.

Want to build a Bot? 

Check SSW's Bots Consulting page​.

Hold on a second! How would you like to view this content?
Just the title! A brief blurb! Gimme everything!



  1. Do you add a Bot signature to make it clear when an email is automated?

    ​With the advent of Microsoft Flow and Logic Apps, automated emails are becoming more common. And in fact any reminder or notification email you find yourself sending regularly should probably be automated. 

    However, the end user should be able to tell that this was sent by a bot, and not a real person, both for transparency, and also to potentially trigger them to automate some of their own workflow.​

    Hi All,

    The maximum temperature for today is 32.
    Feel free to wear shorts if you like 🌞 (hope you haven't skipped leg day 😜)​
    If you decide against it, then don't forget the SSW dress code applies as usual (e.g. dress up on Monday and Tuesday - no jeans).
    Today's forecast:
    Patchy fog early this morning, mostly in the south, then sunny. Light winds becoming northwesterly 15 to 25 km/h in the afternoon.

    Uly
    --Powered by SSW.Shorts

    <This email was sent as per: http://rules.ssw.com.au/do-you-have-a-dress-code >

    ​​Figure: Good Example – you can clearly see this was sent by a bot
  2. Do you keep your serverless application warm (to avoid cold starts)?

    When designing your Bot, you will very likely leverage some Bot Frameworks or AI Services to take care of the Natural Language Processing (NLP) so that you can focus on implementing your business logic.
    To host your business logic, it is common to use serverless applications such as Azure Function, Google Firebase or Amazon Web Service Lambda Functions. Serverless applications come with amazing scaling abilities and simplified programming models, but they also suffer from at least one well-known side-effect that is commonly referred to as Cold Starts.  


    Here are some recommended solutions to eliminate Cold Starts:
     
    Microsoft Azure Functions
    • ​Add warm-up request

           Use a timer trigger function to keep the Azure Functions application warm. If you know that at a certain time of a day the Function App is likely to be cold and so you wake it up just before you expect users to send out requests. ​​

    • Move to App Service Plan
           Azure Functions can be hosted using dedicated App Service Plans instead of the serverless Consumption plan. Now you no longer need to worry about cold starts since the compute resource is always available and ready. The only caveat is that the Azure Functions won't automatically scale out as they do with the Consumption plan. So, think ahead and measure your compute requirements, and make the right decision.
     
    • Upgrade to Premium Plan
           If you want a dedicated instance that is always available and ready, and you also require the ability to automatically scale out under high try the Azure Functions Premium Plan (preview). The premium plan always has at least 1 core ready to process requests and your application will not suffer from cold starts. The premium plan does come at a price, so plan ahead.
     

    Firebase Functions on Google Cloud Platform
    • In Node.js code, export all the functions your want to deploy to cloud functions. And import / require dependencies inside the function. So that each function call will only load the dependency it needs instead of loading all dependencies in the index.ts file.
    • ​Warm up request - Create a separate function that works on a timer. The function can run at some time interval that you know your app will not be cold.
    • If cold starts are unbearable, convert to other infrastructure such as App Engine .
     
    Amazon Web Service
    • Instead of using statically typed programming languages like Java and C#, you may prefer dynamically typed languages like Python, Node.js etc.
    • Avoid deploying Lambdas in Amazon Virtual Private Cloud (VPC).
    • Avoid making HTTPS or TCP client calls inside your lambda. Handshake or other security related calls are CPU bound and will increase the cold starts to your function.
    • Send dummy requests to your functions with some frequency.
    1. Make necessary changes on your Lambda to distinguish warm-up calls from customer calls.
    2. Be mindful about the potential drawbacks of the warm-up requests
                2.1 Warm-up calls will potentially keep all your containers busy and a real customer request could not find a place to run
                2.2 A Lambda function in one container can catch all calls at once and this can make other containers down after a while
  3. Do you vary your responses?

    People don’t act like robots and answer the same way all the time. Neither should bots!  All you need is a few different welcome messages and use a rand() function.
    ​​​bots-responses.jpg
    Figure: Good examples - Different welcome messages​​
    Read more about Do you vary your responses?