Skip to main content

Create a web trigger

Write a web trigger script, turn it on and copy its URL, so another system can call it.

Applies to: Script Master for Jira and Script Master for Confluence Β· Cloud

Before you begin​

  • Jira or Confluence permission: Jira admin (the Administer Jira global permission) or Confluence admin.
  • App permission: an active Script Master license.
  • A configured Companion App. Without it, the script doesn't run. See Set up the Companion App.
  • Fewer than 100 web triggers on the site. From 80 web triggers on, the list shows how many are left, for example 85 of 100 web triggers used Β· 15 left.

Create the web trigger​

  1. In Script Master, select the Web Triggers tab.

  2. Select Create web trigger. The editor opens, marked New Β· not saved yet.

  3. In Title, enter a name other admins will understand, for example Create work item from monitoring alert.

  4. In Backend JavaScript, write the script. It must return an object with a statusCode:

    const payload = JSON.parse(request.body || '{}');
    console.log('Received', payload);

    return {
    statusCode: 200,
    headers: { 'Content-Type': ['application/json'] },
    body: JSON.stringify({ received: true }),
    };

    Snippets has working examples to copy, such as Authorization, Request and Response.

  5. Turn on Enable.

  6. Select Save.

    The web trigger editor after the first save, with the Web Trigger URL field, Title, Enable and Save

Result: The flag Web Trigger saved! appears, and Web Trigger URL: shows Script Master's own URL for this web trigger. Select the copy icon next to it and give the URL to the system that will call it.

Before the first save, the URL area says To generate the URL for this web trigger, please save it first.

warning

The URL works for anyone who has it. Before you give it out, add a token check. See Require a token on a web trigger.

Save with a note​

Each save that changes the title or the script adds a version to the web trigger's version history. To say what changed, select the arrow next to Save, then Save with note…, and type the note. See Version history.

In the editor, Ctrl+S (Cmd+S on a Mac) also saves.

Other ways to start​

Next to Create web trigger, the arrow opens Import. Paste a web trigger exported from another site. It arrives switched off. See Import, export and duplicate.