I'm trying to get a webhook up and running so that Microsoft Graph can write straight to a topic on one of my FME Cloud instances.I'm using the following:
Go tohttps://developer.microsoft.com/graph/graph-explorer/,do a POST-request tohttps://graph.microsoft.com/v1.0/subscriptionsusing the following body:
{ "changeType": "created,updated", "notificationUrl": "the-topic-url from Message as Subscriber Content", "resource": "me/mailFolders('Inbox')/messages", "expirationDateTime":"2019-02-15T18:23:45.9356913Z", "fmetoken":"token-goes-here"}
However,I get the following response:
{ "error": { "code": "InvalidRequest", "message": "Subscription validation request failed.Must respond with 200 OK to this request.", "innerError": { "request-id": "5b842b2b-6325-444e-890e-f9ff6eb61510", "date": "2019-02-14T13:09:40" } }}
Using Postman,I've verified that I get a 202-response if I make a POST-request to the topic URL.Is there another way that I can get a Microsoft Graph webhook up and running?I've seen that there's a web connection for MS Graph,but I don't know if there's any way for me to use that to set up the webhook.
FME technology (FME Desktop,FME Server,FME Cloud) is well suited for working with the latest web technologies.Here you will learn about how to work with:
This is the static data on the web such as images,XML,Shapefiles,AutoCAD DWG,GeoJSON,Web Map Tiles,PDF,and the list goes on.Data that users download and that some web applications consume as well.FME can use all these web resources as well as produce them,and even transfer them to where they are served from.
Accessing
In a workspace,all file-based Readers can accessdata from a URLor Web Resources.TheHTTPCallertransformer can also download data with the added option to authenticate the requests.The HTTPCaller can store cookie data for a host,which allows you to login using one URL and then download a resource from another URL.If the data you download is not XML/JSON,which are easily handled by transformers in FME Workbench,you can use theAttributeFileWriterorFeatureWritertransformers to save it locally,then followed by theFeatureReadertransformer to read it back into the workspace.
Providing
Once you have files,you need to serve them.This can be as simple as copying them to the public folder of a website (e.g.usingFile Copy writer) or you might use an existing cloud service for this purpose.FME has native support for bothAmazon S3and Dropbox (DropboxConnector),and you can upload data to other cloud services such as Google Drive andBox.comusing the HTTPCaller transformer.In addition,thePythonCallertransformer can be used to upload data if all else fails.
Note: Many of the latest web services are implementing an authorization framework called OAuth.In FME 2016,you can定义OAuth 2.0 web连接that the HTTPCaller can use when connecting to web services.This provides greater security than regular HTTP and Token authentication methods.
Examples
Web services provide the standard for means of communication and grant access to functionality between applications that would otherwise be disconnected.FME technology can be leveraged to use existing web services,create new web services,and implement web service standards.FME Server provides web services for some common data 亚搏在线workflows and can be extended to implement common industry standards.
FME Server REST API
The FME Server REST API is a powerful tool that can be used to interact with FME Server.TheFME Server REST API Trainingteaches users how to use the FME Server REST API and build their own web applications.The REST API allows a user to interact with the FME Server without the use of the FME Server's Graphical User Interface.This courseteaches users what the REST API is,how to use it,and how to build custom web applications that leverage the power of FME.
Accessing
Native Support
There are many,many web services that you may want to access with FME.Generally,these services either store data for use with a set of applications or process data for use by other applications.FME supports both cases using a combination of Readers,Writers and Transformers.
Web service providers that are natively supported by FME include:
Do-It-Yourself Support
The list of supported providers above is quite small when considering the vastness of the web.To support other web services,the HTTPCaller transformer can be utilized to connect and the required protocol logic can be managed into a single interface,called acustom transformer.
Examples of using the HTTPCaller transformer to connect to web services include:
Note: Many of the latest web services are implementing an authorization framework called OAuth.In FME 2016,you can定义OAuth 2.0 web连接that the HTTPCaller can use when connecting to web services.This provides greater security than regular HTTP and Token authentication methods when connecting to web services such as: Google Drive,Dropbox,Box.com,and many more.
Providing
FME provides a great platform for working with data and FME Server provides a web service for directly exposing data called the theData Streaming service.This service can be built upon to implement third-party web standards as well as creating your own RPC or REST bespoke web services.Web services can be created with FME Server,including native support forData DeliveryandData Loading– two very common web data 亚搏在线workflows.
Examples
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.Webhooks only need an HTTP URL instead of a specific protocol like JMS or WebSockets.
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.
Using Webhooks is nearly as simple as entering a URL into the address bar of any web browser.The URLs aren't complicated,usually won't require any configuration,and there is no requirement to write code!
Accessing or Calling a Webhook URL
TheHTTPCallertransformer is the gateway for FME to integrate with Webhooks provided by third parties.Workspaces,authored in FME Workbench,can translate spatial data and construct messages in the syntax required by other services (e.g.XML or JSON).HTTPCaller can use the POST request method to send the message to the Webhook,where it will be consumed by the third party service.
Providing a Webhook URL
FME Server can provide the Webhook callback URL with its Notification Service.Every topic created in FME Serverautomatically generates a direct URL that can be provided as the callback URL of a Webhook.When an event occurs in another system,the topic in FME Server will be provided with information about that event.
As an example,imagine that you have a webpage where users can post data.You could setup the webpage to forward new entries on to other systems via a Webhook.By providing the Webhook callback URL,and when new data is posted the webpage,the HTTP POST method will 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.
Subscriptions can be configured to monitor a topic and thenFME Server can perform additional events,such as delivering data via email or updating a database,based on the protocols you have set up.
Examples
WebSockets are a relatively new technology,implemented on top of HTTP,that allows for bidirectional browser-based client-server communication without the overhead of polling (AJAX requests with HTTP overhead),nor the inconvenience and unreliability of client plugins.Modern browsers include built-in implementations of a JavaScript API for connecting to a WebSockets server.Web applications can use WebSockets to pass information back and forth between server and client to give an always connected,real-time,and immersive feel.
Since the 2014 release,FME Server can act as a WebSocket serverwithout additional modules,allowing fast real-time communication with client web applications,with minimal setup required.
Accessing or Receiving
Using theWebSocketReceivertransformer,FME can receive WebSocket messages from various servers.A feature is produced each time a message is received,and the contents of the message is placed into the specified attribute.FME workspaces containing WebSocketReceiver transformers can be authored to process the messages in the same 亚搏在线workflow to create spatial data or for generating notifications based on data contained in the message.
Messages can also be received by theWebSocket Publisher– part of the FME Server Notification Service.This publisher receives messages over TCP from a WebSocket-supported client and publishes them to FME Server topics.Supported clients can include the WebSocketSender transformer,as well as Java or HTML5 web browsers.
Providing or Sending
TheWebSocketSendertransformer can send messages to WebSocket servers.The first input feature will cause the WebSocketSender to initialize a connection,and features specified in the data to transmit will be sent to the server,including the first feature that initiated the connection,in real-time.
TheWebSocket Subscribercan be used to receive notifications from the FME Server Notification Service and publish them over TCP to WebSocket-supported clients that are connected to the FME Server WebSocket server or another target URL.Supported clients include the WebSocketReceiver transformer and HTML5-based web browsers.
Examples
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.)
Obtaining the direct URLs to trigger 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.
Token Authentication: 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
This article is specific to FME Desktop and Server 2015.1.For the latest version of this content,please visitWebhooks and FME Server with Slack Integrations.
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!
There is a huge benefit to using Webhooks as means of instant notification - if your client is requesting 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.
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 whenever new data is posted,it will trigger the HTTP POST command and send it to your URL containing information about the new data posting,typically as a JSON payload.This information can be digested to trigger 亚搏在线workflows or perform additional 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.If you have any subscriptions tagged with this topic,then FME Server can perform additional events 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.)
Obtaining the direct URLs to trigger topics from FME Server is really easy:
In FME Server,the application of Webhooks is not limited to using topics;it is possible to grab the direct URL for a workspace and use this in a Webhook.Any workspace can be automatically executed and configured to interpret any messages sent by the triggering event!The workspace can be configured to anyFME Server servicesuch as Data Download,作业提交者,and KML Network Link to name a few.
Obtaining the URLs to directly run a workspace is just as easy as for an FME Server topic:
Note that by default,the jobs will be submitted as the Guest/fmeguest account.Make sure that the proper permissions have been set in the FME Server Web UI (Manage > Administration > Security > Role Policies),or useToken Authentication.
Requirements
The power of FME Server doesn't stop with generating direct URLs for topics and workspaces.In fact,FME Server can send outgoing notifications – this means that FME Server can be used with any third party services that utilize Webhooks!
In this example,we will be using Slack.Through some simple configurations,and without writing any code,FME Server Notifications can be setup to send information about successful (or failed) jobs to messaging services.This provides an easy and effective way to monitor scheduling,automation,or general activity with FME Server.
The workspace used in this example is attached to this article and all the necessary configurations are noted below.
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 to "https://hooks.slack.com/services/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" and will be used as the Slack Webhook URL parameter in the example FME Workspace.
This example workspace has been configured such that any Failed Jobs will have a link provided to the Log File in the message posted to Slack.For these links to be valid,the following Translation Parameters must be set: FME Server,Username/Password,and Token Authentication.
Slack Webhook URL:
FME Server Hostname/IP: The hostname or IP address of your FME Server (e.g.http://
Username/Password: The username and password of a user who has permissions to Manage Jobs (this can be verified via the FME Server Web UI > Manage > Administration > Security > Role Policies)
Token Authentication: A valid token can be obtained by accessing the REST API of your FME Server via http://
For more information about the Token Service,please see
this documentation.
Publish the example workspace fmeserver_slack_webhook_2015.fmw to your FME Server.
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 subscription created will point to the direct URL of the workspace uploaded in Step 3.
On the Configure Workspace page,select Developer Information to reveal the direct URL.Copy this link for use when the Subscription is created.
The last configuration step is setting which workspaces will post job status notifications to the 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.For each Registered Service selected,edit the properties and set the Notify on Job Completion to the SLACK_WEBHOOK topic.
Run any workspace with a Registered Service configured to post to the SLACK_WEBHOOK topic.Observe the results in Slack after the job completes.
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
Blog: Automation for the Enterprise