Hi, I am trying to build a chat test capability, Using generic HTTP/JSON interface for this need to call a external API to fetch a conversation id and set in the header/body of the chat bot request to be sent.
For this I am trying to create a custom hook in advanced option to call the API and set the result into the container variable but not sure how to access and set in the bot request headers. Can you please help or provide a sample which I can use to access the field in setting request headers or body. Can I set the result from Custom Hook into context or other variable (Implementing Token-Based Authentication for Test Cases - Botium Wiki)
Also tried to call the API using the Request Hook in the UI, but it throws a error stating ârequestâ function not found when trying to call a external API. Is there a example to show how the request hook can be used to fetch the REST API response value and set into Header or body.
2022-05-17T08:49:55.347Z botium-core-Convo BotiumError: chatbothello/Line 2: error sending to bot - request is not a function
I cannot use the Session Setup configuration option to set the value as I have a separate API call to be made to get token.
{
âAcceptâ: âapplication/jsonâ,
âAuthorizationâ: âBearer {{context.access_token}}â,
âbotâ: "##Need to set the value here dynamically, which is fetched from a external API## "
}
Please let know if more information is required