Triggers allow you to run code on external events, and they rely on webhooks from the external service. Triggers fire automatically and immediately when the configured external event is detected, unlike a Manual Trigger, which runs according to human interaction.

Setting Up a Trigger

Triggers are available from most connection types, and the features they provide depend on the capabilities of the connected system. For example, the capabilities of triggers for Jira Cloud and Jira On-Premise connections are different due to the differences in each hosting option and their APIs.

In this example, we'll set up a simple trigger for Jira On-Premise that fires when a comment is posted to an issue.

  1. Open a workspace, add the Jira On-Premise library.
    1. Click Add Libraries.
    2. Click Jira On-Premise.
    3. Click OK.
      The Jira On-Premise library appears in the workspace panel.
  2. Click the Jira On-Premise library.
    All of the trigger options appear.
  3. Click-and-drag the Comment Trigger onto the workspace

  4. Select when the trigger is to fire.
    1. Click the first/default dropdown option (Created) to see the available options.
      For the Comment Trigger, options are Created, Updated, and Deleted.
    2. Click Created, which is also the default option.
  5. Select the Jira On-Premise instance you want to work with from the connection drop-down list.
    For this example, we've selected the Tracker Test instance.

  6. Configure the code you want to run with the Comment Trigger fires.
    The trigger includes a Code Block that contains some sample code.
  7. Click the  edit button on the Code Block to open the Code Editor section of the workspace.
    You have full control to amend this code as you desire, but for the sake of this example, leave the default code as is, which returns the trigger event content and context to the Activity Log (console.log).
  8. Click  to return to the workspace.

Deploying a Trigger and Configuring a Webhook

Your workspace contains a trigger and some code to run when the trigger is fired, so you're ready to deploy the workspace.

  1. Click Deploy in the top-right corner of the workspace screen.
    Deploying the workspace automatically opens the Activity Log. Feedback on the compilation and deployment process is provided, as is a prompt to configure webhooks in the connected Jira-On Premise instance. Only Jira admins have the authority to configure webhooks in your Jira instance. 

  2. Click the webhook configuration link that appears in the Activity Log.

    The Webhook Setup screen appears.

  3. Follow the on-screen instructions to set up the webhooks in your Jira Instance.
    1. In Jira, give your webhook a name, and insert the webhook URL that you copied from AutoBlocks into the URL field.
    2. Select the appropriate event as per the on-screen instructions in AutoBlocks. For this example, click Created in the Comment column.
    3. Click Create to save your changes.

      You are returned to AutoBlocks.
  4. Click Done to complete the setup and close the Webhook Setup screen.
    Your workspace is now configured, deployed, and set up with an active listener for a comment-created trigger event.

Testing a Trigger

You can test your workspace by adding a comment to an issue in the Jira instance.

When the new comment is detected by AutoBlocks, an invocation of the workspace is scheduled. AutoBlocks works asynchronously, so it may take a few seconds to respond. The event content and context appear in the Activity Log.

Viewing the event from the Reporting dashboard gives a better overview of results.

Click View more to see the full results of the event.