parley
DocsPlatform
Resources
JournalIdeas on running AI supportCustomer storiesHow teams use ParleyGuidesStep-by-step playbooksChangelogWhat shipped, by versionHelp centerAnswers and support
CustomersPricing
LoginGet started
DocsPlatformCustomersPricingJournalCustomer storiesGuidesChangelogHelp center
Get startedLogin

Take charge of your AI customer experience

Get startedTalk to sales

Platform

Platform overviewChannelsPlaybooksIntegrationsAnalyticsPricing

Resources

DocumentationGuidesCustomer storiesJournalChangelogHelp center

Company

AboutCareersContact salesContact supportTerms of servicePrivacy

Security

Trust centerSOC 2ISO 27001GDPRHIPAAData processing
parley

© Parley. All rights reserved.

Docs home

Get started

Quickstart

Build your agent

PlaybooksChannelsKnowledgeActions

Developers

Parley CLICustom codeAPI keysWebhooks

Test and ship

TracesSplit testingSimulations
All docs
Docs home

Get started

Quickstart

Build your agent

PlaybooksChannelsKnowledgeActions

Developers

Parley CLICustom codeAPI keysWebhooks

Test and ship

TracesSplit testingSimulations
Docs/Developers

Custom code

Custom code steps run JavaScript inside a sandbox when a playbook or flow reaches them. Use them to combine calls, shape responses or apply logic that is specific to your business.

Your first function

A code step exports one async function. It receives the inputs you declare and the secrets you grant, and returns output values plus the path the conversation should take next.

javascript
export default async function main(args) {
  const { order_id } = args.inputVars;
  const res = await fetch(
    `https://api.example.com/orders/${order_id}`,
    { headers: { Authorization: args.secrets.ORDERS_KEY } }
  );
  if (!res.ok) return { next: { path: "error" } };
  const order = await res.json();
  return {
    outputVars: { eta: order.eta, carrier: order.carrier },
    next: { path: "success" },
  };
}

Runtime

  • Node-compatible runtime with fetch, crypto and URL.
  • 5 second time limit and 128 MB of memory per call.
  • No file system; network access only to hosts you allow-list.

Testing code steps

Run a step on its own from the editor with sample inputs, or from the CLI with parley code run. Logs and errors appear in the conversation's trace.

PreviousParley CLINextAPI keys

Something unclear?Contact supportor browse thehelp centerAll guides

On this page

Your first functionRuntimeTesting code steps