code snippets for automation platforms
snippet library
HTTP GET with Error Handling
zapierFetch data from an API endpoint using inputData, with error handling and JSON response parsing.
Date Formatting & Parsing
zapierParse a date string from inputData and reformat it for downstream steps.
Map & Filter Array Data
zapierParse a JSON array from inputData, filter and transform each item, and return the results.
Input Validation & Sanitization
zapierValidate required inputData fields and sanitize values before processing.
Return Multiple Output Objects
zapierSplit a comma-separated inputData field into multiple output objects for downstream steps.
Python: Contact Lookup via requests
zapierLook up a contact in an external CRM using Zapier Python with the preinstalled requests library.
Process All Items
n8nLoop through all input items with $input.all(), transform each, and return results.
HTTP Request with Retry
n8nMake an HTTP request with exponential backoff retry logic. fetch is available in modern n8n (Node 20+).
Date Parsing & Timezone Handling
n8nParse dates from input, compute differences, and format with timezone offsets.
Try/Catch with Structured Errors
n8nWrap processing in try/catch and return structured error output for the error branch.
Access Data from Previous Nodes
n8nReference output data from specific previous nodes using $() notation.
Python: Process All Items
n8nIterate _items in n8n's Python Code node (Run Once for All Items mode), transforming each item.
Webhook Body Validation
pipedreamValidate an incoming webhook payload from steps.trigger.event and return a structured record.
HTTP Request with axios
pipedreamMake an authenticated POST using axios from npm. Pipedream code steps support require() for any npm package.
Data Store Read/Write (full component)
pipedreamPersist 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
pipedreamAccess and validate environment variables with fallback defaults.
Python: Webhook Handler
pipedreamProcess an incoming webhook in a Pipedream Python step using the pd object.
Transform Input Fields
makeTransform and restructure scenario input fields for an API request.
Parse Nested JSON from Strings
makeSafely parse JSON strings from scenario input, handling nested structures.
Error Handling with Structured Output
makeTry/catch pattern returning structured success or error output for Make scenarios.
Python: Transform Input List
makeTransform a list of items from scenario input and return a structured result.
Search Contacts by Email
hubspotLook up a HubSpot contact by email address using the CRM search API via @hubspot/api-client.
Custom Workflow Action with API Call
hubspotA custom coded workflow action that calls an external API via axios and updates the contact in HubSpot.
Process Webhook Event
hubspotHandle an incoming webhook event, extract subscription data, and route by event type.
Error Handling with Callback
hubspotRobust error handling pattern using @hubspot/api-client and callback with structured error data.
Python: Contact Lookup via REST
hubspotLook up a HubSpot contact by object ID using the CRM REST API and a private app token.
For Loop with Conditionals
hublIterate over a list with if/else conditional rendering and loop index access.
Custom Module with Parameters
hublA reusable custom module template that reads module parameters with defaults and renders content.
Blog Post Listing
hublDisplay recent blog posts using content variables and blog_recent_posts.
Form Embed with Custom Styling
hublEmbed a HubSpot form via the @hubspot/form module with custom wrapper markup and a fallback for the editor.