mirror of https://github.com/nocodb/nocodb
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
226 lines
9.8 KiB
226 lines
9.8 KiB
3 years ago
|
---
|
||
3 years ago
|
title: "Webhooks"
|
||
2 years ago
|
description: "Webhooks allows user to trigger on certain operations on following database operations"
|
||
3 years ago
|
---
|
||
|
|
||
3 years ago
|
## Overview
|
||
|
|
||
|
Some types of notifications can be triggered by a webhook after a particular event.
|
||
|
|
||
2 years ago
|
### Open `View menu`, click on `Webhooks`
|
||
|
|
||
1 year ago
|
<img width="442" alt="image" src="https://user-images.githubusercontent.com/35857179/194849113-910ddafa-4b05-4492-a7a6-d9259d892eb9.png" />
|
||
3 years ago
|
|
||
2 years ago
|
### Click `Add New Webhook`
|
||
3 years ago
|
|
||
1 year ago
|
<img width="686" alt="image" src="https://user-images.githubusercontent.com/35857179/194849248-1d0b80c6-f65b-4075-8ebd-af7dc735c2c3.png" />
|
||
2 years ago
|
|
||
|
### Configure Webhook
|
||
2 years ago
|
|
||
2 years ago
|
- 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
|
||
|
|
||
2 years ago
|
<!-- ![Screenshot 2022-09-14 at 10 35 39 AM](https://user-images.githubusercontent.com/86527202/190064668-37245025-81f6-491c-b639-83c8fd131bc3.png) -->
|
||
|
![Screenshot 2023-04-06 at 11 39 49 AM](https://user-images.githubusercontent.com/86527202/230288581-c613e591-1c32-4151-a2d1-df2bbf1367fd.png)
|
||
3 years ago
|
|
||
|
|
||
2 years ago
|
<!-- ![image](https://user-images.githubusercontent.com/35857179/166660248-a3c81a34-4334-48c2-846a-65759d761559.png) -->
|
||
3 years ago
|
|
||
2 years ago
|
## 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`.
|
||
|
|
||
|
- `NC_AUTOMATION_LOG_LEVEL=OFF`: No logs will be displayed and no history will be inserted to meta database.
|
||
|
- `NC_AUTOMATION_LOG_LEVEL=ERROR`: only error logs will be displayed and history of error logs will be inserted to meta database.
|
||
|
- `NC_AUTOMATION_LOG_LEVEL=ALL`: Both error and success logs will be displayed and history of both types of logs will be inserted to meta database. **This option is only available for Enterprise Edition.**
|
||
|
|
||
|
![image](https://user-images.githubusercontent.com/35857179/228790148-1e3f21c7-9385-413a-843f-b93073ca6bea.png)
|
||
|
|
||
3 years ago
|
|
||
3 years ago
|
## Triggers
|
||
3 years ago
|
|
||
3 years ago
|
Webhooks allows user to trigger on certain operations on following database operations
|
||
3 years ago
|
|
||
|
- AFTER INSERT
|
||
|
- AFTER UPDATE
|
||
|
- AFTER DELETE
|
||
3 years ago
|
|
||
3 years ago
|
The triggers will trigger asynchronously without blocking the actual operation.
|
||
3 years ago
|
|
||
3 years ago
|
### Applications/services
|
||
3 years ago
|
|
||
3 years ago
|
| Trigger | Details |
|
||
|
| --------------- | ---------------------------------------------- |
|
||
|
| Email | Send email to certain email addresses |
|
||
|
| Slack | Notify via Slack channel |
|
||
|
| Microsoft Teams | Notify via Microsoft Teams channel |
|
||
|
| Discord | Notify via Discord channel |
|
||
|
| Mattermost | Notify via Mattermost channel |
|
||
|
| Twilio | Send SMS to certain mobile numbers |
|
||
|
| Whatsapp Twilio | Send Whatsapp messages to numbers using Twilio |
|
||
|
| URL | Invoke an HTTP API |
|
||
3 years ago
|
|
||
3 years ago
|
|
||
|
## Accessing Data: Handlebars
|
||
3 years ago
|
|
||
2 years ago
|
|
||
1 year ago
|
:::caution
|
||
|
|
||
|
You can access data using handlebars for v1 webhooks only.
|
||
|
|
||
|
:::
|
||
2 years ago
|
|
||
3 years ago
|
The current row data and other details will be available in the hooks payload so the user can use [handlebar syntax](https://handlebarsjs.com/guide/#simple-expressions) to use data.
|
||
3 years ago
|
|
||
|
> We are using [Handlebars](https://handlebarsjs.com/) library to parse the payload internally.
|
||
|
|
||
3 years ago
|
### Example
|
||
|
|
||
|
For a table with column names (id, title, created_at, updated_at).
|
||
|
For INSERT/ UPDATE based triggers, use following handlebars to access corresponding **data** fields.
|
||
|
|
||
|
- {{ **data**.id }}
|
||
|
- {{ **data**.title }}
|
||
|
- {{ **data**.created_at }}
|
||
|
- {{ **data**.updated_at }}
|
||
|
|
||
|
Note that, for Update trigger - all the fields in the ROW will be accessible, not just the field updated.
|
||
|
For DELETE based triggers, **only** {{ data.id }} is accessible representing ID of the column deleted.
|
||
|
|
||
|
### JSON format
|
||
|
|
||
3 years ago
|
Use {{ json data }} to dump complete data & user information available in JSON format
|
||
3 years ago
|
|
||
|
### Additional references:
|
||
|
|
||
|
[Handlebar Guide](https://handlebarsjs.com/guide/).
|
||
|
|
||
|
# Application Guide
|
||
|
|
||
|
## Discord
|
||
|
|
||
|
### 1. Create WebHook
|
||
|
|
||
|
- On Discord, open your Server Settings and head into the Integrations tab:
|
||
|
- Click the "Create Webhook" button to create a new webhook!
|
||
|
|
||
|
![Screenshot 2022-02-22 at 1 21 59 PM](https://user-images.githubusercontent.com/86527202/155087088-8f9fd762-9ff9-41a6-aed4-0f22add77fe6.png)
|
||
|
|
||
|
- Choose channel to which this webhook will post to.
|
||
|
- Copy webhook URL
|
||
|
|
||
|
![Screenshot 2022-02-22 at 1 23 18 PM](https://user-images.githubusercontent.com/86527202/155087126-c2cdd7b2-518a-46a5-82a5-aa90fe51a709.png)
|
||
|
|
||
|
(Sample webhook URL: https://discord.com/api/webhooks/945558283756908644/GNUtiGuzfOky6wZ4ce30XuXc1sbPK3Od7EC-4t6hihh5Fovv6oU9OsdT6mGuoL1QlTzj).
|
||
|
Detailed procedure for discord webhook described [here](https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks).
|
||
|
|
||
|
### 2. Install Plugin
|
||
|
|
||
|
- Open 'App Store' (under Settings), hover over Discord tile. Click 'Install'.
|
||
2 years ago
|
|
||
|
![Screenshot 2022-09-14 at 10 47 59 AM](https://user-images.githubusercontent.com/86527202/190066333-04bab4eb-f114-48e5-b3f9-6327cadb1ca7.png)
|
||
|
<!-- ![Screenshot 2022-02-22 at 11 30 36 AM](https://user-images.githubusercontent.com/86527202/155085257-5bdde1d9-d7b5-471d-bf44-3c3920e7b853.png) -->
|
||
3 years ago
|
|
||
|
- Provide a name of your choice (not to be confused with Discord Channel name).
|
||
|
- Paste Discord Webhook URL copied from Step (1.) above.
|
||
2 years ago
|
|
||
|
![Screenshot 2022-09-14 at 10 52 14 AM](https://user-images.githubusercontent.com/86527202/190066365-90e3136b-db24-4514-aa89-c1fb371b33ee.png)
|
||
|
<!-- ![Screenshot 2022-02-22 at 11 31 21 AM](https://user-images.githubusercontent.com/86527202/155085287-f5e45aab-fd33-4138-a7a9-6eddc6dc140b.png) -->
|
||
3 years ago
|
|
||
|
### 3. Configure
|
||
|
|
||
3 years ago
|
- Open project and choose a table.
|
||
3 years ago
|
- Click 'More' > 'Webhooks'.
|
||
3 years ago
|
- Click 'Create webhook'
|
||
|
- Configure webhook
|
||
3 years ago
|
- **Title**: Name of your choice to identify this Webhook.
|
||
|
- **Event**: Trigger event. Choose between.
|
||
|
- After Insert: Trigger event for new ROW insertion.
|
||
|
- After Update: Trigger event for existing ROW updation.
|
||
|
- After Delete: Trigger event for ROW deletion
|
||
|
- **On Condition**: [Optional] Enable if you wish to associate additional condition/constraint with the trigger configured above.
|
||
|
- **Notification**: Select 'Discord'.
|
||
|
- **Select Discord Channels**: Select from the drop down list, channel name configured in Step (2). Please click on 'Reload' if drop down list is empty.
|
||
|
- **Body**: Message to be posted over Discord channel, via webhooks on trigger of configured event.
|
||
|
- Body can contain plain text &
|
||
|
- Handlebars {{ }}
|
||
|
|
||
|
|
||
3 years ago
|
## Slack
|
||
2 years ago
|
|
||
3 years ago
|
### 1. Create WebHook
|
||
|
- Details to create slack webhook are captured [here](https://api.slack.com/messaging/webhooks)
|
||
|
|
||
|
### 2. Install Plugin
|
||
|
- Procedure remain same as listed for DISCORD channel configuration above
|
||
|
|
||
|
### 3. Configure Webhook
|
||
|
- Procedure remain same as listed for DISCORD channel configuration above
|
||
|
|
||
|
|
||
3 years ago
|
## Microsoft Teams
|
||
|
### 1. Create WebHook
|
||
|
|
||
|
- On Teams, open your channel, click on three-dots menu (far right) and select 'Connectors'
|
||
|
|
||
1 year ago
|
<img width="319" alt="154971352-6912d53b-cf71-4edd-a319-1c85be85f0c5" src="https://user-images.githubusercontent.com/86527202/155095745-91abd708-834f-4f0e-a33c-ac362e60af0f.png" />
|
||
3 years ago
|
|
||
|
|
||
|
- Select incoming webhook & click 'Configure'
|
||
|
|
||
1 year ago
|
<img width="442" alt="154971434-0ced97f7-205a-4e2e-8f88-17092cb7771a" src="https://user-images.githubusercontent.com/86527202/155095741-b23ad6b2-1276-46e3-8ada-0d0a871115bb.png" />
|
||
3 years ago
|
|
||
|
- Create webhook, Copy webhook URL
|
||
|
|
||
|
![154971683-db16be7f-4f07-4447-8f2e-ac50e133bef8](https://user-images.githubusercontent.com/86527202/155095733-c339a914-5d78-408c-8f1e-9cd75a7783e8.png)
|
||
|
|
||
|
|
||
|
### 2. Install Plugin
|
||
|
|
||
|
- Open 'App Store' (under Settings), hover over 'Microsoft Teams' tile. Click 'Install'.
|
||
2 years ago
|
|
||
|
![Screenshot 2022-09-14 at 10 53 22 AM](https://user-images.githubusercontent.com/86527202/190066409-03311add-3b36-4521-acf7-dba5ffdef3fb.png)
|
||
3 years ago
|
|
||
2 years ago
|
<!-- ![Screenshot 2022-02-22 at 7 32 52 PM](https://user-images.githubusercontent.com/86527202/155148122-60844b42-7d2a-4c0f-9778-a5bc4f9c0107.png) -->
|
||
3 years ago
|
|
||
3 years ago
|
|
||
|
- Provide a name of your choice (not to be confused with Teams Channel name).
|
||
|
- Paste MS Teams Webhook URL copied from Step (1.) above.
|
||
2 years ago
|
|
||
|
![Screenshot 2022-09-14 at 10 53 31 AM](https://user-images.githubusercontent.com/86527202/190066430-838eaa69-ac2c-49ce-a0eb-d84c97964f8b.png)
|
||
3 years ago
|
|
||
1 year ago
|
<!-- <img width="414" alt="154971222-7fe2c25a-d8c6-46b0-ba1e-a05ff1cf6537" src="https://user-images.githubusercontent.com/86527202/155095720-ff1c052c-a4a7-4c10-8f30-d779dac336f3.png" /> -->
|
||
3 years ago
|
|
||
|
### 3. Configure
|
||
|
|
||
3 years ago
|
- Open project and choose a table.
|
||
|
- Click 'More' > 'Webhooks'.
|
||
|
- Click 'Create webhook'
|
||
|
- Configure webhook
|
||
3 years ago
|
- **Title**: Name of your choice to identify this Webhook.
|
||
|
- **Event**: Trigger event. Choose between.
|
||
|
- After Insert: Trigger event for new ROW insertion.
|
||
|
- After Update: Trigger event for existing ROW updation.
|
||
|
- After Delete: Trigger event for ROW deletion
|
||
|
- **On Condition**: [Optional] Enable if you wish to associate additional condition/constraint with the trigger configured above.
|
||
|
- **Notification**: Select 'Microsoft Teams'.
|
||
3 years ago
|
- **Select Teams Channels**: Select from the drop down list, channel name configured in Step (2). Please click on 'Reload' if drop down list is empty.
|
||
3 years ago
|
- **Body**: Message to be posted over Teams channel, via webhooks on trigger of configured event.
|
||
|
- Body can contain plain text &
|
||
|
- Handlebars {{ }}
|
||
2 years ago
|
|
||
|
## Webhook V2
|
||
|
|
||
|
Webhook v2 is available after v0.106.0. Here's the differences.
|
||
|
|
||
|
- Response Payload has been predefined and cannot configure in Body using Handlebars. The payload can be referenced under `Sample Payload` in Hook detail page.
|
||
|
- Support the following bulk operations:
|
||
|
- AFTER BULK INSERT
|
||
|
- AFTER BULK UPDATE
|
||
2 years ago
|
- AFTER BULK DELETE
|