https://discord.gg/botpress logo
HTTP card
# 🤝help
i
hello; I'm struggling to set up the HTTP card with a POST method to send data from Botpress( variable values) to an external site. the function works until I try to pass a variable then it sends an empty payload.
p
You could use axios to ake your request within the execute code card instead.
i
Thabk you for answering. You mean create code for that? I'm not sure I understand fully how that would work. if there's any tutorial or documentation please share
p
Yes indeed, just convert your code in js and add it to the execute code card. Here's an example of an api call:
Copy code
js


const employees = await axios.get(`https://api.bamboohr.com/api/gateway.php/${subdomain}/v1/employees/directory`, {
  headers: {
    'Authorization': `Basic ${auth}`,
    'Accept': 'application/json'
  }
});
i
I tried a few version but so many functions are not working because axios isn't loading. this is one of the: const payload = { email: conversation.email, attributes: { FIRSTNAME: conversation.userName }, updateEnabled: true }; const headers = { 'api-key': 'API KEY*****', 'content-type': 'application/json', 'accept': 'application/json' }; const response = await axios.post('https:*************************', payload, { headers });