As an admin user, you can load a different flow studio flow based on the webpage the chatbot user launches the chatbot from. This document will brief you on how to use the URL Parameters and Query Strings in your Experience Designer flows.
URL Parameter
Defining a URL Parameter
You should first define a variable in URL/Endpoint fields of the http in nodes and the Bot View Template node.
<chatbot endpoint>/:<variable-name>
The URL Parameter used in the chatbot URL will be available at msg.req.params.<variable-name>
In the Bot In Parser of the Bot Provider V2 Node, you should assign the fetched URL Parameter to the originalRequest
object.
msg.payload.originalRequest.data.<userPARAM> = msg.req.params.<variable-name>;
Using the URL Parameter
You can then obtain the URL Parameter in the msg object at msg.payload.originalDetectIntentRequest.payload.<userdefined variable>
Invoking the Chatbot with the URL parameter
You can add any string as the URL Parameter to the Chatbot URL.
https://<domain-name>.orbita.cloud:8443/oeapi/<ChatbotURI>/<URL Parameter>
For example, you can use the https://<domain-name>.orbita.cloud:8443/oeapi/<ChatbotURI>/button to invoke the corresponding flow studio flow.
If you have defined a URL Parameter, you cannot load the chatbot without a URL Parameter.
Query strings
Defining a query parameter
The query params used in the chatbot URL will be available at msg.req.query.<query parameter>
In the Bot In Parser of the Bot Provider V2 Node, you should assign the fetched Query to the originalRequest
object.
msg.payload.originalRequest.data.<userdefined variable>=msg.req.query.<query parameter>;
Using the query
You can then obtain the Query value in the msg object at msg.payload.originalDetectIntentRequest.payload.<userdefined variable>
Invoking the Chatbot with the query parameter
You can add the query parameter to the Chatbot URL.
https://<domain-name>.orbita.cloud:8443/oeapi/<ChatbotURI>?<queryparameter>=<query value>
For example, you can use https://<domain-name>.orbita.cloud:8443/oeapi/bot/url-params?flowId=5fe082b28e97c439b7206355
Sample flow
Import the flow attached to this document.
After importing the flow, ensure you do the following:
Disable any other Bot Manager flows you have in the project.
Doubleclick on the Bot Manager flow tab.
Set the status to “Disabled“.
Delete the launch node in the Launch flow.