Browse Source

docs: webhook updates

pull/6288/head
Raju Udava 1 year ago committed by GitHub
parent
commit
14b3f10c2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 292
      packages/noco-docs/docs/040.developer-resources/040.webhooks.md

292
packages/noco-docs/docs/040.developer-resources/040.webhooks.md

@ -5,27 +5,295 @@ description: "Webhooks allows user to trigger on certain operations on following
## Overview
Some types of notifications can be triggered by a webhook after a particular event.
You can employ webhooks to notify external systems whenever there are additions, updates, or removals of rows within NocoDB. This feature allows you to receive instantaneous notifications for any changes made to your database.
NocoDB also offers webhooks for bulk endpoints for creating, updating, or deleting multiple records simultaneously.
Note that, Webhooks currently are specific for associated table.
- Open `Details` tab in topbar, click on `Webhooks`
- Click `Add New Webhook`
![webhook](https://github.com/nocodb/nocodb/assets/86527202/dfd9e8ff-e175-4a9d-8a95-75e3c2f96873)
### Configure Webhook
- General configurations
- Webhook Name
- Webhook Trigger
- Webhook Type
- Webhook Type specific configuration : additional configuration details depending on webhook type selected
- Webhook Conditional Trigger
- Only records meeting the criteria will trigger webhook
To setup a new Webhook
1. Open `Details` tab in topbar,
2. Click on `Webhooks` tab
3. Click `Add New Webhook`
![webhook](https://github.com/nocodb/nocodb/assets/86527202/07f375af-f2c3-4d7c-9500-976f38b15c12)
Webhook configuration
![webhook config](https://github.com/nocodb/nocodb/assets/86527202/338c8f23-237c-4a00-870d-5221e00a1d34)
1. Name
2. Event
1. After Insert
2. After Update
3. After Delete
4. After Bulk Insert
5. After Bulk Update
6. After Bulk Delete
3. Type
1. URL
2. Email
3. Slack
4. Microsoft Teams
5. Discord
6. Mattermost
7. Twilio
8. Whatsapp Twilio
4. Action
1. GET
2. POST
3. DELETE
4. PUT
5. HEAD
6. PATCH
5. Type specific configuration : additional configuration details depending on webhook type selected
Example: `Link` for type `URL`
6. [Optional] Headers & Parameters :
Configure Request headers & parameters (if any)
7. [Optional] Condition :
Only records meeting the criteria will trigger webhook
8. [Optional] Test :
Test webhook (with sample payload) to verify if parameter are configured appropriately
9. Save
![webhook config](https://github.com/nocodb/nocodb/assets/86527202/3c95ed48-b763-44ad-b73e-2a28e049ec23)
<!-- ![image](https://user-images.githubusercontent.com/35857179/166660248-a3c81a34-4334-48c2-846a-65759d761559.png) -->
### Enable/Disable Webhook
To disable a Webhook
- Open `Webhook` tab to find list of webhooks created
- Toggle `Activate` button to enable/disable
![Screenshot 2023-09-01 at 3 59 28 PM](https://github.com/nocodb/nocodb/assets/86527202/c62cca12-6164-46a8-87e5-179d28c989b6)
### Delete Webhook
To delete a Webhook
- Open `Webhook` tab to find list of webhooks created
- Click on `...` actions button associated with the webhook to be deleted
- Select `Delete`
![Screenshot 2023-09-01 at 4 01 46 PM](https://github.com/nocodb/nocodb/assets/86527202/23a8aec1-ba29-4be4-8143-f3c94198a88c)
### Duplicate Webhook
To duplicate a Webhook
- Open `Webhook` tab to find list of webhooks created
- Click on `...` actions button associated with the webhook to be duplicate
- Select `Duplicate`
![Screenshot 2023-09-01 at 4 01 46 PM](https://github.com/nocodb/nocodb/assets/86527202/23a8aec1-ba29-4be4-8143-f3c94198a88c)
A copy of the webhook will be created (disabled by default) with a suffix ` - Copy`
### Webhook Response Sample
#### Insert
```
{
"type": "records.after.insert",
"id": "9dac1c54-b3be-49a1-a676-af388145fa8c",
"data": {
"table_id": "md_xzru7dcqrecc60",
"table_name": "Film",
"view_id": "vw_736wrpoas7tr0c",
"view_name": "Film",
"rows": [
{
"FilmId": 1011,
"Title": "FOO",
"Language": {
"LanguageId": 1,
"Name": "English"
},
}
]
}
}
```
#### Update
```
{
"type": "records.after.update",
"id": "6a6ebfe4-b0b5-434e-b5d6-5212adbf82fa",
"data": {
"table_id": "md_xzru7dcqrecc60",
"table_name": "Film",
"view_id": "vw_736wrpoas7tr0c",
"view_name": "Film",
"previous_rows": [
{
"FilmId": 1,
"Title": "ACADEMY DINOSAUR",
"Description": "A Epic Drama of a Feminist in The Canadian Rockies",
"Actor List": [
{
"ActorId": 10,
"FirstName": "CHRISTIAN"
}
],
}
],
"rows": [
{
"FilmId": 1,
"Title": "ACADEMY DINOSAUR (Edited)",
"Actor List": [
{
"ActorId": 10,
"FirstName": "CHRISTIAN"
}
],
}
]
}
}
```
#### Delete
```
{
"type": "records.after.delete",
"id": "e593079f-70e5-4965-8944-5ff7aeed005c",
"data": {
"table_id": "md_xzru7dcqrecc60",
"table_name": "Film",
"view_id": "vw_736wrpoas7tr0c",
"view_name": "Film",
"rows": [
{
"FilmId": 1010,
"Title": "ALL-EDITED",
"Language": {
"LanguageId": 1,
"Name": "English"
},
}
]
}
}
```
#### Bulk Insert
```
{
"type": "records.after.bulkInsert",
"id": "f8397b06-a399-4a3a-b6b0-6d1c0c2f7578",
"data": {
"table_id": "md_xzru7dcqrecc60",
"table_name": "Film",
"view_id": "vw_3fq2e9q8drkblw",
"view_name": "GridView",
"rows_inserted": 2
}
}
```
#### Bulk Update
```
{
"type": "records.after.bulkUpdate",
"id": "e983cea5-8e38-438e-96a0-048751f6830b",
"data": {
"table_id": "md_xzru7dcqrecc60",
"table_name": "Film",
"view_id": "vw_3fq2e9q8drkblw",
"view_name": "Sheet-1",
"previous_rows": [
[
{
"FilmId": 1005,
"Title": "Q",
"Language": {
"LanguageId": 1,
"Name": "English"
},
},
{
"FilmId": 1004,
"Title": "P",
"Language": {
"LanguageId": 1,
"Name": "English"
}
}
]
],
"rows": [
[
{
"FilmId": 1005,
"Title": "Q-EDITED",
"Language": {
"LanguageId": 1,
"Name": "English"
}
},
{
"FilmId": 1004,
"Title": "P-EDITED",
"Language": {
"LanguageId": 1,
"Name": "English"
},
}
]
]
}
}
```
#### Bulk Delete
```
{
"type": "records.after.bulkDelete",
"id": "e7f1f4e5-7052-4ca2-9355-241ceb836f43",
"data": {
"table_id": "md_xzru7dcqrecc60",
"table_name": "Film",
"view_id": "vw_3fq2e9q8drkblw",
"view_name": "Sheet-1",
"rows": [
[
{
"FilmId": 1022,
"Title": "x",
"Language": {
"LanguageId": 1,
"Name": "English"
},
},
{
"FilmId": 1023,
"Title": "x",
"Language": {
"LanguageId": 1,
"Name": "English"
},
}
]
]
}
}
```
## Call Log
Call Log allows user to check the call history of the hook. By default, it has been disabled. However, it can be configured by using environment variable `NC_AUTOMATION_LOG_LEVEL`.

Loading…
Cancel
Save