۶Ƶ

Webhooks

A webhook is an HTTP call that is triggered by an event. You can use webhooks to activate instant trigger modules. Any application that is connected to the Internet and allows HTTP requests can send webhooks to ۶Ƶ Workfront Fusion.

Access requirements

You must have the following access to use the functionality in this article:

۶Ƶ Workfront plan*
Pro or higher
۶Ƶ Workfront license*
Plan, Work
۶Ƶ Workfront Fusion license**

Current license requirement: No Workfront Fusion license requirement.

Or

Legacy license requirement: Workfront Fusion for Work Automation and Integration

Product

Current product requirement: If you have the Select or Prime ۶Ƶ Workfront plan, your organization must purchase ۶Ƶ Workfront Fusion as well as ۶Ƶ Workfront to use functionality described in this article. Workfront Fusion is included in the Ultimate Workfront plan.

Or

Legacy product requirement: Your organization must purchase ۶Ƶ Workfront Fusion as well as ۶Ƶ Workfront to use functionality described in this article.

*To find out what plan, license type, or access you have, contact your Workfront administrator.

**For information on ۶Ƶ Workfront Fusion licenses, see ۶Ƶ Workfront Fusion licenses

Use a webhook in Workfront Fusion

NOTE
To call a third party webhook (an outgoing webhook) use one of the HTTP modules. For more information, see HTTP modules.

To use a webhook to connect an app to Workfront Fusion:

  1. Add the Webhooks >Custom Webhook instant trigger module to your scenario.

  2. Click Add next to the Webhook field and enter a name for the new webhook.

  3. (Optional) Click Advanced Settings.

  4. In the IP restrictions field, enter a comma-separated list of the IP addresses that the module can accept data from.

  5. Click Save

After you create a webhook, a unique URL displays. This is the address where the webhook sends data. Workfront Fusion validates the data sent to this address, then passes it on for processing in the scenario.

NOTE
Once you create a webhook, you can use it in more than one scenario at a time.

Configure the webhook’s data structure configure-the-webhook-s-data-structure

In order to recognize the data structure of the incoming payload, Workfront Fusion parses sample data that you send to the displayed address. You can supply the sample data by making a change in the service or app that will make that service or app call the webhook. For example, you could remove a file.

Or you can follow the steps below to send the sample data via the HTTP > Make a request module.

  1. Create a new scenario with the HTTP > Make a request module

  2. Configure the module with the following values:

    table 0-row-2 1-row-2 2-row-2 3-row-2 4-row-2 layout-auto html-authored no-header
    URL Enter the URL of the webhook. You can find this URL in the Webhooks module that you have used to set up the webhook.
    Method POST
    Body type Raw
    Content type JSON (application/json)
    Request content Raw JSON expected in the webhook

  3. Open the scenario with the Webhooks module in a separate browser tab or window.

  4. In the webhooks module, click Redetermine data structure.

    You do not need to unlink other modules from the webhooks module.

  5. Switch to the scenario with the HTTP module and run it.

  6. Switch back to the scenario with the Webhooks module.

    A “Successfully determined” message means that the module has successfully determined the data structure.

  7. Click OK to save the data structure.

    The webhook’s items are now available in the mapping panel for use with subsequent modules in the scenario.

The webhook queue

If a webhook receives data and there is not an active scenario that is expecting that data, the data is stored in the queue. Once you activate the scenario, it processes all bundles waiting in the queue sequentially.

IMPORTANT
Webhook queues are shared among scenarios that employ the same webhook. If one of the scenarios is disabled, all incoming data is held in the queue.

Supported incoming data formats

Workfront Fusion supports 3 incoming data formats: Query String, Form Data and JSON.

Workfront Fusion validates all incoming data against the selected data structure. Then, depending on the scenario’s settings, the data is either stored in the queue for processing, or it is processed immediately.

If any part of the data does not pass the validation, Workfront Fusion returns a 400 HTTP status code and specifies, in the body of the HTTP response, the reason why the incoming data failed the validation checks. If the validation of the incoming data succeeds, Workfront Fusion returns a “200 Accepted” status.

Query String

GET https://app.workfrontfusion.com/wh/<yourunique32characterslongstring>?name=<yourname>&job=automate

Form Data

POST https://app.workfrontfusion.com/wh/<yourunique32characterslongstring>

Content-Type: application/x-www-form-urlencoded

name=<yourname>&job=automate

Multipart form data

POST https://app.workfrontfusion.com/wh/<yourunique32characterslongstring>


Content-Type: multipart/form-data; boundary=---generatedboundary

---generatedboundary

Content-Disposition: form-data; name="file"; filename="file.txt"


Content-Type: text/plain


Content of file.txt


---generatedboundary

Content-Disposition: form-data; name="name"

Workfront Fusion

---generatedboundary

In order to receive files encoded with multipart/form-data, you must configure a data structure with a collection type field that contains the nested fields name, mime, and data. The field name is a text type and contains the name of the uploaded file. The mime is a text type and contains a file in MIME format. The field data is a buffer type and contains binary data for the file being transferred.

For more information on MIME format, see MIME modules.

JSON

POST https://app.workfrontfusion.com/wh/<yourunique32characterslongstring>

Content-Type: application/json

{"name": "Workfront Fusion", "job": "automate"}
TIP
If you want to access the original JSON, enable JSON pass-through when setting up the webhook.
  1. Click Add to add a new webhook.
  2. Click Show advanced settings.
  3. Click JSON pass-through.

Webhook headers

To access the webhook’s headers, enable Get request headers when setting up the webhook.

  1. Click Add to add a new webhook.
  2. Click Show advanced settings.
  3. Click Get request headers.

You can extract a particular header value with the combination of map() and get() functions.

INFO
Example:
The example below shows a formula that extracts the value of the authorization header from the Headers[] array. The formula is used in a filter that compares the extracted value with the given text to pass only webhooks if there is a match.
For further information on obtaining an array’s element with a given key, see Map an array’s element with a given key in the article Map information from one module to another in ۶Ƶ Workfront Fusion.

Responding to webhooks

The default response to a webhook call is the text “Accepted”. The response is returned to the app that called the webhook during the execution of the Custom Webhook module.

Test the response to a webhook

  1. Include the Custom Webhook module in your scenario.

  2. Add a new webhook to the module.

  3. Copy the webhook URL to your clipboard.

  4. Run the scenario.

    The lightning icon on the Custom Webhook module changes to spinning dots. This shows that the module is now waiting for the webhook call.

  5. Open a new browser window, paste the copied URL in the address bar and press Enter.

    The Custom Webhook module is triggered and the browser will display a new page.

If you want to customize the webhook’s response, employ the module Webhook Response.

The configuration of the module contains two fields: Status and Body.

  • The Status field contains HTTP response status codes such as 2xx for Success (for example, 200 for OK), 3xx for Redirection (for example, 307 for Temporary Redirect), 4xx for Client errors (for example, 400 for Bad Request), and so on.

  • The Body field contains anything that will be accepted by the webhook’s call. It can be simple text, HTML, XML, JSON, and so on.

    note tip
    TIP
    We recommend setting the Content-Type header to the corresponding MIME type: text/plain for plain text, text/html for HTML, application/json for JSON, application/xml for XML, and so on. For more information on MIME types, see MIME modules.

Timeout for sending a response is 40 seconds. If the response is not available within that period, Workfront Fusion returns a ‘200 Accepted’ status.

HTML Response example

INFO
Example:
Configure the Webhook Response module as follows:
table 0-row-2 1-row-2 2-row-2 layout-auto html-authored no-header
Status 2xx success HTTP status code, e.g. 200
Body HTML code
Custom headers
  • Key: Content-type
  • Value: text/html
This will produce an HTML response that displays in a web browser:

Redirect example

INFO
Example: Configure the Webhook Response module as follows:
table 0-row-2 1-row-2 layout-auto html-authored no-header
Status 3xx redirection HTTP status code, e.g. 303
Custom headers
  • Key: Location
  • Value: The URL you would like to redirect to.

Webhook deactivation

Webhooks are deactivated automatically if either of the following applies:

  • The webhook has not been connected to any scenario for more than 5 days
  • The webhook is used only in inactive scenarios, which have been inactive for more than 30 days.

Deactivated webhooks are deleted and unregistered automatically if they are not connected to any scenarios and have been in deactivated status for over 30 days.

Troubleshooting

Missing items in the mapping panel

If some items are missing in the mapping panel in the setup of the modules following the Webhooks > Custom Webhook module, click on the Webhooks > Custom Webhook module to open its setup and click Re-determine data structure:

Then follow the steps described in the section Configure the webhook’s data structure in this article.

recommendation-more-help
5f00cc6b-2202-40d6-bcd0-3ee0c2316b43