code snippets for automation platforms

snippet library

HTTP GET with Error Handling

zapier

Fetch data from an API endpoint using inputData, with error handling and JSON response parsing.

Date Formatting & Parsing

zapier

Parse a date string from inputData and reformat it for downstream steps.

Map & Filter Array Data

zapier

Parse a JSON array from inputData, filter and transform each item, and return the results.

Input Validation & Sanitization

zapier

Validate required inputData fields and sanitize values before processing.

Return Multiple Output Objects

zapier

Split a comma-separated inputData field into multiple output objects for downstream steps.

Python: Contact Lookup via requests

zapier

Look up a contact in an external CRM using Zapier Python with the preinstalled requests library.

Process All Items

n8n

Loop through all input items with $input.all(), transform each, and return results.

HTTP Request with Retry

n8n

Make an HTTP request with exponential backoff retry logic. fetch is available in modern n8n (Node 20+).

Date Parsing & Timezone Handling

n8n

Parse dates from input, compute differences, and format with timezone offsets.

Try/Catch with Structured Errors

n8n

Wrap processing in try/catch and return structured error output for the error branch.

Access Data from Previous Nodes

n8n

Reference output data from specific previous nodes using $() notation.

Python: Process All Items

n8n

Iterate _items in n8n's Python Code node (Run Once for All Items mode), transforming each item.

Webhook Body Validation

pipedream

Validate an incoming webhook payload from steps.trigger.event and return a structured record.

HTTP Request with axios

pipedream

Make an authenticated POST using axios from npm. Pipedream code steps support require() for any npm package.

Data Store Read/Write (full component)

pipedream

Persist state across runs with a Pipedream Data Store. Data stores must be declared as a component prop; codefmt formats this as module-style code because of the top-level export.

Environment Variable Access

pipedream

Access and validate environment variables with fallback defaults.

Python: Webhook Handler

pipedream

Process an incoming webhook in a Pipedream Python step using the pd object.

Transform Input Fields

make

Transform and restructure scenario input fields for an API request.

Parse Nested JSON from Strings

make

Safely parse JSON strings from scenario input, handling nested structures.

Error Handling with Structured Output

make

Try/catch pattern returning structured success or error output for Make scenarios.

Python: Transform Input List

make

Transform a list of items from scenario input and return a structured result.

Search Contacts by Email

hubspot

Look up a HubSpot contact by email address using the CRM search API via @hubspot/api-client.

Custom Workflow Action with API Call

hubspot

A custom coded workflow action that calls an external API via axios and updates the contact in HubSpot.

Process Webhook Event

hubspot

Handle an incoming webhook event, extract subscription data, and route by event type.

Error Handling with Callback

hubspot

Robust error handling pattern using @hubspot/api-client and callback with structured error data.

Python: Contact Lookup via REST

hubspot

Look up a HubSpot contact by object ID using the CRM REST API and a private app token.

For Loop with Conditionals

hubl

Iterate over a list with if/else conditional rendering and loop index access.

Custom Module with Parameters

hubl

A reusable custom module template that reads module parameters with defaults and renders content.

Blog Post Listing

hubl

Display recent blog posts using content variables and blog_recent_posts.

Form Embed with Custom Styling

hubl

Embed a HubSpot form via the @hubspot/form module with custom wrapper markup and a fallback for the editor.