Webhooks http extension » Historie » Version 1
[X] Philipp Wolak, 05.12.2023 10:45
| 1 | 1 | [X] Philipp Wolak | h1. Webhooks |
|---|---|---|---|
| 2 | |||
| 3 | *technische Voraussetzung:* |
||
| 4 | |||
| 5 | # Installation PostgreSQL HTTP Client https://github.com/pramsey/pgsql-http |
||
| 6 | #* Version für Windows x64 und PG13: !pg13http_w64.zip! |
||
| 7 | #* Weitere Versionen: http://www.postgresonline.com/journal/archives/371-http-extension.html |
||
| 8 | # Datenbank-Update ausführen |
||
| 9 | #* liegen auf prodat-demo-20.11 zu Projekt 20417: https://ci.prodat-sql.de/sources/dbupdates/edit/?server=demo2011&q=20417 |
||
| 10 | |||
| 11 | *Konfiguration* |
||
| 12 | |||
| 13 | * Webhooks werden werden über das tabellarische Modul Webhooks konfiguriert |
||
| 14 | {{collapse(Hauptmenü) |
||
| 15 | !clipboard-202312051021-nzwgt.png! |
||
| 16 | }} |
||
| 17 | * Jeder Eintrag führt zur Anlage eines Datenbank-Triggers der bei Ausführung einen HTTP-Request an die konfigurierte URL schickt. |
||
| 18 | * *Beispielkonfigurationen:* |
||
| 19 | |_. wh_name |_. wh_schema |_. wh_table |_. wh_timing |_. wh_event |_. wh_url |_. wh_data |_. wh_data_type | |
||
| 20 | | slack_webhook_eingrech | public | eingrechdokument | AFTER | INSERT | https://hooks.slack.com/triggers/...... | <notextile>'{"Rechnungsnummer": "' || ($1).beld_dokunr || '"}'</notextile> | application/json | |
||
| 21 | | slack_webhook_bdepab | public | bdepab | AFTER | INSERT | https://hooks.slack.com/triggers/....... | <notextile>'{ |
||
| 22 | "mitarbeiter": "' || (SELECT nameAufloesen(ll_db_usename) FROM llv WHERE ($1).bdab_minr = ll_minr) || '", |
||
| 23 | "bdab_id"": "' || ($1).bdab_id || '", |
||
| 24 | "bdab_anf"": "' || ($1).bdab_anf || '", |
||
| 25 | "bdab_end"": "' || ($1).bdab_end || '", |
||
| 26 | "abw_grund"": "' || (SELECT ab_txt FROM bdeabgruende WHERE ($1).bdab_aus_id = ab_id) || '" |
||
| 27 | }'</notextile> | application/json | |
||
| 28 | | teams_webhook_eingrech | public | eingrechdokument | AFTER | INSERT | https://.....webhook.office.com/webhookb2/........ | <notextile>'{ |
||
| 29 | "type"":"message", |
||
| 30 | "attachments":[ |
||
| 31 | { |
||
| 32 | "contentType":"application/vnd.microsoft.card.adaptive", |
||
| 33 | "contentUrl":null, |
||
| 34 | "content":{ |
||
| 35 | "$schema":"http://adaptivecards.io/schemas/adaptive-card.json", |
||
| 36 | "type"":"AdaptiveCard", |
||
| 37 | "version":"1.2", |
||
| 38 | "body":[ |
||
| 39 | { |
||
| 40 | "type": "TextBlock", |
||
| 41 | "text": "neue Eingangsrechnung: ' || ($1).beld_dokunr || '" |
||
| 42 | } |
||
| 43 | ] |
||
| 44 | } |
||
| 45 | } |
||
| 46 | ] |
||
| 47 | }'</notextile> | application/json | |