Voiceflow PartnersVPVoiceflow Partners
Powered by
SwitchS
Voiceflow Partners•6mo ago
Switch

Function Block API Limitations

What are you looking to achieve:
I'm trying to build a chatbot that fetches images from external APIs (Unsplash) using a Function Block. The goal is to take user input, make an API call to https://api.unsplash.com/search/photos, and return the image URL to display in an Image Block.
What the issue is:
Function Block consistently fails when trying to make external API calls with fetch(). I'm getting these specific errors:

"response.json is not a function"
"response.text is not a function"

Even basic fetch operations that work perfectly in browser/Node.js environments fail in Voiceflow Function Block. The API call itself seems to execute (no network errors), but response parsing methods are not available.
Solutions that you've already tried:

Standard approach: const response = await fetch(url); const data = await response.json(); → Failed
Alternative parsing: const text = await response.text(); const data = JSON.parse(text); → Failed
Different API: Switched from Unsplash to Pixabay API → Same errors
API Block alternative: Used native API Block but it returns 0 despite "succeeded" status
Code verification: Same exact code works in external JavaScript environments

Question:
Are there known limitations with external API calls in Function Blocks, particularly in Trial accounts? Are methods like response.json() and response.text() restricted in the Voiceflow execution environment?
Any guidance on proper external API integration would be appreciated.
Voiceflow Partners banner
Voiceflow PartnersJoin
Exclusive community for Voiceflow Solutions Providers & Content Creators.
13,076Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?
Recent Announcements
jacklyn

# Let your agents search the web 🔎 Hey everyone! We just released the web search tool for the agent step! Your agents can now automatically search the web for information, letting your agent supplement the LLM's knowledge and the data in its knowledge base with live, up-to-date information. Plus.... * You can restrict searches to specific domains, so your agent only searches sites that you own * This is a tool, so you remain in control of when the agent searches the web * Results are automatically summarized in a way that your agent can automatically understand Under the hood, we're using OpenAI's web search API. Give it a try, and let us know what you think! https://docs.voiceflow.com/changelog/native-web-search-tool

jacklyn · 4mo ago

jacklyn

jacklynbiggin's Thread

jacklyn · 4mo ago

hurt-tomato

connor_maclean's Thread

hurt-tomato · 4mo ago

Similar Threads

API output to Function Block
specific-silverSspecific-silver / ❓┃ask-a-question
3y ago
API block : POST
uncertain-scarletUuncertain-scarlet / ❓┃ask-a-question
2y ago
POST API Block test
uncertain-scarletUuncertain-scarlet / ❓┃ask-a-question
2y ago
Multi Fetch in Function Block
colossal-harlequinCcolossal-harlequin / ❓┃ask-a-question
2y ago