Webhooks walkthrough
- Topics:
- Workfront Fusion
CREATED FOR:
- Beginner
- User
This scenario creates a convenience store app so they can easily determine whether or not a customer is old enough to purchase alcohol. The cashier simply needs to post the name and birthdate of the customer AND a verified client token to a URL that’s been provided. Once entered, that will trigger our scenario to calculate the appropriate response and return it to the requestor.
Webhooks walkthrough
Workfront recommends watching the exercise walkthrough video before trying to recreate the exercise in your own environment.
Transcript
The purpose of this next walkthrough exercise is to learn about using webhooks to receive posts as a trigger and then send webhook responses as error messages or success messages, making sure that we’re not processing any type of request sent to the webhook. To have fun with this scenario, we’re going to pretend that we’ve created an app that a customer can use to determine if someone’s old enough to drink or not, very quickly. The information that we receive in our custom webhook trigger is going to be the name, date of birth and a client token. If the client token does match the specific one we’ve established, it will go down a successful path. If not, it will return an error message. Down the successful path, we’ll evaluate the date of birth and send back a response that you’re old enough or not old enough to drink. To be successful in this walkthrough exercise, you’ll of course want your Fusion system pulled up in your browser. And you’ll also want to open Postman. There are instructions below the walkthrough training videos to download Postman and set it up for this walkthrough exercise.
Let’s start by creating a new scenario titled, Using Webhooks. For our trigger, we’re going to use the custom webhook module.
Since I haven’t established a webhook already, I’m going to click the add button to create a new one. For the webhook name, I’m simply going to title this, Drinking Age App. You can see below the webhook name that you can set up a white list of IP addresses, if that’s known. In this scenario, we’re going to address unauthorized posts to this webhook, using routing. Go ahead and click save. And then to create data in our scenario that we can use to send a response, we actually want to copy our generic URL from our webhook that we just created. Click okay and then select Run Once on our scenario. Once we do that, we’ll go into our Postman, which we’ve set up already and you can follow the instructions below the training videos if not and you’ll see that in the body of a post, I already have form data set up for name, birthdate and a client token. For name I chose to put in my own name. I put in an arbitrary birthdate, which I know is older than 21 years. And then I put in 5121933, as the client token. Again, an arbitrary number that you can copy or create your own. For the post that we want to send in to create some form data for our scenario, I’m going to paste that URL that I copied from our trigger module and click send. Once I send, I can come back into my scenario and see that it’s successfully executed or received the post from Postman. If I click into the execution inspector, I can see that name, birthdate and the client token that I posted in Postman, is now available to be used in my scenario.
Now that we have information to utilize within our scenario, we’re going to create two different paths. The first path will send an error response if an unauthorized request is made without the matching client token. The second path will be if the client token matches, we’ll send an appropriate response back, indicating whether someone is old enough or not, to drink. To set up the two different paths, I’m actually going to right click anywhere and add a new module. For the module, I want to use the webhook response.
I’ll ignore the error message for now and clone this module. Connecting both of these to the trigger to set up the routing.
Our top path is going to be when the client token does not match. So we’re going to change the default status to a 401 or an unauthorized request. And then the body, I’m going to paste in a simple error message written in JSON so that on the receiving end it can be parsed if necessary. Go ahead and click okay and then set up the filter.
For the filter on this path, we’ll say the client token does not match.
And for the condition, we can map over the client token and then in the operators, go to numeric operators and choose not equal to and then our client token.
Clicking okay. For our second path, we’ll just do the reverse of the the above and choose client token does match.
Finally, let’s realign our scenario to clean it up and rename our modules. Our trigger we can call it, Receive a Post.
And our two responses can be, Error Message and Success Message.
Now that we have our routing paths set up, we need to create a success message that’s dynamic and will send an appropriate response, whether someone is old enough to drink or not. Clicking into the success message module, I’m going to leave the status as a 200 or okay response. And for the body, I’m going to create a message using the mapping panel and formula editor. For this, I’ll start typing in the words, you are and then I’m going to use an If statement and an Add Years function. I’ll find the If statement under the general functions tab of the mapping panel. And then after the first parentheses for the If statement, I’ll go to the date based section and find Add Years.
What I want to calculate is, if we add 21 years to someone’s birthdate it needs to be less than today for them to be old enough to drink. So I’ll go back to my module item list and choose birthdate.
After the semicolon in my Add Years function I’ll add 21 years. And after the closed parentheses, I’ll use the math function less than and then go back to the dates and choose Now. So someone’s birthdate plus 21 years must be less than now and we’ll send a response back, old enough to drink.
If not, after the semicolon, we’ll say, Out of Luck.
So if old enough, if their birthdate plus 21 years is less than right now, they are old enough to drink and they’ll receive that response. If it’s not less than now, meaning they are not 21 years old, then we’re going to say, you are out of luck.
Let’s go ahead and click Okay. Now that we’ve done that, let’s activate our scenario. So anytime there’s a new post, it will go down either path and return a response. We can now test our scenario by going into Postman. And as you recall, I put in a date of birth that is at least 21 years old and I can send in a post.
I see that the response I received from our scenario is, you are old enough to drink. I can test again by changing the date of birth to something that is not 21 years old, such as 2000 and send that again and I’ll see that I received the opposite response, You are out of luck. -
Postman setup
To follow along with the walkthrough exercise, you need to download the free Postman application. Follow the steps below to navigate to the right area of Postman for the exercise.
- Create a workspace, then open it.
- Click on the New tab and create a new collection named Drinking Age.
- Click on the New tab again and create a new GET request named GET birthdate.
- Change the request action from GET to POST.
- Go to the Body subtab area below the POST URL field.
- Choose form-data below the Authorization subtab.
- Create three keys for Name, Birthdate, and clientToken.
Your turn
This practice exercise builds on what you learned in the walkthrough, but the solution is not provided.
Create a Workfront webhook that is waiting for new updates created and then logs the date, the name of the person who made the update, and what the update says. Email yourself this information.
Hint: Use the Workfront Watch Events trigger module to create your webhook. Also, in Workfront updates are called notes.
Challenge: Can you find and add the URL for where the update was made for easy access?
Want to learn more? We recommend the following:
Workfront
- Workfront Tutorials
- Administration and Setup
- Organizational setup
- Manage deleted items
- Configure system defaults
- Layout templates
- What are layout templates?
- Find layout templates
- Customize terminology with layout templates
- Customize the Main Menu with layout templates
- Add and manage pins through a layout template
- Customize Home with layout templates
- Assign and manage access to layout templates
- Customize object areas with a layout template
- Customize project details with layout templates
- Customize project headers with layout templates
- Customize reporting lists with layout templates
- Email and In App Notifications
- Create and manage users
- Approval processes and milestone paths
- System performance and maintenance
- Project finances
- Custom Data
- Custom Forms
- Calculated expressions
- Get started with calculated fields and expressions
- Learn the data expression structure
- Understand Date & Time and Mathematical expressions
- Create ADDDAYS, ADDWEEKDAY, ADDMONTHS, ADDYEARS expressions
- Use the Calculation Editor
- Create DATEDIFF and WEEKDAYDIFF expressions
- Create a SUB, SUM, DIV, or PROD data expression
- Use the CONCAT expression in a calculated field
- Create LEFT/RIGHT expressions
- Use the ISBLANK and CONTAINS expressions
- Create an IF text expression
- Things to know about calculated field expressions
- Manage work
- Projects
- Understand basic project creation
- Navigate the project page
- Learn four ways to create a project
- Fill in the project details
- Get started planning a project
- Take a project live
- Get started managing a project
- Find projects
- Share a project
- Understand the project team
- Understand project communication
- View project information
- Track overall project progress
- Track work progress with project metrics
- Understand the Gantt view
- Understand the Board view
- Tasks
- Issues/requests
- Request queues
- Portfolios
- Approval processes and milestone paths
- Create and manage project templates
- Project timelines
- Close a project
- Project finances for users
- Intermediate projects
- Projects
- Reporting
- Basic reporting
- Understand reporting elements
- Understand reporting components
- Create a basic grouping
- Create a basic view
- Add basic conditional formatting to a view
- Create a basic filter
- Understand the new filter experience
- Create basic filter activities
- Create a simple report
- Create a task report
- Copy a report
- Create reports with charts
- Create a matrix report
- Create dashboards
- Send and share reports
- Understand report settings
- Intermediate reporting
- Create filters with user-based wildcards
- Create filters with date-based wildcards
- Create OR statements in filters
- Understand built-in project filters
- Understand built-in task filters
- Understand built-in issue filters
- Understand basic text mode for filters
- Understand basic text mode for views
- Understand basic text mode for groupings
- Create custom prompts
- Advanced reporting
- Calendar reports
- Basic reporting
- Manage resources
- Workfront Goals
- Workfront Planning
- Integrations
- Adobe Creative Cloud
- Adobe Experience Manager Assets Essentials
- G Suite
- Jira
- Microsoft Outlook
- Microsoft Teams
- Adobe Workfront for Microsoft Teams Overview
- Install Adobe Workfront for Microsoft Teams
- Access Adobe Workfront from Microsoft Teams
- Search for and share Adobe Workfront items in Microsoft Teams
- Create Adobe Workfront tasks from Microsoft Teams
- Submit Adobe Workfront requests from Microsoft Teams
- Manage Adobe Workfront notifications in Microsoft Teams
- Slack
- Fusion
- Welcome to Workfront Fusion
- Understand the basics
- Initial scenario design walkthrough
- Initial scenario design exercise
- Mapping panel and formula editor
- Mapping panel important notes
- Beyond basic mapping walkthrough
- Beyond basic mapping exercise
- Use filters
- Filters walkthrough
- Filters exercise
- Access previous versions walkthrough
- Access previous versions exercise
- Universal connectors and routing
- Universal connectors exercise overview
- Introduction to universal connectors walkthrough
- Introduction to universal connectors exercise
- Understand routers
- Routers walkthrough
- Routers exercise
- Common routing patterns
- Routing patterns walkthrough
- Routing patterns exercise
- Set-it and get-it
- Get/Set variables walkthrough
- Set/Get variables exercise
- Iteration and aggregation
- Execution history and scheduling
- Beyond basic modules
- Data structures and data stores
- Final functional bits and bobs
- Troubleshooting and error handling
- Workfront Fusion administration
- Design optimization and testing
- Workfront Proof
- Learn the benefits of proofing
- Understand the difference between a document and a proof
- Proofing viewers explained
- Administration and setup
- What is an automated workflow template
- Customize proof comment actions
- Customize proof decision options
- Understand email alerts and proof notifications
- Proof roles and email alerts
- Report on proofs
- Set default at risk proof settings
- Set up global proof settings
- Set default proof roles
- Set up proof account default settings
- Settings for proof users
- Upload proofs
- What is a proof version
- Who uploads the proof versions
- Convert a document to a proof
- View and compare proof versions
- Upload a proof version
- Manage proof versions
- Upload a proof of a video
- Upload a proof of a website
- Upload a proof with a basic workflow
- Upload a proof with an automated workflow
- Upload with a drag and drop
- Combine multiple files into a single proof
- Proof workflows
- Review and approve work
- Workfront DAM
- System setup
- Metadata and keywords
- Brand Connect customization
- Workfront DAM user: Contributor
- Understand Workfront DAM as a contributor
- Understand asset management as a contributor
- Understand finding assets as a contributor
- Understand lightboxes as a contributor
- Understand metadata and keyword best practices
- Work with assets as a contributor
- Send a file as a contributor
- Publish assets as a contributor
- Add a Workfront DAM link
- Brand Connect user
- Home
- Agile
- Best Practices
- Agile
- API Explorer
- Business case and portfolio optimizer
- Communication
- Custom forms
- Custom reports
- Dashboards
- Documents
- Filters, views, and groupings
- Job roles
- Layout templates
- Licenses and access levels
- Onboarding and adoption
- Organization units
- Portfolios and programs
- Preview sandbox
- Project, task, and issue preferences
- Project templates
- Proofing
- Request queue
- Resource Planner
- Resource pools
- Scenario Planner
- Schedules
- Statuses
- System performance and maintenance
- Text mode reporting
- Timeline planning and management
- Timesheets and logging time
- Utilization
- Workfront Goals
- Workload Balancer
- Workfront for executives