I have a topic in AI Copilot Studio that uses HTTP Request. IT is calling a simple service, is_timecode, that takes a single parameter string and returns a true or false boolean. Everything is working well except the status code. I have set the status code within the HTTP request to a variable, status_code, but it doesn't seem to be set except when there is an error code. I would like to validate the status code is set to 200 and then process the boolean value in the result. When I read through the documentation Perform HTTP requests - Microsoft Copilot Studio | Microsoft Learn it implies this status code is only returned for errors. I find that a very odd design.
Can you advise if I'm misunderstanding how the status code is meant to be used for HTTP Request? My sample YAML below. Also, my web service returns the status code in the following python code:
return jsonify(result), 200 # Return the JSONified response
kind: AdaptiveDialog
beginDialog:
kind: OnRecognizedIntent
id: main
intent:
triggerQueries:
- Is {Timecode} a timecode?
- I wonder if {Timecode} is a timecode.
- "{Timecode} is it a timecode?"
actions:
- kind: SetVariable
id: setVariable_Ir3szb
variable: Topic.timecode_val
value: 00:01:01:01
- kind: HttpRequestAction
id: NjzNn8
method: Post
headers:
Content-Type: application/json
body:
kind: JsonRequestContent
content: "={timecode: Topic.timecode_val}"
errorHandling:
kind: ContinueOnErrorBehavior
statusCode: Topic.status_code
errorResponseBody: Topic.status_response
requestTimeoutInMilliseconds: 30000
response: Topic.is_timecode
responseSchema: Boolean
responseHeaders: Topic.response_headers
- kind: SendActivity
id: sendActivity_v4VHN4
activity: "{Topic.status_code}"
- kind: SendActivity
id: sendActivity_3GXuts
activity: testing
- kind: SendActivity
id: sendActivity_reBrOd
activity: "{Topic.is_timecode}"
- kind: ConditionGroup
id: conditionGroup_IBQejZ
conditions:
- id: conditionItem_yfhf0a
condition: =Topic.status_code = 200
actions:
- kind: ConditionGroup
id: conditionGroup_6wmHt9
conditions:
- id: conditionItem_cPZ866
condition: =Topic.is_timecode = true
actions:
- kind: SendActivity
id: sendActivity_Uf2gdD
activity: It is a timecode
elseActions:
- kind: SendActivity
id: sendActivity_LdAVhc
activity: It is not a timecode.
elseActions:
- kind: SendActivity
id: sendActivity_bVzjdj
activity: An error occurred.
- kind: EndDialog
id: fuQb7i
outputType:
properties:
is_timecode:
displayName: is_timecode
type: Boolean