Transforming input
# support
s
Hi, I am trying to build something a s pre booking agent. Once the caller tells a source name , i want to transform that text to a integer so i can pass the sourceId in my API
k
To transform a source name into a source ID, you can either use dynamic variables for a static list of sources or implement a custom tool that queries an API to retrieve the source ID dynamically.
s
how to use dynamic variables in workflow
k
define it in nodes using {{variableName}}, set their values dynamically in the API request, and incorporate them into workflow logic for personalized interactions.
s
How can i transform, for eg. how HoChiMinh is replaced with 123456
and call api.google.com/{{sourceId}}/
k
Map the source name to its ID using dynamic variables or a custom tool, then construct and call the API URL
s
hey, can you help me with documentation of dynamic variables
Thank you in advance
k
s
ok, I am sorry my query is misunderstood here. I am asking user to say the name , and user responds with HoChiMinh, in my api call, so i have to replace HoChiMinh by a id(number) and pass it as parameter
k
Hey, it's straightforward: You have to ask the user first for its name and then store that in a some kind of virtual variable. Later, when you trigger the call using prompting, you can pass that variable which will be then passed to your tool call as a parameter.
example
1. Ask: "what is your name" and store it in {{customer.name}} 2. trigger the tool toolName with {{customer.name}} You can extend the above example for as many parameters as you require. Let me know how it goes for you.
s
Hey Shubham, my problem is while I ask the customer.name, i have to pass the customer.id , as i have a mapping
k
If the agent has access to the customer table or database, make a prompt to fetch the [customer.ID](http://customer.ID) that matches [customer.name](http://customer.name). I am sure there is some way to do a lookup either with an assistant tool. Once you have the [customer.name](http://customer.name) stored as a variable, you can use that variable to fetch the [customer.ID](http://customer.ID) first, then pass that [customer.ID](http://customer.ID) to whatever you are going to use it for. if you would like more help on this, we would like some more info on your workflow, data points with diagrams, etc.