Voiceflow state integration [help]

Hi, we are having trouble integrating voiceflow state api on our python project.
It looks like it almost works, however, every input I send is treated as “no reply”.
Here is the code, as you can see we are using the body as given by the documentation.

https://gist.github.com/a96lex/5036473d3501bbd5321a1acfb3030f73

Thank you

I don’t know much about Python, but seems need to fix:

  • add “content-type:application/json” header
  • convert request data to json strings
$ diff voiceflow.py voiceflow_fix.py
49,50c49,50
<             headers={"Authorization": api_key},
<             data=data,
---
>             headers={"Authorization": api_key, "Content-type": "application/json"},
>             data=json.dumps(data),

works in my end like this.

$ python3 voiceflow_fix.py 0001 "hello"
{'request': {'type': 'text', 'payload': 'hello'}}
content: [{'type': 'text', 'payload': {'slate': {'id': '5z53goa', 'content': [{'children': [{'text': "Hi, what's your name?"}]}]}, 'message': "Hi, what's your name?"}}, {'type': 'entity-filling', 'payload': {'entityToFill': 'tmp_user_name', 'intent': {'type': 'intent', 'payload': {'intent': {'name': 'capture_tmp_user_name_pmdkppeb'}, 'query': '', 'entities': []}, 'ELICIT': True}}}]
Hi, what's your name?
text Hi, what's your name?
{'text': "Hi, what's your name? "}

$ python3 voiceflow_fix.py 0001 "My name is John"
{'request': {'type': 'text', 'payload': 'My name is John'}}
content: [{'type': 'path', 'payload': {'path': 'capture'}}, {'type': 'text', 'payload': {'slate': {'id': '5qk3g9v', 'content': [{'children': [{'text': 'Hi, '}, {'text': 'John'}, {'text': ' . nice to meet you.'}]}]}, 'message': 'Hi, John . nice to meet you.'}}, {'type': 'end'}]
Hi, John . nice to meet you.
text Hi, John . nice to meet you.
{'text': 'Hi, John . nice to meet you. '}

[quote=“kun432, post:2, topic:2505”]

$ python3 voiceflow_fix.py 0001 "hello"
{'request': {'type': 'text', 'payload': 'hello'}}
content: [{'type': 'text', 'payload': {'slate': {'id': '5z53goa', 'content': [{'children': [{'text': "Hi, what's your name?"}]}]}, 'message': "Hi, what's your name?"}}, {'type': 'entity-filling', 'payload': {'entityToFill': 'tmp_user_name', 'intent': {'type': 'intent', 'payload': {'intent': {'name': 'capture_tmp_user_name_pmdkppeb'}, 'query': '', 'entities': []}, 'ELICIT': True}}}]
Hi, what's your name?
text Hi, what's your name?
{'text': "Hi, what's your name? "}

$ python3 voiceflow_fix.py 0001 "My name is John"
{'request': {'type': 'text', 'payload': 'My name is John'}}
content: [{'type': 'path', 'payload': {'path': 'capture'}}, {'type': 'text', 'payload': {'slate': {'id': '5qk3g9v', 'content': [{'children': [{'text': 'Hi, '}, {'text': 'John'}, {'text': ' . nice to meet you.'}]}]}, 'message': 'Hi, John . nice to meet you.'}}, {'type': 'end'}]
Hi, John . nice to meet you.
text Hi, John . nice to meet you.
{'text': 'Hi, John . nice to meet you. '}

[/quote] this is exactly what we did yesterday and it seems to work now… much appreciated, thank you for your help!