Hi @Subrahmanyam, thank you for the detailed information.
I have followed the mentioned steps, and here is my observation,
Scenario-1:
Tried by providing content-type as application/json and body as Custom
Executed the API as expected.
Moved out of service node and came back again
Observed “Custom” changed to “application/json” and showing error in the payload
Scenario-2: (Just tried, not recommended)
Tried by not providing the content-type, but body as Custom
Error thrown by Kore regarding Content-Type.
But there is one more scenario I want to try with is, use Script node to prepare payload, save it in context variable and use the variable as payload for content type “application/json”. I have yet to try it, I’ll let you know the update.
Thanks @karthik.nagulapally. While we look into the observations you have with the request type on bot builder, we are happy your issue is resolved and you are able to execute the API fine during run time.
@shobhit1.singh, I see the data under body of service node coming as text with some xml tags in it. You could possibly create a JS node to create a context variable and store the extracted value “Incident Created Successfully” from the body of the service node by trimming off the rest of the data. Further you would be able to use this variable to print the message at the message node.
Thanks @Subrahmanyam. I have created script node to fetch the body response from service node.
and passing below script in Add script window.
(Sample response I already attached in my previous post)
Further checked on this from my side,
I am able to print the jsonstringobj in message node successfully with below script.
var jsonstringobj = JSON.stringify(context.CallINCService);
print(“This is your ticket information” +jsonstringobj);
and this is the output from BOT for message node:
{“response”:{“statusCode”:200,“body”:“Incident Created Successfully”,“headers”:{“date”:“Thu, 07 Feb 2019 12:38:05 GMT”,“x-powered-by”:“Servlet/3.0”,“connection”:“close”,“transfer-encoding”:“chunked”,“content-type”:“text/plain”,“content-language”:“en-US”}}}
But when I am trying to print the body response with below script, it is failing with following error
print(“This is your ticket information” +jsonstringobj.response.body);
Why it is saying, "can not property response and body and undefined.
Please help me on this. We are following on this since last 3-4 days.
Hi @m.satish512, Could you please use a script node at the dialog to apply logic, store the result onto a context variable and then send it directly from the payload being sent at service node?
Do you mean while you test the service? No, because the intention here is to test the service by providing inputs as needed. During runtime, the values would be picked from context as they were defined.