Workflow Builder
Agent Events Trigger

Agent Event Triggers

A workflow can be triggered by an event on the Agent. You specify the agent event you want the workflow to be triggered by, and the workflow will be executed the next time that this event occurs. Agent event triggers are not for every use case because the workflow will be executed on every occurrence of the event.

The following agent event trigger are currently supported:

How to use Agent Event Triggers

Agent event triggers for workflows can be used by defining one of the event types listed in this document as the trigger in the trigger.type field. The payload of the event will be available in the input field of the workflow execution.

Currently it is required to define the input of the workflow as an object without specifying any fields. This is because workflow input is still validated when a workflow is triggered by an agent event.

The following example contains an agent event trigger with a didcommConnectionCompleted type:

YAML
name: Issue credential to new connections
 
# Specify trigger type (in this case we react to didcommConnectionCompleted)
trigger:
  type: didcommConnectionCompleted
 
# Define input as an object, without specifying specific fields.
input:
  type: object
 
actions:
  - id: issueCredential
    name: didcomm/issueCredential@v1
    attributes:
      # Take the connectionId from the completed connection
      connectionId: $.input.connection.connectionId
      anoncreds:
        credentialDefinitionId: 'did:cheqd:mainnet:d76283f5-943f-4f4b-b5ae-9bd6794b6dcf/resources/9703ceb3-cda2-4315-8f7e-ebceaf351aa7'
        attributes:
          name: 'Alice'
          dateOfBirth: 19901010

Agent Events

didcommConnectionCompleted

The didcommConnectionCompleted event is triggerd when a DIDComm connection has been successfully created and is ready to be used.

Payload

ParameterTypeDescriptionRequired
connectionDidcommConnectionThe DIDComm connection that has been completed.

Workflow Trigger

YAML
trigger:
  type: didcommConnectionCompleted

Example

The following JSON structure shows an example payload for a didcommConnectionCompleted event:

JSON
{
  "connection": {
    "connectionId": "8718d9d7-0d59-4c1a-b73e-e8abed082844",
    "status": "completed",
    "createdAt": 1620920000,
    "theirLabel": "Alice",
    "theirImageUrl": "https://example.com/alice.png",
    "outOfBandId": "b8f5e6c5-1b6a-4b9e-8f9c-8c9c9c9c9c9c"
  }
}

didcommConnectionReused

The didcommConnectionReused event is triggerd when a DIDComm connection has been reused for an invitation created by Paradym. This is possible if the receiver of the invitation decided to reuse an existing connection they have with this agent, rather than creating a new connection.

Payload

ParameterTypeDescriptionRequired
connectionDidcommConnectionThe DIDComm connection that has been completed.
outOfBandIdstringThe identifier of the out of band exchange for which the connection is reused. The outOfBandId in the connection refers to the out of band exchange that created the connection.

Workflow Trigger

YAML
trigger:
  type: didcommConnectionReused

Example

The following JSON structure shows an example payload for a didcommConnectionReused event:

JSON
{
  "connection": {
    "connectionId": "8718d9d7-0d59-4c1a-b73e-e8abed082844",
    "status": "completed",
    "createdAt": 1620920000,
    "theirLabel": "Alice",
    "theirImageUrl": "https://example.com/alice.png",
    // out of band exchange used to created the connection
    "outOfBandId": "b8f5e6c5-1b6a-4b9e-8f9c-8c9c9c9c9c9c"
  },
  // out of band exchange for which the connection is reused
  "outOfBandId": "b9d84ffd-ab4f-404f-84c4-b3e735a9d9ea"
}

didcommCredentialIssued

The didcommCredentialIssued event is triggerd when a DIDComm credential exchange has been completed and a credential has been issued.

Payload

ParameterTypeDescriptionRequired
credentialExchangeDidcommCredentialExchangeThe DIDComm credential exchange that has been completed and issued.

Workflow Trigger

YAML
trigger:
  type: didcommCredentialIssued

Example

The following JSON structure shows an example payload for a didcommCredentialIssued event:

JSON
{
  "credentialExchange": {
    "credentialExchangeId": "1c75488a-d87e-49e6-b52b-cc24b6b5823a",
    "connectionId": "8718d9d7-0d59-4c1a-b73e-e8abed082844",
    "status": "completed",
    "threadId": "3721f467-eeab-4297-8ac7-e16ef31e96b7",
    "createdAt": 1620920000,
    "anoncreds": {
      "offer": {
        "credentialDefinitionId": "did:cheqd:mainnet:81d90082-ec23-4efc-94ab-9653bc3f5cb3/127a0507-bea9-43a8-a0bc-e905aafee81b",
        "attributes": {
          "name": "Alice",
          "dateOfBirth": "19950101"
        }
      }
    }
  }
}

didcommPresentationVerified

The didcommPresentationVerified event is triggerd when a DIDComm presentation exchange has been completed and the received presentation has been verified.

Payload

ParameterTypeDescriptionRequired
presentationExchangeDidcommPresentationExchangeThe DIDComm presentation exchange that has been completed and verified.

Workflow Trigger

YAML
trigger:
  type: didcommPresentationVerified

Example

The following JSON structure shows an example payload for a didcommPresentationVerified event:

JSON
{
  "presentationExchange": {
    "presentationExchangeId": "48f8211e-c462-41fd-985e-8c78e509d053",
    "connectionId": "69eb12d8-a229-474a-aa40-3c9c464354f6",
    "status": "completed",
    "threadId": "3721f467-eeab-4297-8ac7-e16ef31e96b7",
    "createdAt": 1620920000,
    "anoncreds": {
      "request": {
        "name": "Proof of Name",
        "attributes": [
          {
            "names": ["Firstname", "Lastname"],
            "restrictions": [
              {
                "credentialDefinitionId": "did:cheqd:mainnet:d76283f5-943f-4f4b-b5ae-9bd6794b6dcf/resources/9703ceb3-cda2-4315-8f7e-ebceaf351aa7"
              }
            ]
          },
          {
            "names": ["Company"],
            "restrictions": [
              {
                "credentialDefinitionId": "did:cheqd:mainnet:d76283f5-943f-4f4b-b5ae-9bd6794b6dcf/resources/9703ceb3-cda2-4315-8f7e-ebceaf351aa7"
              }
            ]
          }
        ],
        "predicates": [
          {
            "name": "Age",
            "predicateType": "greaterThan",
            "predicateValue": 18,
            "restrictions": [
              {
                "credentialDefinitionId": "did:cheqd:mainnet:d76283f5-943f-4f4b-b5ae-9bd6794b6dcf/resources/9703ceb3-cda2-4315-8f7e-ebceaf351aa7"
              }
            ]
          }
        ],
        "version": "1.0"
      },
      "presentation": {
        "attributes": [
          {
            "value": { "Firstname": "Jan", "Lastname": "Rietvield" },
            "selfAttested": false,
            "schemaId": "did:cheqd:mainnet:d76283f5-943f-4f4b-b5ae-9bd6794b6dcf/resources/4178f3f0-d81d-4bdc-90f7-29219dc3962e",
            "credentialDefinitionId": "did:cheqd:mainnet:d76283f5-943f-4f4b-b5ae-9bd6794b6dcf/resources/9703ceb3-cda2-4315-8f7e-ebceaf351aa7"
          },
          {
            "value": { "Company": "Animo Solutions" },
            "selfAttested": false,
            "schemaId": "did:cheqd:mainnet:d76283f5-943f-4f4b-b5ae-9bd6794b6dcf/resources/4178f3f0-d81d-4bdc-90f7-29219dc3962e",
            "credentialDefinitionId": "did:cheqd:mainnet:d76283f5-943f-4f4b-b5ae-9bd6794b6dcf/resources/9703ceb3-cda2-4315-8f7e-ebceaf351aa7"
          }
        ],
        "predicates": [
          {
            "name": "Age",
            "predicateType": "greaterThan",
            "predicateValue": 18,
            "selfAttested": false,
            "schemaId": "did:cheqd:mainnet:d76283f5-943f-4f4b-b5ae-9bd6794b6dcf/resources/4178f3f0-d81d-4bdc-90f7-29219dc3962e",
            "credentialDefinitionId": "did:cheqd:mainnet:d76283f5-943f-4f4b-b5ae-9bd6794b6dcf/resources/9703ceb3-cda2-4315-8f7e-ebceaf351aa7"
          }
        ]
      }
    }
  }
}

didcommBasicMessageReceived

The didcommBasicMessageReceived event is triggerd when a DIDComm basic message has been received.

Payload

ParameterTypeDescriptionRequired
basicMessageDidcommBasicMessageThe DIDComm basic message that was received.

Workflow Trigger

YAML
trigger:
  type: didcommBasicMessageReceived

Example

The following JSON structure shows an example payload for a didcommBasicMessageReceived event:

JSON
{
  "basicMessage": {
    "connectionId": "8718d9d7-0d59-4c1a-b73e-e8abed082844",
    "message": "Hello",
    "sentTime": 1620920000,
    "threadId": "c44b00a8-ac6c-4cb5-a889-ec7c6c55a485",
    "parentThreadId": "474ba954-1987-46e7-9460-f19c2189c600"
  }
}