span8
span4
span8
span4
There is a huge benefit to using Webhooks as means of instant notification - if your client needs updates for specific events, creating a Webhook for those events will enable them to receive and disseminate information about that event into their automated workflows. A Webhook allows one system to receive data from another system in real-time. Instead of polling a source system for new data, events in the source system automatically send data to the target system.
Webhooks are HTTP (POST, GET) callbacks that are sent to user-defined URLs in response to triggers or events. The use of Webhooks allow for third party data integration with existing services, such as FME Server!
Using Webhooks is nearly as simple as entering a URL into the address bar of any web browser. The URLs are almost always contained on one line, and there is no requirement to write code!
As an example, imagine that you have a webpage where users can post data. You could setup a Webhook to track new postings. By inserting a URL of your choosing into this Webhook, and when new data is posted, it will use the HTTP POST method to send the data to your URL, typically as a JSON payload. This information can be digested to trigger workflows or propagated to other systems using subsequent Webhooks.
Every topic created in FME Server automatically generates a direct URL that can be used with a Webhook. When an event configured to the direct URL triggers, it will send information to that topic in FME Server. Subscriptions can be configured to monitor a topic and then FME Server can perform additional events, such as delivering data via email or updating a database, based on the protocols you have set up.
(Navigate tothis documentationfor information on the supported subscriber protocols in FME Server and how to properly configure each.)
获得直接的url来触发topics from FME Server is really easy:
The power of FME Server doesn’t stop with enabling third-party apps to send messages to FME Server via Webhooks. In fact, FME Server has the ability to submit data to URLs, which includes Webhooks – this means that FME Server can be used with any third-party services that utilize Webhooks!
In this example, we will be using a rich messaging tool. Through some simple configurations, and without writing any code, FME Server can be configured to send information about successful (or failed) jobs to Slack. This provides an easy and effective way to be informed about and monitor scheduling, automation, or general activity with FME Server.
A workspace can be authored to create and format data to send off to a Webhook. This example workspace pictured below is driven by the HTTPCaller – which is the transformer used to actually submit data to the Webhook.
Below is an example of FME Server sending to a Webhook. In this example, you will:
Requirements
Slack keeps you organized with purposeful channels. This example requires you to setup a channel to use for the purpose of receiving messages sent by a workspace run by FME Server. After creating a new channel, or selecting an existing one, add an “Incoming WebHooks Integration”. The channel fme_notifications is used in this example.
The URL will look similar tohttps://hooks.slack.com/services/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and will be used as theSlack Webhook URLparameter in the example FME Workspace.
This example workspace has been configured to provide a link to the log file within the Slack message for any failed job. For these links to work, the Token Authentication parameter must be valid (see below for an example).
Slack Webhook URL:
FME Server Hostname: The hostname of your FME Server.
令牌验证: A valid token can be obtained by selectingManage Tokenin the FME Server Web UI (see image below) or by accessing the REST API of your FME Server via http://
For more information about the Token Service, please seethis documentation.
Publish the example workspace fmeserver_slack_webhook_2016.fmw to your FME Server. This workspace contains all the logic required for Slack to post a message to a channel. Since this workspace will be configured with the Workspace Subscriber, it does not need to be registered with any FME Server Services.
In order for the example workspace to send messages to Slack, it needs to subscribe to a topic that will be triggered by other workspaces run in FME Server. The topic will notify the Workspace Subscription configured in this step and pass data to the JSON Reader of the workspace.
The last step is configuring workspaces to post job status notifications to the topic, and thus messages to your Slack channel. This can be achieved in FME Desktop when publishing another workspace to FME Server.
Two workspaces have been included in this example package to test the Slack messages: simple_success.fmw and simple_fail.fmw. Select the Job Submitter Service, edit the properties andset the Notify on Job Completionto the SLACK_WEBHOOK topic.
Run either workspace (simple_success.fmw or simple_fail.fmw) that was just published and registered with the Job Submitter Service. Observe the results in Slack after the job completes.
RequestBinprovides a URL that can used in place of the Slack Webhook URL. This service can be used to inspect exactly what FME Server is sending.
Hurlgenerates HTTP requests that can be directed towards Webhook URLs. Instead of using FME to create and send the JSON message, this tool can be used to send your own message to any third-party service. This is particularly useful for testing scenarios where FME Server is providing the Webhook.
RequestBincan also be used to see what other third-party services are providing. FME Server topic monitoring can show the message, but not all of the HTTP details; RequestBin can be used to further debug each request.
Blog: Moving Data over the Web: AJAX vs. WebSockets vs. Webhooks
Triggering Notifications from a Workspace
FME Server Developer Playground: Trigger Notification
Webinar: How to Develop for Data Transformation with FME Server
Webhooks and FME Server with Slack Integrations (2015)
FME Server as a WebHook for littleBits
Receiving email, Part 1: Setting up a topic and an email address (2015)
Sending email, Part 4: Sending prettier email using HTML (2015)
Sending email, Part 1: Setting up a topic and an email subscriber (2015)
Sending email, Part 3: Sending an email when a workspace completes (2015)
Sending email, Part 2: Sending an email using the FMEServerNotifier (2015)
Sending email, Part 5: Sending an email with attachments (2015)
© 2020 Safe Software Inc |Legal