I want to generate dynamic links with payload

hello everyone, here is the brief of the job that I want to do:

  1. User provides name and email address. It gets stored for that specific user and a link is generated where the url contains a payload ( the user id of that user).
  2. when any other user clicks on that link, the chatbot will show that data of that specific user.

It would be really great if anyone could help me get started with it.

Welcome to the forum :slight_smile:

You need to create a Form which asks for the name and email as Slots, which will get saved in memory.

The name should have a from_text Slot Mapping. The email could also have a from_text Slot Mapping, but I suggest using from_entity Slot Mapping, with the email Entity recognized using a Regular Expression.

When the user fills these two slots, the bot should activate a Response or Custom Action, as defined in the story for Form Deactivation.

This Response or Custom Action will read the slots value. From what I understood, you want to generate a URL with the ID of the user, so you either want to create a new unique ID or retrieve it from a database according to the email. That means you will have to use a Custom Action.

Custom Actions are just regular Python code you can run as a response to an Intent. In this Custom Action, you can access the name and email Slots with tracker.get_slot() (e.g. tracker.get_slot('name')), and do whatever you want with that information.

When you finish your code and generated a URL, you can display the message back to the user with dispatcher.utter_message(text = "www.example.com").

For what’s inside the link, that’s unrelated to Rasa :slight_smile:

1 Like

thanks a lot for this detailed and specific guide.

But if I connect it to a django website, then how can I receive information from a url paramter ( where there will be the user id payload ) and use it to retrieve information from rasa?

Inside Custom Actions, since you can write any regular Python code, upload the relevant information in a database, then query that database from the website