Share feedback, ideas and get community help

Home
Members
gusespinoza
g
gusespinoza
Offline, last seen 6 months ago
Joined September 19, 2024
Hi...
I'm wondering if there is a way to fetch a remote API using script but passing "Header" parameters accoding to the suggested documentation:

https://docs.typebot.io/editor/blocks/logic/script ->

// ✅ This works
const response = await fetch('https://jsonplaceholder.typicode.com/todos/1')
const data = JSON.parse(response)
...

I'm trying this approach but it fails at some point:
myHeaders.append("api_access_token", "ASDADSADADSASDASDASDASD"); let requestOptions = { method: "GET", headers: myHeaders, redirect: "follow" }; let response = await fetch("https://url", requestOptions); let data = JSON.parse(response) return (data);

Any sugestion?
6 comments
g
W
B