Author: Franz Malten Buemann

  • Dialogflow Tutorial: Increase webhook timeout limit of 5 seconds using Python

    In Dialogflow you can create agent responses in two ways first ‘static’ response by adding details in the console itself for the basic functionality and second is a dynamic response by managing Fulfillment through the web service called the webhook service. You can create a more complex and flexible conversation flow by webhook service.

    For Dialogflow, the webhook service needs to accept JSON requests and return JSON response as per specified guidelines by Dialogflow.

    What is the Webhook Deadline?

    In the Dialogflow documentation, there are some limitations given to send your webhook response.

    1. The response must occur within 10 seconds for Google Assistant applications.
    2. The response must occur within 5 seconds for other applications.
    3. The response must be less than or equal to 64 KiB in size.

    If the above limitations are not fulfilled then the webhook request will time out and give the error: “Webhook call failed. Error: DEADLINE_EXCEEDED”, which you can see in Fulfillment status.

    How can we extend the webhook deadline?

    As per Dialogflow guidelines given for the “custom event” which can be invoked for time alert during in conversation. This event could help to trigger an intent that alerts the end-user. We are using the concept of the “custom event” for time alert to extend the webhook deadline.

    By creating “custom event” we are managing time such that it cannot increase the given guideline “time limitation” for the webhook response (Technically we have 5 seconds time limits per intent to manage the timing). For that, we need to set up the webhook response for “followupEventInput”( Click here to check the “followupEventInput” JSON response). When “followupEventInput” is set for the webhook response, Dialogflow ignores all other fields of response as given in Dialogflow documentation.

    Here we extend time up to 10 seconds by creating a chain of two “followupEventInput” for the welcome intent. Follow the below instruction to implement it.

    Install Virtual Environment by using below command:

    sudo apt install virtualenv

    Create and Activate Virtual environment:

    • Run below command to create a virtual environment.
    virtualenv followup_env --python=python3
    • Activate it by using the below command.
    source followup_env/bin/activate

    Install Libraries:

    • Install flask module using below command:
    pip install Flask
    • Install Datetime library
    pip install DateTime

    You can find the code snippet for extending the webhook deadline in this GitHub repository: extend-dialogflow-webhook-deadline-time

    Basically, in the code, we are creating a chain of two “followupEventInput” for “welcome intent” means total three intents are created one “welcome intent” and two intents for the “followupEventinput”. From the last intent, we have got the webhook response if it accurately works.

    Trending Bot Articles:

    1. How Chatbots and Email Marketing Integration Can Help Your Business

    2. Why Chatbots could be the next big thing for SMEs

    3. My Journey into Conversation Design

    4. Practical NLP for language learning

    We are making one condition by comparing the current time with the extended time of 3 seconds for generating a normal webhook response and managing per intent calling time. And then we break this condition by adding a time delay of 3.5 seconds per intents so that “followup” event occurs for a particular intent. You can also play with the command “time.sleep()” to increase delay, but for us, it accurately works for the value of 3.5 seconds.

    DialogFlow Setup:

    Sign-in into Dialogflow console and create a new agent. Give the Agent name as you like. You will find the below screen for the new agent:

    Now click on ‘Default Welcome Intent’ enable webhook response as shown in the below screenshot:

    Create a first intent followup_event by filling below details. In that detail, the event name set inside the code and Action and parameters value we are using in code for making the condition.

    Create other intent for followup event number 2 by giving below details as shown in the screenshots.

    Setup Ngrok and add Fulfillment to run webhook:

    • Follow the steps to install ngrok.https://ngrok.com/download.
    • Run below command to start ngrok and you can see the below screen:
    ./ngrok http 5000

    Add Fulfillment in Dialogflow:

    • In the DialogFlow left side menu click on the ‘Fulfillment’ then enable ‘Webhook’ from the main page of Fulfillment.
    • Now add the URL with ‘/webhook/’ like https://55a98356.ngrok.io/webhook/ then save it. If you provide a URL without a webhook then you may get an error like “Webhook call failed. Error: 405 Method Not Allowed.”.

    Testing in Dialogflow Simulator:

    Now run the code snippet for extending the webhook deadline in the command terminal.

    By testing in Simulator with ‘hi’ you will find the below screen for Dialogflow.

    By clicking on “DIAGNOSTIC INFO” and in that “RAW API response” you will find accumulated webhook latency time near 13 seconds as shown in the below screen. Sometimes if latency time for webhook per intent is larger than 5 seconds then the output may not come from the webhook for the followup event.

    By using followup events we can extend the webhook deadline limit.

    Don’t forget to give us your 👏 !


    Dialogflow Tutorial: Increase webhook timeout limit of 5 seconds using Python was originally published in Chatbots Life on Medium, where people are continuing the conversation by highlighting and responding to this story.

  • 10 Effective Chatbot Types To Look In 2021

    Hey! I came across this article and found it very interesting, so whosoever is interested in #chatbots this article is for you. Check out: https://botsify.com/blog/chatbot-types/

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

  • has anybody made a chatbot that can play rts games

    has anybody made a female chatbot that plays a rts game with you and increases the level of difficulty

    if you beat it enough?

    it can talk to you while it plays the game with you.

    i think it would be very entertaining

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

  • Real Estate Agent’s ChatBot

    Has anyone here have seen really good chatbot for real estate agents website ? Or someone who build it

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

  • How You Can Evaluate Your Customer Service Chatbot For The Best Business Results

    Regularly analyzing and measuring Key Performance Indicators can help you evaluate your customer service chatbot for superior performance.

  • 9 Reasons Why Low-Code/No-Code Platform Is the Best Choice for Increasing Adoption of Virtual…

    Low-code comprises a slew of solutions that are harnessed to build complete applications via visual drag-and-drop interface instead of…

  • AI CHATBOTS to improve customer service costs

    Businesses spend nearly 1 trillion in customer service costs each year. Customer support executives spend most of their time in a day…

  • Using Epic’s MetaHuman to put a face on chatbots

    Hey All! We want to build a solution to let people talk to chatbots face-to-face. This video is a quick proof of concept to have a better picture. What do you think? Do you think it can be useful in some industries? We are trying to find a place where we test it to see people’s reaction.

    https://reddit.com/link/mc1t7p/video/lqam53al6yo61/player

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

  • Using AR and chatbots to increase customer engagement

    Customers seek personalization while shopping for products. With most of the purchasing happening online, businesses are turning to advanced technologies to facilitate more interactive and engaging buying experiences for their customers.

    https://botcore.ai/blog/augmented-reality-chatbots

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