Webhook Triggers Quickstart Guide
Limited Preview: Webhook Triggers & Listener
Webhook Triggers and the Webhook Listener are currently in Limited Preview and may change without notice. Access is invite-only. Self-nomination form is here. Production use is approved but may be subject to interruptions or breaking changes.
Step-by-Step Instructions
Phase 0: Pick a Use Case
Maybe you already have an event-driven use case in mind which you want to build for a customer or prospect. If so, great! Follow along the guide below to build it out.
But if you don’t have a specific use case in mind or you just want a very simple example to build your knowledge, I recommend you follow the step-by-step instructions to set up the Notify on New GitHub Issue use case:
Notify on new GitHub issue
- What it does: Whenever a new issue is opened in a specific GitHub repository, Moveworks sends a notification with the issue details.
- Requirements: You have a Github account with at least one repo.
Phase 1: Set Up Your Webhook Listener
-
In the top right-hand corner click on “Agent Studio”
-
Click on the new “Listeners” icon in the left-nav. The click “Create”.
-
On the Listener creation page add a Name and a Description. Suggestion:
- Name:
yourmwid_GitHub_Issue_Trigger_Test
- Description:
Listener for GitHub issues on my repo
- Name:
-
Click “Copy URL”. (You’ll need to add this into the webhook provider app. GitHub in our case). Click “Validate”. Then click “Publish”.
For now, we’ll leave the “Advanced Configurations” settings at the bottom of the page untouched.
-
In Github, navigate to the webhook settings on one of your repos.
-
Navigate to one of your repos.
-
Go to the “Settings” in that repo.
-
Once in settings navigate to “Webhooks” and click “Add webhook”.
-
Fill in the fields:
-
Payload URL: Paste the Webhook URL from Moveworks
-
Content type:
application/json
-
Secret: Keep blank for now
-
SSL verification: Enable SSL verification
-
-
Under "Which events would you like to trigger this webhook?" select: Let me select individual events. Check ✅ Issues.
-
Note: This means that the webhook will only fire on when events related to “issues” on your repo occur. Not all apps support this type of filtering natively but many do. If an app doesn’t support this natively, we do in listener configuration settings “Event Filtering”.
-
-
Finally, click “Add webhook” and you’re done on the Github side for now.
-
Everything should be set up correctly but let’s confirm that things are working! For now, let’s do that directly in Github.
-
When you first set up your webhook, GitHub will send out a test payload to your webhook listener. Not all webhook providers do this, but many do.
-
Navigate back to the webhook you just set up. Then go to the “Recent Deliveries” tab. You should see at least one entry here. Click on it. If it was successful you’ll see a 200 Response code and Headers and a Payload below. This confirms that the webhook was sent and received.
-
You’ve now set up webhook in Moveworks which listens issues opened, edited, deleted, etc. in your Github repo! 🙌
-
Phase 2: Create Your Compound Action
-
In Agent Studio, navigate to “Compound Action” in the left nav and then click “Create”.
-
Give your compound action a Name and Description. Suggestion:
-
Copy the following into the “Compound Action Editor” and swap out
[email protected]
for your email.steps: - action: action_name: mw.get_user_by_email input_args: user_email: '"[email protected]"' # hardcoded for now output_key: mw_get_user_by_email_result - action: action_name: mw.send_plaintext_chat_notification input_args: message: RENDER(): template: >- New GitHub issue from @{{ sort of.user }}: "{{ data.title }}" {{ data.url }} user_record_id: data.mw_get_user_by_email_result.user.id output_key: notification_result
- Note: We’re hardcoding the email for now to keep things simple. In a real-world use case, you could make this dynamic based on the user who submitted the GitHub issue, or route it to a specific team.
-
Add three input args into the compound action. Note: These input arguments define what data your compound action expects from the webhook payload. They must exactly match the keys defined in the input mapper (title, url, and user) on trigger (which you will define in the next step) otherwise your plugin won’t work.
Argument Name Data Type Description Required user string user field yes title string title field yes url string url field yes
-
- Note: We’re hardcoding the email for now to keep things simple. In a real-world use case, you could make this dynamic based on the user who submitted the GitHub issue, or route it to a specific team.
-
Click “Validate”. Fix any errors that arise then click “Publish”.
Phase 3: Configure Your Plugin
-
In Agent Studio, navigate to Plugins then click “Create”.
-
Again provide a Name and a Description. Suggestion:
- Name:
yourmwid_Notify_GitHub_Issue
- Description:
Sends a notification when a new GitHub issue is opened.
- Name:
-
In the “Workflow Overview” section click “System” in the Trigger box.
-
Then Configure your System Trigger.
-
Select Type: Webhook Trigger
-
Select Listener: Select the listener you created in Step 1 for example:
yourmwid_GitHub_Issue_Trigger_Test
-
Event Filter:
FALSE
-
Input Mapping:
title: parsed_body.issue.title
url: parsed_body.issue.html_url
user: parsed_body.issue.user.login
How did we arrive at the input mapping above?
Note: When we support the “Auto Configure” functionality in the listener creation setup, this process will get easier but for now it is somewhat manual.
- First, I triggered the webhook in Github by creating an issue so I could see what the payload looked like.
-
Go back to Github and the specific repo you configured the webhook for in Step 1. Then click on the “Issues”. Then click “New Issue”.
-
Name your new bug whatever you’d like and click “Create”.
-
- Now let’s go look at the payload for this new issue event.
-
In your repo go back to “Settings” then “Webhooks”
-
Select the wehook you created in Step 1 an click on the “Recent Deliveries” tab
-
From there click on the most recent event you generate and look at the payload
-
The fields we care about for our plugin are as follows:
issue.title
issue.html_url
issue.user.login
-
Why parsed body?
- We want to use the parsed body when there is JSON payload. You also have access to the headers and the query params.
-
-
-
Then click on the Body box to configure.
- Select Type should be “System Body”
- And select the name of the compound action you created in Step 2 —
yourmwid_Notify_GitHub_Issue
.
-
Finally, navigate to the “Launch Configuration” tab. Select “Allow selected users” and add in your own email.
-
Click “Validate”. Fix any errors that arise then click “Publish”.
-
You plugin has been created! Now we’re ready to test.
Phase 4: Testing
To test this out we need to create an issue and trigger an event in Github.
-
Go back to Github and the specific repo you configured the webhook for in Step 1. Then click on the “Issues”. Then click “New Issue”.
-
Name your new bug whatever you’d like and click “Create”.
-
If all is working well your plugin should execute and your should get an notification in MoveDev that look like this:
-
Yay! You’ve successfully created your first webhook-triggered plugin 🙌
Updated about 10 hours ago