Skip to content
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

API Call on Web Chat #3

Closed
rajakarunanidi opened this issue Sep 10, 2018 · 10 comments
Closed

API Call on Web Chat #3

rajakarunanidi opened this issue Sep 10, 2018 · 10 comments

Comments

@rajakarunanidi
Copy link

Dear All,
I am unable to call webservice (apicall) with the values entered by user..

I configured APICall as per attached images.. The configured APIcall is invoking but assigned variable values are empty.. Please help me on this and i need how to show response as well on chatbot..

apicall
var1
var2

@Rajeshrash
Copy link

Rajeshrash commented Sep 10, 2018

Hi rajakarunanidi,

I am Rajesh from Ana team and in the api call you are making the request body should be like key-value pairs
Example:
{
"key":"value"
}
and if you are using variables from ana chat flow the please send the request body in the following way
{
"key":"{{VARIABLE_NAME}}"
}
let me know if you are still facing the issue.

@rajakarunanidi
Copy link
Author

Hi @Rajeshrash,

Now its working.. i like to know more information like parsing response and show to user in chatbot.. and filed level javascript validations (eg mobile no validation on required format)..
Can you help me on this??

Is there any tutorial/classes/materials available in online/offline?

@Rajeshrash
Copy link

Hi rajakarunanidi,

As of now, we don't have any documentation and as for the questions that you have asked regarding the mobile number validation. please write an api which will validate the input number in the required format and use it in the flow accordingly.

second one regarding parsing the input, you have a text field named as variable name in the nodeinfo tab your api response will be stored in that and if you want to show any data from your api to the user, you can do it the following way.
if you response is this
{
"key1":"value1",
"key2":"value2"
}
it will be stored in the variable name given in Variable name text field in node info tab,
For example, let the variable name be API_RESPONSE then you show data in the following way
{{API_RESPONSE.key1}} this will display value 1
{{API_RESPONSE.key2}} this will display value 2

Hope this answers your question and regarding documentation, we will update it once it's done.

@rajakarunanidi
Copy link
Author

Thanks for your prompt response @Rajeshrash..
Hope that the given work around will help for me... I will try this and let you know the status..
Please update us on documentation..
You people done really great job...

@NizamLZ
Copy link
Contributor

NizamLZ commented Sep 10, 2018

Most welcome 😀

@NizamLZ NizamLZ closed this as completed Sep 10, 2018
@rajakarunanidi
Copy link
Author

Hi @Rajeshrash & @NizamLZ ,
I tried to populate apiCall response as you suggested.. Its working fine for single item but i need to iterate array of element..
Eg: UserData = {'name', 'user1', 'age', '25'} ===> {{UserData.name}} ==> Its working well
UserData = [{'name', 'user1', 'age', '25'}, {'name', 'user2', 'age', '26'}] ===> {{UserData[0].name}} ==> Its working well.. but i need to iterate all data...

Please suggest how to handle this.. let me know what kind of JS framework is used in ANA.. So it will helpful to reduce queries on forum..

@Rajeshrash
Copy link

Hi @rajakarunanidi
You can show it dynamically in carousel. There is a feature called [does repeat]. choose that checkbox and in Advanced options, give repeat on as UserData and give Repeat as any Variable_Name and mention the start position and max repeats being the number of iterations. Now reference as Variable_Name.name and Variable_Name.age that will iterate through the entire.

@rajakarunanidi
Copy link
Author

Hi @Rajeshrash,
Is this feature available on stable version (v0.1.8)? I am unable to find this [does repeat] option in carousel..
More over i need this iterate functionality on Button: GetItemFromSource.. and what is the purpose of Url and how to use that?

Is there any option to achieve select tag and Auto complete?

carousel
getitemfromsource

@rajakarunanidi
Copy link
Author

rajakarunanidi commented Sep 11, 2018

Hi @Rajeshrash
I found Does Repeat option on Carousel in beta version (v0.1.8-beta13).. And i have mapped the fields as you mentioned but still no luck.. In Chat, its print empty..

My requirement is not dynamic data in Carousel.. I need to show dynamic select tag concept which is somewhat satisfied by Button:GetItemFromSource..

Can you help me how to achieve this on Button:GetItemFromSource ?? Is there any option to achieve select tag and Auto complete?

image

@banerjeerahuldeb
Copy link

Hi @rajakarunanidi

Have you found any way to do that using ana.chat ?

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants