I know SeaTable provides a webhook mechanism for other applications to be notified when a table’s content changes.
I need the reverse behaviour: setting up a mechanism so that another application can send a message to SeaTable, and SeaTable would, for instance, append a row to a table with that message’s data.
I can do it in Airtable, but I couldn’t find information about SeaTable. Is it possible?
It is correct that Airtable offers an automations trigger “When webhook received”.
SeaTable has no such trigger.
But it is effortless to build such a webhook endpoint via API by yourself. Here is how I would do this with php. (more info at GitHub - seatable/seatable-api-php: PHP-bindings of the SeaTable API (api.seatable.io)).
Here is a very basic script that you can adapt to your needs after you installed the php-api via composer.
<?php declare(strict_types=1); // setting up autoloader require_once __DIR__ . '/vendor/autoload.php'; // use SeaTable api class use SeaTable\SeaTableApi\SeaTableApi; // init and obtain base access token $seatable = new SeaTableApi([ 'url' => 'https://cloud.seatable.io', 'base_app_api_token' => '1d3303315348c6b566c43709d459b33b6bac5ad1', 'base_app_name' => '(optional)', ]); // get values from request (I assume that the input is json formated...) $raw_payload = file_get_contents('php://input'); $payload = json_decode($raw_payload, true); // Append a row with the values from the payload $table = "Tasks"; $row = [ 'Name' => $payload->name, 'Description' => $payload->description ]; $result = $seatable->appendRow($table, $row);
Now you can adapt this to your needs.
Now that is cool. Thank you.
Thank you very much for taking the time to provide that code.
I understand that this solution needs me to run a server that will be responsible for receiving the webhook calls and calling SeaTable’s API to do whatever action is needed?
This is correct. Currently, SeaTable does not provide any kind of URL to RECEIVE webhooks.
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.