Listening to updates using webhooks
A great way of building data-driven apps using Felt is by triggering a workflow whenever something changes on a map, like someone drawing a polygon around an area of interest or updating the details on a pin.
Instead of polling by listing annotations, comments or data layers on a fixed interval, a better alternative is to set up a webhook where Felt will send a notification any time a map is updated. This allows you to build integrations on top, such as sending a Slack message or performing calculations for the newly-drawn area.
Requirements
Two things are needed in order to make use of webhooks:
A Felt map which will serve as the basis for the webhook. Updates will be sent whenever something on this map changes.
A webhook URL where the updates will be sent in the form of
POSTrequests.
Generating a new webhook
Workspace admins can set up webhooks in the Developers tab of the Workspace Settings page.
Simply click on Create a new webhook, select a map to listen to changes and paste in a webhook URL where the updates will be sent to.

Using your new webhook
In order to use webhooks effectively, a receiving layer must be set up to trigger actions based on the updates sent by the Felt API. Here are some examples of how to set up a webhook using Felt and an external service.
Setting up an example webhook using Pipedream
Pipedream's RequestBin is an easy way to collect webhook requests and even run custom code as a result.
Create a free Pipedream account
On the left-hand sidebar, navigate to
Sources, then click onNew sourcein the top-right corner.Select
HTTP / Webhook, thenNew Requests (Payload Only), and give your newly-created source a name.Copy the endpoint URL. It will look like
https://XXX.m.pipedream.netIn Felt, navigate to the Webhooks tab of your workspace and click on
Create new webhookPaste the endpoint URL from Pipedream into the
Webhook URLtext field, select your map in the dropdown and clickCreate.
To test your webhook:
Navigate to the Felt map that's linked to the webhook
Make any change: add a pin, draw with the marker, change the color of a polygon, update sharing permissions...
Back in Pipedream, verify that new events appear for the new source. The payload should look like this:
You may also add configure a script to run using the above input.
Setting up an example webhook using an AWS Lambda
Serverless functions like AWS Lambda or Google Cloud Functions are an excellent way of triggering code after a map update by setting them to run after a specific HTTP call.
In the AWS console, navigate to
Lambdaand click onCreate functionChoose a name and runtime and, under
Advanced Settings, make sure to checkEnable function URLSet
Auth typetoNONEand click onCreate functionIn the next screen, copy the
Function URL. It should look likehttps://{LAMBDA_ID}.lambda-url.{REGION}.on.awsContinue configuring your Lambda function as usual by editing the code that will run on map updates
In Felt:
Navigate to the Webhooks tab of your workspace and click on
Create new webhookPaste the function URL from AWS into the
Webhook URLtext field, select your map in the dropdown and clickCreate.
Last updated
Was this helpful?