https://discord.gg/botpress logo
#🤝help
Problem with webhook
# 🤝help
b

best-army-74344

12/27/2023, 6:43 PM
So guys, I want to use this airtable as my KB. I follow the @quick-musician-29561 tutorial and it works perfect but ( it has like 9 values). Now that i want to put this action, I'm getting this errors
Does someone knows what this could be
I have the free suscription in Make, Idk if that has something to do with it
And free suscription in Airtable
q

quick-musician-29561

12/27/2023, 7:38 PM
@best-army-74344 🫡 Here's my earlier comment with similar problem: "If you can share your Airtable data or an example of it, we can try to build everything to work with your data (using the methods in my tutorial). So a table name, column names, a couple of rows of example data. And then also what kind of changes you want to make to it when the data needs to be updated to Botpress 💡 I think with that information we can make it work together."
b

best-army-74344

12/28/2023, 2:42 PM
@jolly-policeman-82775 any idea?
j

jolly-policeman-82775

12/28/2023, 2:43 PM
who ping me
oh
nope
no idea what this is
q

quick-musician-29561

12/28/2023, 4:29 PM
I started testing with your Airtable data.
@best-army-74344 now I have all your Airtable data in Botpress KB table
Try this, there's your Airtable data already in KB table.
code for larger data sets
Copy code
js
async function makeAsyncRequest() {
  const webhookUrl = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
// REPLACE xxxxxxxx WITH YOUR MAKE.COM WEBHOOK ADDRESS

  try {
    const response = await axios.post(webhookUrl)
    const webhookResponse = JSON.stringify(response.data)
    console.log('Log response: ' + webhookResponse)
    await deleteAllRecords()
    return webhookResponse
  } catch (error) {
    console.log(error)
  }
}

const newString = await makeAsyncRequest()
console.log("newString: " + newString)

const data = JSON.parse(newString)

await createNewRecords(data)

async function deleteAllRecords() {
  try {
    let allDeleted = false;

    while (!allDeleted) {
      const data = await Data1Table.findRecords({ selectorName: 'allRecords' });

      if (!Array.isArray(data)) {
        console.log('No records found.');
        allDeleted = true;
      } else {
        const recordIDs = data.map(record => record.id);

        if (recordIDs.length > 0) {
          await Data1Table.deleteRecords(recordIDs);
          console.log(`${recordIDs.length} records deleted.`);
        } else {
          allDeleted = true;
          console.log('All existing records have been deleted.');
        }
      }
    }
  } catch (error) {
    console.error("Error while deleting records: ", error);
  }
}

async function createNewRecords(sheetsData) {
  try {
    await Data1Table.createRecords(sheetsData)
  } catch (error) {
    console.log(error)
  }
}
@best-army-74344 also I answered to your other questions in the related tutorial 🫡
j

jolly-policeman-82775

12/28/2023, 6:08 PM
devmik
this is related
to make.com so why not
how can i clear a table ?
like code for botpress so if a user says something wrong and wants to start again, how do i clear the table
the sheet i mena not the table
q

quick-musician-29561

12/28/2023, 6:16 PM
Do you mean that user makes a mistake and wants to clear for example Google spreadsheet, and bot uses Make.com for that? If so, that's a great idea and I have to try that 💡 🛠️
j

jolly-policeman-82775

12/28/2023, 6:20 PM
yeah
he puts in his wrong email, then he wants to try again then the google sheets cleer his email
il have a look into that
wait
i have a solution for this
webhook + clear row
q

quick-musician-29561

12/28/2023, 6:50 PM
I think you solved it! 🛠️ 💎
j

jolly-policeman-82775

12/28/2023, 6:52 PM
works
wanna see it ?
wait
what is row number ?
lemme watch my tutorial again
works !
works perfectly !!!!!!!!!
this is the chatbot im building rn
q

quick-musician-29561

12/28/2023, 7:11 PM
🔥 🔥 🔥
b

best-army-74344

12/28/2023, 9:08 PM
@quick-musician-29561 you are the man bro!!!
q

quick-musician-29561

12/28/2023, 9:24 PM
🤝💯🛠️
b

best-army-74344

12/29/2023, 1:55 PM
I just get 10 rows of data
is workin but idk
i dont recieve all the data
@quick-musician-29561
could be my suscription plan???
q

quick-musician-29561

12/29/2023, 2:22 PM
let me check Make.com subscription plans also or I'll DM you my Make.com user name and password, if you want to try that there's already project on your name, since we have been working together with these projects exactly one month now ⚡ 🛠️ 🫡
b

best-army-74344

12/29/2023, 2:24 PM
If you don't have any problem with that that would be awesome. Just to check
q

quick-musician-29561

12/29/2023, 2:25 PM
I can see only these limitations: active scenarios and Ops/month
b

best-army-74344

12/29/2023, 2:26 PM
What I'm thinking is to use this code when the client needs to update the experiences
It will not be part of the main flow bc of that. }
Pay attention to the limit. It's very important if you are sending more than 10 rows.