Actions
Action represents a single request or query your application wants to make in an external application. For example, "Create a task", "Get list of users", or "Send a message".
Here is an example of an action:
name: Create Task
key: create-task
inputSchema:
type: object
properties:
title:
type: string
description:
type: string
type: create-data-record
config:
dataSource:
collectionKey: issues
fieldMapping:
defaultValue:
summary:
$var: $.input.title
description:
$var: $.input.description
Action Structure
Task definition has the following top-level properties:
name
– human-readable name that will be shown in the UI.key
– unique identifier used by SDK / API to reference the action.inputSchema
– Data Schema describing the payload that will be validated when you run the action.type
– one of the Action Types (see table below).config
– implementation of the action. Its contents depends on the type.outputSchema
- defines expected output of the action. It will normally be auto-generated from the implementation, but you can define it explicitly.
Action Types
Actions let you run any synchronous logic against external APIs, your internal API, or just transforming inputs into outputs. Here is how actions let you use other Membrane interfaces:
Data Collections
These action types give you access to functionality of Data Collections
Type | Description |
---|---|
list-data-records | List records in a data collection |
find-data-record-by-id | Find a record in a data collection by ID |
search-data-record | Search data records by a query string |
match-data-record | Find a data record with fields matching a query |
create-data-record | Create a new data record |
update-data-record | Update an existing data record |
find-or-create-data-record | Combines "match data record" with "create data record" with optional use of Data Links. |
delete-data-record | Delete a data record by id |
External API
connector-operation
action type lets you use API Operations from the current connector:
name: Add Attachment
key: add-attachment
type: connector-operation
inputSchema:
type: object
properties:
id:
type: string
url:
type: string
config:
operationKey: add-attachment-to-an-issue
input:
issueIdOrKey:
$var: $.input.id
fileUrl:
$var: $.input.url
api-request-to-external-app
action type lets you make arbitrary API requests to the API of the current external app with authentication applied automatically:
name: Create Task
key: create-task
inputSchema:
type: object
properties:
projectId:
type: string
title:
type: string
type: api-request-to-external-app
config:
request:
path: /projects/{projectId}/issues
method: post
pathParameters:
projectId:
$var: $.input.projectId
query:
ignoreDuplicates: true
data:
summary:
$var: $.input.title
headers:
x-api-version: 2025-01-01
responseSchema:
type: object
properties:
issueId:
type: string
outputSchema:
type: object
properties:
Internal API
api-request-to-your-app
action type lets you make arbitrary requests to your Internal API:
name: Create Task in Internal API
key: create-task-in-internal-api
inputSchema:
type: object
properties:
title:
type: string
description:
type: string
type: api-request-to-your-app
config:
request:
uri: create-task
method: POST
body:
title:
$var: $.input.title
Custom Code
run-javascript
action type lets you run arbitrary javascript (or typescript):
name: Create Task
key: create-task
type: run-javascript
config:
code: |-
module.exports = async function() {
console.log('doing something')
}
See Running Custom Code for more detail.
References
Updated 1 day ago