Injecting data¶
When your users are logged in your website, it may be interesting to inject some of their session's data to adapt your assistant responses.
Such data needs to be injected in the originalRequest field of your injection script :
<script type="text/javascript">
injectWegobot({
botId: "...",
apiCredentials: {...},
originalRequest: {
clientName: {
firstName: "Pierre",
basket: "50€",
email: "pierre@prisme.ai"
},
},
});
</script>
Please be aware of the first "clientName" subfield : you can name it as you like, as long as it is present.
Thus, every fields injected in clientName will be accessible from any intent declaring originalRequest in its input contexts.
After declaring originalRequest in your input contexts, it is now possible to access any of your injected data with parameters whose value is prefixed with #originalRequest.
For instance, in order to use the email in your intent, you would create a new parameter with its value as #originalRequest.email
.