Custom Actions (Beta)
Zapier’s Custom Actions feature now utilizes an AI Copilot to generate the initial API configuration. You will need to use the chat interface to create the action structure before you can manually refine the endpoints or headers.
Step 1: Add the Custom Action
- Create a new Zap or edit an existing one.
- Add a trigger of your choice, then add an action step by clicking + Add a step.
- Type “Oneflow” in the search field and select it.
-
From the Event dropdown, select Custom Actions (Beta).
- Click Continue.
- Connect your Oneflow account (or select an existing connection) and click Continue.
-
In the Action section, click the Custom Actions Builder link.
Step 2: Generate the Action with Copilot
When the builder opens, you will see a chat interface. The Advanced tab (manual editor) will be empty until you generate an initial draft.
-
Click the "Untitled Action" text at the top, rename your action (e.g., "Get Contract Details").
-
In the chat box at the bottom, enter a prompt to generate the specific Oneflow API call you need.
Example Prompt for Getting Contract Details:
Create a custom action called "Get Contract details" that performs a GET request to [https://api.oneflow.com/v1/contracts/](https://api.oneflow.com/v1/contracts/){contract_id}. I need an input field for "Contract Id" that populates the URL path. Please also add a header x-oneflow-user-email with the value integration-team@oneflow.com.- Send the message and wait for Copilot to generate the configuration.
Step 3: Review the action in the Advanced tab
The Advanced tab displays the TypeScript code that runs your action. You can modify the logic here by directly editing the code or continue to prompt copilot for modifications.
Look for the export async function block in the code editor:
-
Verify Inputs: Check the function arguments. This defines what input fields appear for the user.
function getContractById({ contractId }: { contractId: number })Result: This creates a "Contract Id" input field in the Test panel. -
Verify URL & Logic: Check that the URL is constructed correctly using the input variable.
const url = '[https://api.oneflow.com/v1/contracts/$](https://api.oneflow.com/v1/contracts/$){contractId}'; -
Verify Headers: Verify that your required headers are defined correctly.
const headers = { 'accept': 'application/json', 'x-oneflow-user-email': 'integration-team@oneflow.com' };
How to Edit:
- To add a new input (e.g.,
limit), add it to the function arguments:function ...({ contractId, limit }). - To change a header, type directly into the
headersobject in the code.
Step 4: Test the Action
The right-hand panel is for testing only.
- Under Authorization, select your Oneflow connection.
- Under Inputs, you will see the fields defined in your code (e.g., Contract id). Enter a valid ID from your Oneflow account (e.g.,
12345). - Click Run Test.
- Success: You will see a green "200 OK" message and the JSON data of the contract.
- Failure: Read the error message, then return to the Code editor on the left to fix your URL or headers.
Step 5: Publish and Use
- Once the test is successful, click Publish.
- Return to your Zap editor.
- Select your new custom action action from the dropdown (in this case, "Get Contract Details").
API Requests
- Create a new Zap.
- Add a trigger of your choice, then add an action to your Zap by clicking + Add a step.
- Type “Oneflow” in the search field and click on it.
- From the Event dropdown, select API Request (Beta).
- Click on Continue.
- Click on the Choose button and connect to your Oneflow account, then click on Continue to proceed.
- Under the Action stage, modify the following to match your API endpoint.
HTTP Method: Select the method of your API endpoint: GET, POST, PUT, DELETE, PATCH.
URL: Enter the URL of your API endpoint.
|
NOTE The URL can include path parameters within brackets. For instance, for the Get contract by ID endpoint, the contract ID can be passed as an input field as follows: [https://api.oneflow.com/v1/contracts/](https://api.oneflow.com/v1/contracts/){contract_id} |
Query String Parameters:
Key & Value pairs: You may include query parameters required by the Oneflow API endpoint. Enter the name of the query parameter (i.e. Key) in the first field, and enter its Value in the second field.
Click on the + button to add another key & value pair.
For instance, for the Get contracts endpoint, the query parameters and their values can be expressed as follows:
- Key: offset
- Value: 0
- Key: limit
- Value: 100
The resulting URL will be as follows:
[https://api.oneflow.com/v1/contracts?offset=1&limit=100](https://www.google.com/search?q=https://api.oneflow.com/v1/contracts%3Foffset%3D1%26amp%3Blimit%3D100)Additional Request Headers: You may include additional headers required by the Oneflow API endpoint. Enter the name of the header in the first field, and enter its value in the second field. For instance, for the Get contracts endpoint, the additional headers can be expressed as follows:
x-oneflow-user-email: integration-team@oneflow.com
Body: You may include a JSON body to pass with your API request.
- Click on Continue to proceed with your Zap.