Workflow Builder
Issue an Employee Badge

Issue an Employee Badge

💡

To see other tutorials and examples about this subject, check out the issuing examples section.

This workflow showcases an example workflow that issues an Employee Badge to a holder wallet. For this we will use the following features:

To issue a credential, a credential definition is required. See the Create a Credential Template example workflow and the anoncreds/createCredentialDefinition on how to get a credential definition.

The following actions are used in this example workflow:

Create the credential template

If you don't have a credential template yet, follow the Create a Credential Template example workflow to create one.

Make sure the credential template has the Name, Title and Access Level attributes, and note down the credentialDefinitionId that is outputted by the anoncreds/createCredentialDefinition action.

Create the employee badge issuance workflow

Create a new workflow in Paradym and save it with the following content. Make sure to replace <YOUR_CREDENTIAL_DEFINITION_ID> with the credential definition ID of your credential template, and publish the workflow afterwards.

YAML
name: Issue employee badge
 
# Workflow can be triggered through the API
trigger:
  type: api
 
# The name, title and access level of the employee are defined as input properties
input:
  type: 'object'
  properties:
    name:
      description: Name of the employee
      type: string
    title:
      description: Title of the employee, e.g. Software Engineer.
      type: string
    accessLevel:
      description: Access level of the employee, between 1 and 5.
      title: Access Level
      type: number
      minimum: 1
      maximum: 5
  required:
    - name
    - title
    - accessLevel
 
actions:
  # Setup the connection by showing the QR code in your client
  - id: createConnection
    name: didcomm/createConnection@v1
 
  # Issue the employee badge
  - id: issueCredential
    name: didcomm/issueCredential@v1
    attributes:
      connectionId: $.actions.createConnection.output.connection.connectionId
      anoncreds:
        # See the example workflow 'Create Credential Template' on how to get a credential definition
        # Make sure the credential template is created with the same attributes (Name, Title, Access Level) as used below.
        credentialDefinitionId: <YOUR_CREDENTIAL_DEFINITION_ID>
        attributes:
          Name: $.input.name
          Title: $.input.title
          Access Level: $.input.accessLevel

Set up webhook notifications

Next, we'll set up a webhook endpoint, to get notified of any events that occur within a workflow execution.

For this example, we'll use Webhook.site (opens in a new tab) to create a webhook endpoint and handle the events manually. In a production environment you would use your own webhook endpoint and automate the handling of the events sent by Paradym.

Follow the steps for setting up a webhook.

If we now execute the workflow, we should see events pop up in the Webhook.site dashboard.

Execute the workflow through the API

Next, we'll execute the workflow through the API. You can use the API Reference (opens in a new tab), or any other tool that can make HTTP requests.

Follow the steps for executing a workflow through the API. The body of the request should use the following structure:

{
  "workflowId": "<YOUR_WORKFLOW_ID>",
  "input": {
    "name": "Jane Doe",
    "title": "Software Engineer",
    "accessLevel": 3
  }
}

You should now see events pop up in the Webhook.site dashboard, after which it will get into an on hold state.

Retrieve the invitation URL

In the Webhook.site dashboard, there should be an event with type workflowExecution.waitingForTrigger, where the value of workflowActionId in the payload is createConnection.

Once this event has been emitted, we know the invitation URL is ready to be used. Extract the workflowExecutionId from the payload, and use it to retrieve the execution from the API. The response should include an invitationUrl.

Accept invitation with the Paradym Wallet

If you haven't done so, install the Paradym Wallet on your device, and open the app.

Create a QR code from the invitation URL using QR Code Generator (opens in a new tab) and scan this invitation with the Paradym Wallet. The wallet will now show a credential offer. Once you click "Accept", the credential will be added to your wallet.

Done!

You have now successfully issued an employee badge to a holder wallet. The workflow should have reached a completed state, which you can see in the dashbaord, or on the Webhook.site page.

Other Issuing examples