How to use Converse API

how to use this api in my code ?

Here’s an example of action using the converse API.

The doc can be found here.

Thanks it works now :+1:

Hello…
I’m trying to create converse API and flow but getting trubble to create api Im getting bad request…
Can you please help me solved it?

Hi @pooja123, Can you provide a little more details on your issue?

What’s your setup (docker, windows, Linux, Mac, Cloud, Local, etc…)?
Which version of Botpress are you using?
Can you provide the code for your request?
Can you provide logs of your terminal to see what’s happening there?

Cheers,
Marc

Yes sure @marcmerce
Thanks for the reply sir…
My set is Linux
And Im using Botpress version 12.16.2
And im requesting to How to create converse API for bot and How to create Flow conversation using that converse API?

@pooja123 Ok thanks, have you written code that you can show? You said you are getting bad requests. I am assuming you tried making an API call? I’d love if you could share that code. Let me know

Ok sir
I want to create this above API But In postman I get Unauthorized token…
http://localhost:3000/api/v1/bots/delegate_to_bots/converse/1/secured?include=nlu,state,suggestions,decision I

AND After that I want create flow Using this converse API Which user can get data via this Converse API…
I want code for Js action and steps of flow creation…
Thanks in advance…

Get employee data from API AND store in Database…Using flow???
How can I do this

@pooja123

To fix it, you must to send a POST request to

your-server-adress/api/v1/auth/login/basic/default

using this JSON object

{
  "email": "userEmailtoLogin",
  "password" : "userLoginPassword"
}

Doing that Botpress will answer you confirming the success and providing you a JWT so that you can use more responses types :slight_smile:

Get employee data from API AND store in Database…Using flow???
How can I do this

Could you be more specific? At first glance is just a matter of write an action that access a DB- you can use Knex, that is bundled with BP…

Can you please share me code with steps how could i implement
1 How to write action code
2. How to implement in flow…Which events i have to used etc
3.How can i access API and Db in that action? code for that?

Yes sir Im using this JSON object still getting Bad request 400?HOW?

@pooja123, our fellow dev Simon Aabingunz wrote a serie of tutorials thats explain this in details, and was pretty valuable for me:

To write an action:

To connect with a Database (in this case Postgres, but he wrote another tut for MySQL):

:slight_smile:

1 Like

Yes sir Im using this JSON object still getting Bad request 400?HOW?

Please, write/show the steps you’re taking…

Ok sir Thanks a lot…

I have send post request http://localhost:3000/api/v1/auth/login/basic/default
then in body pass the parameter
{
“email”: “myEmailtoLogin”,
“password” : “myLoginPassword”
}

i used this document fot postges database…Unble to get usedname from dtabase…

then in body pass the parameter
{
“email”: “myEmailtoLogin”,
“password” : “myLoginPassword”
}

I hope you understood that you must use the credentials that you use to login into Botpress…

Thanks for helping out @LuizCesarLeite. I appreciate it! :raised_hands:t2:

1 Like