Creating a script with AI
Last updated
Last updated
The custom script editor includes an integrated AI agent, so you can get real-time assistance creating and updating scripts!
Our AI integration knows about expected keys and value types (payload, variables, meta, etc.), so generated scripts will be in a form that's ready to use in process flows.
Follow the steps below:
Step 1
Log in to the and select scripts
from the left-hand navigation bar.
Step 2
Select the create script
button:
Step 3
Add a unique name
and a description
and then choose your preferred coding language:
Script names must be unique - you can't add two scripts with the same name.
Step 4 Move down to the Patchworks AI panel and enter your query:
Step 5 Enter your script requirements (being as clear and specific as possible). For example:
Step 6
If you have a sample payload and would like to provide it for clarity, select the provide an example payload?
checkbox and paste in your payload - for example:
We recommend providing a sample payload whenever possible, as it provides valuable context to the AI agent.
Sample payloads don't have to be perfect (or valid code) - as long as the structure and format are described correctly, the AI agent should have enough to work with. For example, if you don't have a JSON payload available, you might enter something like:
Step 7
Click the generate
button:
Step 8 AI generates a first pass of the script, which is displayed in an overlay:
From here:
Then, if you are satisfied that the script is correct, or that you at least have enough to work with independently, click accept script
- otherwise you can refine your requirements again.
If you want to close the script and exit back to your original prompt, click close
.
If you feel that the generated response is not appropriate/helpful, click report
. This marks the conversation for review by Patchworks.
Each time you generate
a script, the is decremented. You can view the number of AI requests used and remaining from your .
If your request is ambiguous (for example, you indicate that you require some specific fields to be added but don't stipulate what these are), you may be prompted for clarification:
If you are satisfied that the script is correct, or that you at least have enough to work with independently, click accept script
:
You can't edit the generated script in the AI 'overlay' window - you need to accept it and then make any required updates in the .
Having accepted a script, it opens in the so you can , and the code as needed.
Always your scripts to ensure that the results are as expected.
If you want to refine your requirements and ask AI to generate again, update the comments
field and click send reply
:
Each time you refine the generated output with send reply
, the is decremented. You can view the number of AI requests used and remaining from your .
The maximum memory size for a custom script is 512MB
The maximum size of a custom script is 4GB
Up to 5 AI requests can be made per day for any company profile, free of charge.
A can be purchased if you'd like to increase this allowance.
You can view the number of AI requests used and remaining from your .
AI prompts can be up to 1500 characters.
Sample payloads for an AI request can be up to 6000 characters.