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.
You can use the params and queries passed from the chatbot URL to customize your flow in the Experience Designer.
For example, you can initiate the flow studio based on the flowId
passed in the chatbot URL.
Table of Contents | ||
---|---|---|
|
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.
Code Block |
---|
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>
For example, it is msg.payload.originalDetectIntentRequest.payload.URLPARAM
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.
Warning |
---|
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.
In this example, we are assigning the obtained flowId to the originalRequest
object.
Code Block |
---|
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.
...
In this example, we will assign the flowId to msg.payload.flowId
in the function node connected to the Flow Manager node in the Experience Designer.
...
<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
...
...
Import the sample flow attached to this document into the Experience Designer.
Note |
---|
After importing the |
...
flow into the Experience Designer, ensure you do the following:
|
...
|
You can use any string as a URL Parameter, a Flow ID, and a Control ID in the URL Query String.
Below is an example of the chatbot URL.
Attachments | ||||||||
---|---|---|---|---|---|---|---|---|
|
Related Articles
Filter by label (Content by label) | ||||||||
---|---|---|---|---|---|---|---|---|
|