Can button be used to activate webhook and send row contents to Integromat/Make?

I would like to send the contents of a row via a webhook to Integromat/Make by clicking on a button in a ST column. What is the best/right way to do it?

Hey webdienste,

this is straightforward. First, you write a python-script inside SeaTable.

Python-Script

The script should look like this: (not tested, I just wrote it out of my memory)

from seatable_api import Base, context

# Authentification
server_url = context.server_url or 'https://cloud.seatable.io'
api_token = context.api_token or 'xxx'
base = Base(api_token, server_url)
base.auth()

# get current row content (print for debug)
row = context.current_row
print(row);
# row is something like: 
# {'_id': 'TVo_OIoNTCuvhnZkEF7yRw', '_mtime': '2022-09-06T13:54:18.735+00:00', '_ctime': '2022-09-06T13:46:55.109+00:00', 'Name': 'das ist wichtig'}

# webhook
import json
import requests

webhook_url = 'https://your-target.com/'
print("jetzt mache ich den webhook")

response = requests.post(
  webhook_url, data=row,
  headers={'Content-Type', 'application/json'}
)
if response.status_code != 200:
  raise ValueError(
    'Request to webhook returned an error %s, the response is:\n%s'
    % (response.status_code, response.text)
  )

Button column

then you create a button-column and assign this script to the button. Every time you click on the button, the content of this row is sent to the webhook_url. You can get more details about the result of the call with the Skiptlog:

image

Best regards
Christoph

1 Like

Wow, that is amazing. Thank you so much!

I will try it out.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.