Workflow Builder
Actions

Actions

Actions are the steps that your workflow takes to reach its overall goal, making them key to the running of a workflow. They make your workflow unique and suited to your specific use case.

You can mix and match actions from the available actions list to create different types of flows. These actions enable you to receive, send or create verifiable credentials. Also, there are actions to enable external interaction.

CategoryActionVersionDescription
ConnectionscreateInvitationv1Create a connection invitation, encoded as URL.
receiveInvitationv1Receive a connection invitation, encoded as URL.
createConnectionv1Create a connection invitation, encoded as URL, and wait for the connection to be completed. Can only be used for single use invitations.
Credential TemplatescreateSchemav1Create a credential schema with attributes, and register it on the ledger.
createCredentialDefinitionv1Create a credential definition and register it on the ledger.
Issue CredentialsissueCredentialv1Issue a credential to a connection.
createCredentialIssuanceInvitationv1Issue a credential directly with an invitation.
PresentationsrequestPresentationv1Request a presentation from a connection.
createPresentationInvitationv1Request a presentation with an invitation.
MessagingsendBasicMessagev1Send a simple message to another connection.
Validate JsonvalidateJsonv1Validate a JSON structure against a schema.
External Actionsfetchv1Call an external API.

The following example consists of two actions - the workflow receives an invitation and sends two basic messages:

YAML
actions:
  - id: receiveInvitation
    name: didcomm/receiveInvitation@v1
    attributes:
      invitationUrl: $.input.invitationUrl
  - id: issueDOBCredential
    name: didcomm/issueCredential@v1
    attributes:
      connectionId: $.actions.receiveInvitation.output.connection.connectionId
      anoncreds:
        # from credential definition action
        credentialDefinitionId: 'did:cheqd:mainnet:d76283f5-943f-4f4b-b5ae-9bd6794b6dcf/resources/9703ceb3-cda2-4315-8f7e-ebceaf351aa7'
        attributes:
          name: 'Alice'
          dateOfBirth: 19901010

The output of a previous action can be used in other actions by referencing its output object through $.actions.<action name>.output.<key>. From the previous example, the output of the action connectionId can be referenced as $.actions.receiveInvitation.output.connectionId.

Working with Actions

Format

Actions are written in YAML and are formatted in this way:

YAML
actions:
  - id: actionId
    name: actionType/actionName@v<version>
    attributes:
      input: inputValue
ParameterTypeDescriptionRequired
idstringCustom reference name for the action
namestringAction name
attributesobjectAttributes of action.
[USER_DEFINED][USER_DEFINED]Input dependant on specific action.

The specifics of the action you're working with mostly take place in the attributes key. That's where unique elements of the different types of actions are defined.

The custom ID of an action should be unique and easy to reference (e.g. no spaces). It is used to refer to that specific action when retrieving output. This becomes especially important when a workflow has multiple actions of the same type (eg. create multiple schemas or issue multiple credentials).

Input values

The input of your workflow can be used to pass values to your defined actions. Values can be referenced using JSONPath (opens in a new tab) syntax. You can also hardcode values into your workflow:

YAML
name: Workflow X
 
input:
  type: 'object'
  properties:
    inputValue:
      type: string
 
actions:
  - id: action1
    name: actionType/actionName@v1
    attributes:
      input1: $.input.inputValue
      input2: 'hardcoded_value'

The tutorials are a good place to see this in action, like in How to Issue an Employee Badge.

Results

Results of previous actions can be referenced by using the output object of the action:

YAML
actions:
  - id: action1
    name: actionType/actionName@v1
    attributes:
      input: inputValue
  - id: action2
    name: actionType/actionName@v1
    attributes:
      input: $.actions.action1.output.value

Versioning

Each action has a version. The version of the action is specified by appending a @v<version> to the end of the action name <action name>@v<version>. The documentation of each action lists the differences between versions of an action and its current version.

YAML
actions:
  - id: action1@v1
    name: actionType/actionName@v1
    attributes:
      input: inputValue
  - id: action2v2
    name: actionType/actionName@v1
    attributes:
      input: $.actions.action1.output.value