SeaTable
  • Functions
  • Templates
  • Solutions
    • Marketing - – The next marketing campaign is bound to come. Nothing is easier than that.
    • Project management - – Plan, track and manage team projects from start to finish.
    • Human Resources - – Structure HR processes for new hires and onboarding.
    • Distribution - Manage your entire sales pipeline and customer relationships in one place.
    • Software development - Increase the quality and speed of your development team with SeaTable.
  • Support
    • Quick guide - – Everything you need to know to get SeaTable up and running in minutes.
    • Help area - – Find answers to your questions and get tips on how to get the most out of SeaTable.
    • Integrations - – Connect SeaTable with tools like Zapier, Integromat or n8n. Or use SeaTable's API.
    • SeaTable Blog - – Here you will find product information, news and many examples of how you can use SeaTable optimally.
  • Prices
  • Login
  • login
  • Registration
  • Menu Menu

Webhooks

  • What are webhooks and what do you use them for?
  • Creating and deleting a webhook
  • Structure of the webhook data
  • Processing a webhook with the help of PHP
  • The secret key of a webhook
  • Deactivation of a webhook in case of errors
  • Home
  • Help
  • Scripts, API and integrations
  • Webhooks
  • The secret key of a webhook

The secret key of a webhook

If the destination of a webhook is publicly reachable, it is necessary to ensure that incoming requests come from the desired source system. A secret key can be used to ensure the origin of a webhook.

The idea of a secret key

To create a new webhook, simply specify any URL. The secret key may also remain empty. However, if your target URL is publicly available, you should set a secret key and validate this value when processing the webhooks. Otherwise, anyone can send you appropriate requests to this webhook URL, which will be processed by you. Without the secret key, the target system has no reliable way to know if the event really comes from SeaTable.

If you specify a secret key, the webhook has an additional X-SeaTable-Signature-Header, which can be used to ensure the origin of the webhook. As long as someone else doesn't know the secret key, they won't be able to send you events via webhook and get the matching X-SeaTable-Signature-Header to generate.

For example, if a secret key is set, a webhook request looks like this:

-- HEADER --
Content-Type: application/json
Content-Length: 625
X-Seatable-Signature: sha256=598b55485e7875def064746867ff220e79d7c75512fdb931a39e313af5abfe60
Connection: keep-alive
Accept: */*
Accept-Encoding: gzip, deflate
User-Agent: python-requests/2.28.1
Host: example.com

-- CONTENT --
{
  event:update
  data: {
    dtable_uuid: 6c17f178ee724c109c68ecee364027fc
    row_id: Y_aYcE6wTo-IzGWb-oDmaQ
    op_user: 92d8f9b243f8437db0131c2536398403@auth.local
    op_type: create_row
    op_time: 1677595743.088
    table_id: 0000
    table_name: Table1
    row_name: ""
    row_data: []
  }
}

The calculation of the secret key

The secret key is a shared secret between SeaTable and the receiving system. SeaTable uses the secret key to calculate a hash value from the event. The receiving system can use the secret key to calculate the content back from the hash value and compare it to the actual content. If the actual content does not match the calculated content from the hash, the webhook should not be processed.

Validation of the signature

In every programming language there should be corresponding functions to be able to validate such a signature accordingly. How this check would look like in PHP, you will learn in this article.

For Python, a check might look like this:

import hmac
from flask import Flask, request

app = Flask(__name__)


@app.route('/receive-seatable-webhook', methods=['POST'])
def receive-seatable_webhook():
    secret = 'secret'
    seatable_signature = request.headers.get('X-Seatable-Signature', '').replace('sha256=', '')

    signature = hmac.new(
        secret.encode('utf-8'), request.data, digestmod='sha256').hexdigest()

    signature_compare = hmac.compare_digest(signature, seatable_signature)

    if signature_compare:
        # do something
        pass

    return {'success': signature_compare}

How helpful was this article?
Updated on 28 February 2023
Processing a webhook with the help of PHPDeactivation of a webhook in case of errors
Contents
  • The idea of a secret key
  • The calculation of the secret key
  • Validation of the signature
SeaTable Logo

Do it like thousands of other people who use SeaTable to develop powerful processes, bring order to their data, and complete their tasks more efficiently.

SeaTable on Linkedin SeaTable on Medium.com SeaTable on Instagram SeaTable on Twitter SeaTable on Github SeaTable on YouTube SeaTable at Docker Hub

Products

  • SeaTable Cloud
  • SeaTable Dedicated
  • SeaTable Server
  • Support

Support

  • Quick guide
  • Help area
  • Templates
  • Integrations
  • Forum
  • Developer API
  • Status

Company

  • About us
  • We hire
  • Press
  • Contact
  • Blog
  • Imprint
  • Security
  • Data protection
  • Terms of use
  • EULA
Scroll up
  • Deutsch
  • Français
  • Español
  • Português
  • Русский