Hello,
using a HTTP request that returns a simple JSON string. Regardless of how I tried to return the JSON i am always getting the following message :
Error Message: The provided value for path ‘Topic.Var1’ cannot be parsed into ‘RecordDataType’ type. Provided value: “{”“msg”“:”“Welcome, how can i help you ?”“,”“name”“:”“”“,”“timestamp”“:1700574123}” Error Code: ValueParsingError Conversation Id: 0b50d6ad-54f9-4884-9823-04a737136450 Time (UTC): 2023-11-21T13:42:03.078Z
For simplicity, The JSON response does not require any headers and/or body data to be returned, it is always returned on every request.
This is the JSON string :
{"msg":"Welcome, how can i help you ?","name":"alexggg","timestamp":1700574256}
What do I need to adjust in order to make this work ?
Thank you for your help.
Same issue, tried with above solution. didnt work
Thank you for your help. The headers were incorrect and needed to be set to :
Content-Type: application/json; charset=utf8
Thanks @GTMRA
I think you get this error because your API returns your JSON as text/html; charset=utf-8 and not as JSON (I was initially puzzled in Postman as it wouldn't format the content nicely).
To work around this, you can switch to the code editor view and update your HTTP request node to set the responseSchema to Any
You can then parse it with the desired schema in a subsequent Parse value node:
And it now works:
I can't repro, I guess because I don't have access to the API.
Error Message: HTTP request failed with status code 403 Forbidden. Error Code: HttpRequestFailure Conversation Id: ba2ff1c9-382c-4939-ac82-91bb35f20b8b Time (UTC): 2023-11-21T14:36:37.860Z
Are you use the API returns a clean JSON? What does the GET request look like when you open https://chatapp.azurewebsites.net/chat.php in your browser or in Postman?
here is the YAML file.
kind: AdaptiveDialog
beginDialog:
kind: OnConversationStart
id: main
actions:
- kind: SendActivity
id: sendActivity_xPPdyN
activity: Hello, I'm {System.Bot.Name}. I am a virtual agent.
- kind: Question
id: question_WRJgdJ
interruptionPolicy:
allowInterruption: true
variable: init:Global.PersonName
prompt: What is your name ?
entity: PersonNamePrebuiltEntity
- kind: Question
id: question_8mECkK
interruptionPolicy:
allowInterruption: true
variable: init:Global.WhatToDo
prompt: |-
Welcome to the chat, {Global.PersonName}.
What would you like to do?
entity:
kind: EmbeddedEntity
definition:
kind: ClosedListEntity
items:
- id: Chat with an agent
displayName: Chat with an agent
- id: Book an appointment
displayName: Book an appointment
- id: JSON
displayName: JSON
- kind: ConditionGroup
id: conditionGroup_YSBOAU
conditions:
- id: conditionItem_KTHAdC
condition: =Global.WhatToDo = 'cr437_testBot.topic.ConversationStart.main.question_8mECkK'.'Chat with an agent'
actions:
- kind: SendActivity
id: sendActivity_7gMyb9
activity: " Connecting you with an agent {Global.PersonName}, please hold on..."
- kind: TransferConversationV2
id: lyokrx
transferType:
kind: TransferToAgent
messageToAgent: test
- id: conditionItem_zx15MA
condition: =Global.WhatToDo = 'cr437_testBot.topic.ConversationStart.main.question_8mECkK'.'Book an appointment'
actions:
- kind: SendActivity
id: sendActivity_nACezM
activity: link to book an appointment
- id: conditionItem_qe25v3
condition: =Global.WhatToDo = 'cr437_testBot.topic.ConversationStart.main.question_8mECkK'.JSON
actions:
- kind: HttpRequestAction
id: xg1CKA
url: https://chatapp.azurewebsites.net/chat.php
response: Topic.Var1
responseSchema:
kind: Record
properties:
msg: String
name: String
timestamp: Number
- kind: SendActivity
id: sendActivity_BAtywk
activity: response
Can you paste it here or send it as attachment, perhaps over private message?
how can i share it with you ?
Can you share the schema?
Or the full topic YAML?
Thanks for the reply, thats how i already configured the response, via the sample data.
Did you edit the schema?
You can do that easily by selecting "From sample data" in "Response data type" :
Pasting the JSON here:
Will generate the following schema:
WarrenBelz
146,743
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
66,089
Most Valuable Professional