LogoLogo
Sign upHelp CenterContactSocial
Home
Home
  • Overview
  • REST API
    • Getting started
    • Navigating maps and workspaces
    • Uploading files and URLs
    • Styling layers
    • Refreshing live data layers
    • Working with elements
    • Listening to updates using webhooks
    • API Reference
      • Authentication
      • Maps
      • Layers
      • Elements
      • Users
      • Comments
      • Embed Tokens
      • Sources
      • Projects
  • JS SDK
    • Getting started
    • General concepts
    • Controlling maps
    • Working with selection
    • Reading entities
    • Drawing elements
    • Working with layers
    • Layer filters
    • Building custom charts
    • Map interactions and viewport
    • Hiding and showing
    • Integrating with React
    • Sample application
    • Examples
    • API Reference
  • Felt Style Language
    • Getting started
    • Style definition blocks
      • The config block
      • The paint block
      • The label block
      • The legend block
      • The popup block
      • The attributes block
      • The filters block
    • Types of visualizations
      • Simple visualizations
      • Categorical visualizations
      • Numeric visualizations (color & size)
      • Heatmaps
      • Hillshade
    • Zoom-based Styling
      • Interpolators
    • Legends
    • Errors
    • Examples
Powered by GitBook
On this page
  • Requirements
  • Generating a new webhook
  • Using your new webhook

Was this helpful?

Export as PDF
  1. REST API

Listening to updates using webhooks

PreviousWorking with elementsNextAPI Reference

Last updated 3 months ago

Was this helpful?

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 elements, 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:

  1. A Felt map which will serve as the basis for the webhook. Updates will be sent whenever something on this map changes.

  2. A webhook URL where the updates will be sent in the form of POST requests.

Generating a new webhook

Workspace admins can set up webhooks in the .

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
  1. Create a free Pipedream account

  2. On the left-hand sidebar, navigate to Sources, then click on New source in the top-right corner.

  3. Select HTTP / Webhook, then New Requests (Payload Only), and give your newly-created source a name.

  4. Copy the endpoint URL. It will look like https://XXX.m.pipedream.net

  5. Paste the endpoint URL from Pipedream into the Webhook URL text field, select your map in the dropdown and click Create.

To test your webhook:

  1. Navigate to the Felt map that's linked to the webhook

  2. Make any change: add a pin, draw with the marker, change the color of a polygon, update sharing permissions...

  3. Back in Pipedream, verify that new events appear for the new source. The payload should look like this:

{
  "body": {
    "attributes": {
      "type": "map:update",
      "updated_at": "2024-04-29T12:16:46",
      "map_id": "Jzjr8gMKSrCOxZ1OSMT49CB"
    }
  }
}
  1. 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.

  1. In the AWS console, navigate to Lambda and click on Create function

  2. Choose a name and runtime and, under Advanced Settings, make sure to check Enable function URL

  3. Set Auth type to NONE and click on Create function

  4. In the next screen, copy the Function URL. It should look like https://{LAMBDA_ID}.lambda-url.{REGION}.on.aws

  5. Continue configuring your Lambda function as usual by editing the code that will run on map updates

In Felt:

  1. Paste the function URL from AWS into the Webhook URL text field, select your map in the dropdown and click Create.

is an easy way to collect webhook requests and even run custom code as a result.

In Felt, navigate to the and click on Create new webhook

Navigate to the and click on Create new webhook

Pipedream's RequestBin
Webhooks tab of your workspace
Webhooks tab of your workspace
Developers tab of the Workspace Settings page