How to integrate Botpress with External API?

Hey guys! It’s me again. I’m developing a chatbot and I need use the cardinal commerce api. But i have a problem: Api only supports “post” request and I need know how to integrate the api in botpress.

Hey @Joseph_Nunez_Matute

You can integrate with external APIs using Botpress Actions or Hooks. Furthermore, you can use the axios package to issue HTTP calls.

See an example here

1 Like

Thanks a lot! But do you have a better example?

Hey @Joseph_Nunez_Matute !

What would constitute a better example? What exactly is missing from the example I linked before?

Ok… I understand… Cardinal Commerce only supports post request… what can i do in this case?

Hi @Joseph_Nunez_Matute,

In this case it’s the same solution, just change it for a post request :

const axios = require('axios') // Needed to do http calls

const myAction = async () => {
  let response
  try {
    response = await'http://the_url_you_want_to_post_to', the_data_required)
  } catch (error) {
      console.log('Something went bad : ', error) // Do something smarter with the error
      throw error

  const my_infos =
  console.log('I called url the_url_you_want_to_post_to with data the_data_required and it gave me : ', my_infos)

return myAction()