Can be used to call a custom HTTP API and inject the response content into the Botium processing pipeline.
In this sample, the Scripting Memory function $msg is used to extract the chatbot text response from the message (JSON-Path expression $.messageText) and hand it over to an API call. The body field of the response is then again injected into the messageText field which will be used from this point on in the Botium pipeline as text response (for doing assertions).
Usage in BotiumScript - HTTP GET
echo
#me
give me 2
#bot
SETFROMHTTPGET https://jsonplaceholder.typicode.com/posts/$msg($.messageText) | $.body | messageText
Usage in BotiumScript - HTTP POST with Body
echo
#me
give me something
#bot
SETFROMHTTPPOST https://jsonplaceholder.typicode.com/posts | { "title": "$msg($.messageText)", "body": "$msg($.messageText)", "userId": 1 } | $.body | messageText
You said: give me something
Note: You can leave the second parameter empty to send an empty POST
body.
Usage in Botium

Comments
0 comments
Please sign in to leave a comment.