How 2 Integrate Dynamic links in Rasa chatbot


In this era where technology is advancing every second where lagging behind means your life stuck at this stage. So being static is like being a stone that doesn’t move itself.

To be the part of this era and to be the one to be known and to be successful, you have to be dynamic so as our inventions too. For this specific reason you are here to learn how to be dynamic and to do dynamic links(inventions).


In this post, you will learn all about the actions in Rasa and also how to use the actions file with Rasa chatbot. Also, you will learn how to modify it in the domain and the stories file to make it work and how to add the dynamic links to the Rasa chatbot so as to update it in real-time, unlike the static links.

To watch this full tutorial and it’s working in action for dynamic links then do check out this session to know more.

Introduction to Dynamic Links

Dynamic Links are links that work the way you want, on multiple platforms, and whether or not your app is already installed. With Dynamic Links, your users get the best available experience for the platform they open your link on.

In this post, you will understand how to update the rasa chatbot files to get this task done. For this task, we have to add the file and also to start the actions server to get this part done.

Now what is actions in rasa and how to use it here?

Actions are the tasks, your bot runs in response to user input. There are four kinds of actions in Rasa:

  • Utterance actions: start with utter_ and send a specific message to the user
  • Retrieval actions: start with respond_ and send a message selected by a retrieval model
  • Custom actions: run arbitrary code and send any number of messages (or none).
  • Default actions: e.g. action_listen, action_restart, action_default_fallback


In the previous posts, we may have seen how to use the actions in response to the user’s input for example utter_greet. So this was one of the actions that we have set for the bot to reply in response to the user’s input. Similarly, there are other actions as well that we will see in today’s post as well as in the upcoming posts. In this post, we will learn how to use the custom actions(to get dynamic links) for the bot’s response. An example of the custom actions is actions_hello_world.

Now to create a custom action we have to add the custom python script and also to update the stories as per the actions created in the file. Domain file will also be updated to add the dynamic links to make the change in the bot’s response in real time.

Firstly, we will update the file that was created during the initialization of the project. For the first time when you will see your file, you will notice that all the lines have been commented and there is nothing that will work. So to make it work we will update the file and for now, add the following lines of code in the file:

from typing import Any, Text, Dict, List
from rasa_sdk import Action, Tracker
from rasa_sdk.executor import CollectingDispatcher
class ActionHelloWorld(Action):
def name(self) -> Text:
return "action_dynamic_link"
def run(self, dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
# dispatcher.utter_message(text="Hello World!")
print("Link: ",tracker.get_slot('LINK'))
return []

and along with this, you have to update the endpoints.yml file to make this action file sun and also to start the action server. In the endpointys.yml file uncomment the following lines and save the file:

url: "http://localhost:5055/webhook"

If you are not food at python and don’t wanna miss this amazing topic then I have a good news for you. Here is a link for you to learn python on your own so that you will miss any topic of this amazing session. To learn python programming check out this link:

Now when you have created the actions in the file now update the domain.yml file as per the actions created. Add the following lines in the actions block in the domain.yml file:

- action_dynamic_link

Also, you have to update the utter_ template where you want to add the dynamic links that will make changes in real-time

	- text: Here is the link to our website {link}

When the domain file is updated it’s time to update the stories as per the actions specified and updated. As per our conversation between the bot we have to make changes in the file in such a way:

## happy info path
* more_info
- action_dynamic_link

As this story was a separate part of the complete conversational flow so this story was created separately without conflicting the other stories.

In this way, we have updated the complete rasa chatbot. Now it’s time to train the model and to check its working in real-time.

$ rasa train
$ rasa x

The output for the above changes will look something like this:

dynamic links in rasa chatbot

Time to wrap up now. Hope you liked our content on How to integrate dynamic links in Rasa chatbot. See you in our next blog, thanks for reading our blog and do leave a comment below to help us improve the content to serve you all of our experience with you. Stay tuned with us for more Rasa Chatbot contents.

Also check out our other playlist Rasa Chatbot, Internet of things, Docker, Python Programming, etc.
Become a member of our social family on youtube here.

Till then stay tuned and happy learning 🤗

Ashish Saini
Ashish Saini

I am a software developer for Python/Machine Learning. Also, I’m Rasa Hero at Rasa. Also, I’m a youtuber where I regulary uploads the videos to help this generation learn about the technology just like they are playing games.

Leave a Reply