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.
  • inputSchemaData 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

TypeDescription
list-data-recordsList records in a data collection
find-data-record-by-idFind a record in a data collection by ID
search-data-recordSearch data records by a query string
match-data-recordFind a data record with fields matching a query
create-data-recordCreate a new data record
update-data-recordUpdate an existing data record
find-or-create-data-recordCombines "match data record" with "create data record" with optional use of Data Links.
delete-data-recordDelete 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