Connect to postges database
# 🤝help
Hello, I'm am using Botpress Studio and want to connect to a postgres database with postgrest API. To test the interface I have written two scripts with axios GET and POST request to read and write data to the database which works well. But when I use the script in an botpress execute node, it doesn't work. I am not a programmer, but the following code works: (I have replaced the URL and the port): / Read from database machinenumbers using GET and axios package axios.get("") .then((response) => console.log( .catch((error) => console.log(error)); // Insert data to database costumers using POST and axios package, json-format'', { "company": 'Flintstone GmbH', "firstname": "Fred", "name": 'Flintstone', "email": "", "phone": "0049123456789" }) .then(function (response) { console.log("Write success"); }) .catch(function (error) { console.log(error); }); Can someone help me to realize the two functions in Botpress? Or is there an easier way?
Hello!, are you awaiting for those requests? using "await"?
Do you also have no authorization to send in the headers? do you have the database without any authorization?
Copy code
const jiraUrl = ''
const jiraUsername = 'your-jira-username'
const jiraPassword = 'your-jira-password'
// get the current date and time in ISO format
const now = luxon.local().toISO()
// create the JQL query to get all issues that are not done
const jql = `status != Done AND updated >= "${now}" ORDER BY updated DESC`
// set the request headers for Jira API
const headers = {
  'Content-Type': 'application/json',
  Authorization: `Basic ${btoa(`${jiraUsername}:${jiraPassword}`)}`,
// make the request to Jira API to get all issues that are not done
const response = await axios.get(`${jiraUrl}/rest/api/2/search?jql=${jql}`, { headers })
// filter the response to only keep the issues that are not done
const issues = _.filter(, (issue) => !== 'Done')
as in this example taken from the botpress documentation. 👆🏻
In Axios you pass the headers as an object after the url.
Hey I'm trying to make a chatbot that combines both stack ai and botpress. I did the workflow in botpress and from stack ai I made a bot using chatgpt which is connected to my database and I took the API of stack ai and connected it to botpress. And the API is not responding need help
I would recommend starting a new thread in #1111009377525186570