Skip to main content

Workflow Action: Custom Code AI

Overview

Creating custom code in workflows is now smarter, faster, and easier with AI! Introducing Code with AI (Beta) in Stack, a feature that allows you to generate custom code snippets using just a simple description.

Previous Behavior

In the past, creating custom code within workflows required writing JavaScript from scratch. This was often time-consuming and required programming expertise. Users had to manually map input properties from previous workflow steps and test and debug the code themselves, demanding a significant investment of time and technical skill.

What’s New?

With the new AI-Assisted Code Generation, the process is streamlined:

  • AI-Powered Code Generation: Describe the functionality you need in plain language, and AI will generate the JavaScript code for you.
  • Automated Property Integration: AI smartly incorporates relevant input properties based on your description.
  • One-Click Implementation: Quickly review and insert AI-generated code into your workflow.
  • Regenerate if Needed: Not satisfied with the first result? Click "Generate" again for a new version.

Pro Tip: Be as specific as possible in your prompt for the best results!

How to Use It

  1. Select: Choose the Custom Code action in your workflow.
  2. Activate AI: Click "Build with AI" to open the AI assistant.
  3. Describe: Input your desired functionality. For example, "I have an API that returns a date in MM-DD-YYYY format. Can you help me convert it to YYYY-MM-DD?"
  4. Generate: Click "Generate" and let AI craft the code for you.
  5. Regenerate: If you want to make changes, mention them in the text box and click "Regenerate".
  6. Implement: Review the output and click "Use Code" to insert it into your workflow.

Use Cases

  • Data Formatting: Automatically format phone numbers or dates to match your preferred style.
  • API Integration: Generate code to connect with external services via HTTP requests.
  • Mathematical Calculations: Compute interest rates, discount percentages, or other formulas dynamically.
  • String Manipulation: Extract key details from text, such as email addresses from subject lines.
  • Conditional Logic: Implement custom decision-making processes, like routing leads based on specific criteria.

Explore the power of AI in Stack to make your workflow coding more efficient and accessible!