-
Notifications
You must be signed in to change notification settings - Fork 550
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create Intent API issue: TypeError: wrong argument type Symbol #2839
Comments
Using hashes to represent the values will only work so far. The issue you are running into is creating a The second error you are likely to run into is that the value's conversion from a Ruby dialogflow_api_request.create_intent(
"projects/#{params[:agent_id]}/agent",
{
display_name: params[:display_name],
training_phrases: training_phrases,
messages: [
{
payload: {
fields: {
'test' => { string_value: 'foo' }
}
}
}
]
}
)
# raises TypeError: Invalid type Hash to assign to submessage field. To resolve this error you will need to create a dialogflow_api_request.create_intent(
"projects/#{params[:agent_id]}/agent",
{
display_name: params[:display_name],
training_phrases: training_phrases,
messages: [
{
payload: {
fields: {
'test' => Google::Protobuf::Value.new(string_value: 'foo')
}
}
}
]
}
) |
@blowmage thank you so much for your help. Understood! One last question: How could I append another hash inside the Meaning:
I've been trying to do achieve this, and I believe I should use Google::Protobuf::Struct, am I right? |
The nested hash still needs to be a payload: Google::Protobuf::Struct.new(
fields: {
'test' => Google::Protobuf::Value.new(string_value: 'foo'),
'anotherHash' => Google::Protobuf::Value.new(
struct_value: Google::Protobuf::Struct.new(
fields: {
'test' => Google::Protobuf::Value.new(string_value: 'foo'),
'another' => Google::Protobuf::Value.new(string_value: 'bar'),
}
)
)
}
)
` |
Hello all, I'm getting an error while trying to create an Intent through the API with a custom payload:
The code I'm using is the following:
I don't have a clue why am I getting the error, since I'm able to create an intent providing text as a response instead of a custom payload:
Can you please tell me if this is a gem issue, or if I'm doing something wrong?
Thanks in advance!
João
The text was updated successfully, but these errors were encountered: