https://retellai.com/?utm_source=discord&utm_medium=seo logo
What JavaScript syntax is supported in code steps
# ❓・ai-evy-support
a
Thanks for tagging me @gk. I'll look through relevant sources and get back to you shortly.
​ To learn more, see the sources I considered: [[1] Code Tool](https://docs.retellai.com/build/single-multi-prompt/code-tool) [[2] Code Node](https://docs.retellai.com/build/conversation-flow/code-node) ​
### Answer Based on the available documentation for both Code Tool and Code Node, here's what JavaScript syntax is supported: **Async/await**: Yes, async/await is explicitly supported. Top-level
await
is supported. [(1) ]() [(2) ]() **Standard JavaScript built-ins**: Yes, including
Math
,
JSON
,
Date
,
Array
,
Object
, and
String
methods. This means: - **JSON.parse() **: Yes, supported as part of the
JSON
built-in - **encodeURIComponent() **: Yes, shown in example code:
encodeURIComponent(dv.city)
- **const declarations**: Yes, used throughout the example code - **for loops with let**: Yes, modern JavaScript syntax is supported - **.replace() with regex**: Yes,
String
methods are available **What's NOT supported**: External packages (
require
,
import
) are not available. You must use
fetch()
for external integrations. **Code limitations**: Code is limited to 5,000 characters. **What causes errors**: The documentation doesn't specify what triggers a "bad code" error specifically. However, common issues would likely include: - Exceeding the 5,000 character limit - Attempting to use
require
or
import
- Syntax errors in your JavaScript - Code that exceeds the timeout period (5-60 seconds, default 30 seconds) The JavaScript environment is modern and supports ES6+ features like
const
,
let
, arrow functions, template literals, and async/await.
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.