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.
1 lines
12 KiB
1 lines
12 KiB
"use strict";(self.webpackChunknoco_docs=self.webpackChunknoco_docs||[]).push([[3479],{3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>k});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},o=Object.keys(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var d=a.createContext({}),c=function(e){var t=a.useContext(d),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},s=function(e){var t=c(e.components);return a.createElement(d.Provider,{value:t},e.children)},p="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},b=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,d=e.parentName,s=i(e,["components","mdxType","originalType","parentName"]),p=c(n),b=r,k=p["".concat(d,".").concat(b)]||p[b]||m[b]||o;return n?a.createElement(k,l(l({ref:t},s),{},{components:n})):a.createElement(k,l({ref:t},s))}));function k(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,l=new Array(o);l[0]=b;var i={};for(var d in t)hasOwnProperty.call(t,d)&&(i[d]=t[d]);i.originalType=e,i[p]="string"==typeof e?e:r,l[1]=i;for(var c=2;c<o;c++)l[c]=n[c];return a.createElement.apply(null,l)}return a.createElement.apply(null,n)}b.displayName="MDXCreateElement"},14503:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>c});var a=n(87462),r=(n(67294),n(3905));const o={title:"Create webhook",description:"Learn how to create a webhook in NocoDB.",tags:["Webhook","Create"],keywords:["NocoDB webhook","create webhook"]},l=void 0,i={unversionedId:"automation/webhook/create-webhook",id:"automation/webhook/create-webhook",title:"Create webhook",description:"Learn how to create a webhook in NocoDB.",source:"@site/docs/130.automation/020.webhook/020.create-webhook.md",sourceDirName:"130.automation/020.webhook",slug:"/automation/webhook/create-webhook",permalink:"/automation/webhook/create-webhook",draft:!1,editUrl:"https://github.com/nocodb/nocodb/tree/develop/packages/noco-docs/docs/docs/130.automation/020.webhook/020.create-webhook.md",tags:[{label:"Webhook",permalink:"/tags/webhook"},{label:"Create",permalink:"/tags/create"}],version:"current",sidebarPosition:20,frontMatter:{title:"Create webhook",description:"Learn how to create a webhook in NocoDB.",tags:["Webhook","Create"],keywords:["NocoDB webhook","create webhook"]},sidebar:"tutorialSidebar",previous:{title:"Webhook overview",permalink:"/automation/webhook/webhook-overview"},next:{title:"Actions on webhook",permalink:"/automation/webhook/actions-on-webhook"}},d={},c=[{value:"Create Webhook",id:"create-webhook",level:2},{value:"Accessing webhook page",id:"accessing-webhook-page",level:3},{value:"Configuring webhook",id:"configuring-webhook",level:3},{value:"Webhook Response Sample",id:"webhook-response-sample",level:3}],s=e=>function(t){return console.warn("Component "+e+" was not imported, exported, or provided by MDXProvider as global scope"),(0,r.kt)("div",t)},p=s("Tabs"),m=s("TabItem"),b={toc:c},k="wrapper";function u(e){let{components:t,...o}=e;return(0,r.kt)(k,(0,a.Z)({},b,o,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h2",{id:"create-webhook"},"Create Webhook"),(0,r.kt)("h3",{id:"accessing-webhook-page"},"Accessing webhook page"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Click on table for which webhook needs to be configured on the left sidebar"),(0,r.kt)("li",{parentName:"ol"},"Open ",(0,r.kt)("inlineCode",{parentName:"li"},"Details")," tab in topbar,"),(0,r.kt)("li",{parentName:"ol"},"Click on ",(0,r.kt)("inlineCode",{parentName:"li"},"Webhooks")," tab"),(0,r.kt)("li",{parentName:"ol"},"Click ",(0,r.kt)("inlineCode",{parentName:"li"},"Add New Webhook"))),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"Accessing webhook",src:n(89999).Z,width:"2872",height:"1584"})),(0,r.kt)("h3",{id:"configuring-webhook"},"Configuring webhook"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Name of the webhook"),(0,r.kt)("li",{parentName:"ol"},"Select the event for which webhook needs to be triggered")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Trigger"),(0,r.kt)("th",{parentName:"tr",align:null},"Details"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"After Insert"),(0,r.kt)("td",{parentName:"tr",align:null},"After a single record is inserted")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"After Update"),(0,r.kt)("td",{parentName:"tr",align:null},"After a single record is updated")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"After Delete"),(0,r.kt)("td",{parentName:"tr",align:null},"After a single record is deleted")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"After Bulk Insert"),(0,r.kt)("td",{parentName:"tr",align:null},"After bulk records are inserted")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"After Bulk Update"),(0,r.kt)("td",{parentName:"tr",align:null},"After bulk records are updated")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"After Bulk Delete"),(0,r.kt)("td",{parentName:"tr",align:null},"After bulk records are deleted")))),(0,r.kt)("ol",{start:3},(0,r.kt)("li",{parentName:"ol"},"Method & URL: Configure the endpoint to which webhook needs to be triggered. Supported methods are GET, POST, DELETE, PUT, HEAD, PATCH"),(0,r.kt)("li",{parentName:"ol"},"Headers & Parameters: Configure Request headers & parameters (optional)"),(0,r.kt)("li",{parentName:"ol"},"Condition: Only records meeting the configured criteria will trigger webhook (optional)"),(0,r.kt)("li",{parentName:"ol"},"Test webhook (with sample payload) to verify if parameter are configured appropriately (optional)"),(0,r.kt)("li",{parentName:"ol"},"Save the webhook")),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"Configuring webhook",src:n(3896).Z,width:"2872",height:"1790"})),(0,r.kt)("h3",{id:"webhook-response-sample"},"Webhook Response Sample"),(0,r.kt)(p,{mdxType:"Tabs"},(0,r.kt)(m,{value:"After Insert",label:"After Insert",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'{\n "type": "records.after.insert",\n "id": "9dac1c54-b3be-49a1-a676-af388145fa8c",\n "data": {\n "table_id": "md_xzru7dcqrecc60",\n "table_name": "Film",\n "view_id": "vw_736wrpoas7tr0c",\n "view_name": "Film",\n "records": [\n {\n "FilmId": 1011,\n "Title": "FOO",\n "Language": {\n "LanguageId": 1,\n "Name": "English"\n },\n }\n ]\n }\n}\n'))),(0,r.kt)(m,{value:"After Update",label:"After Update",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'{\n "type": "records.after.update",\n "id": "6a6ebfe4-b0b5-434e-b5d6-5212adbf82fa",\n "data": {\n "table_id": "md_xzru7dcqrecc60",\n "table_name": "Film",\n "view_id": "vw_736wrpoas7tr0c",\n "view_name": "Film",\n "previous_records": [\n {\n "FilmId": 1,\n "Title": "ACADEMY DINOSAUR",\n "Description": "A Epic Drama of a Feminist in The Canadian Rockies",\n "Actor List": [\n {\n "ActorId": 10,\n "FirstName": "CHRISTIAN"\n }\n ],\n }\n ],\n "records": [\n {\n "FilmId": 1,\n "Title": "ACADEMY DINOSAUR (Edited)",\n "Actor List": [\n {\n "ActorId": 10,\n "FirstName": "CHRISTIAN"\n }\n ],\n }\n ]\n }\n}\n'))),(0,r.kt)(m,{value:"After Delete",label:"After Delete",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'{\n "type": "records.after.delete",\n "id": "e593079f-70e5-4965-8944-5ff7aeed005c",\n "data": {\n "table_id": "md_xzru7dcqrecc60",\n "table_name": "Film",\n "view_id": "vw_736wrpoas7tr0c",\n "view_name": "Film",\n "records": [\n {\n "FilmId": 1010,\n "Title": "ALL-EDITED",\n "Language": {\n "LanguageId": 1,\n "Name": "English"\n },\n }\n ]\n }\n}\n'))),(0,r.kt)(m,{value:"After Bulk Insert",label:"After Bulk Insert",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'{\n "type": "records.after.bulkInsert",\n "id": "f8397b06-a399-4a3a-b6b0-6d1c0c2f7578",\n "data": {\n "table_id": "md_xzru7dcqrecc60",\n "table_name": "Film",\n "view_id": "vw_3fq2e9q8drkblw",\n "view_name": "GridView",\n "records_inserted": 2\n }\n}\n'))),(0,r.kt)(m,{value:"After Bulk Update",label:"After Bulk Update",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'{\n "type": "records.after.bulkUpdate",\n "id": "e983cea5-8e38-438e-96a0-048751f6830b",\n "data": {\n "table_id": "md_xzru7dcqrecc60",\n "table_name": "Film",\n "view_id": "vw_3fq2e9q8drkblw",\n "view_name": "Sheet-1",\n "previous_records": [\n [\n {\n "FilmId": 1005,\n "Title": "Q",\n "Language": {\n "LanguageId": 1,\n "Name": "English"\n },\n },\n {\n "FilmId": 1004,\n "Title": "P",\n "Language": {\n "LanguageId": 1,\n "Name": "English"\n }\n }\n ]\n ],\n "records": [\n [\n {\n "FilmId": 1005,\n "Title": "Q-EDITED",\n "Language": {\n "LanguageId": 1,\n "Name": "English"\n }\n },\n {\n "FilmId": 1004,\n "Title": "P-EDITED",\n "Language": {\n "LanguageId": 1,\n "Name": "English"\n },\n }\n ]\n ]\n }\n}\n'))),(0,r.kt)(m,{value:"After Bulk Delete",label:"After Bulk Delete",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'{\n "type": "records.after.bulkDelete",\n "id": "e7f1f4e5-7052-4ca2-9355-241ceb836f43",\n "data": {\n "table_id": "md_xzru7dcqrecc60",\n "table_name": "Film",\n "view_id": "vw_3fq2e9q8drkblw",\n "view_name": "Sheet-1",\n "records": [\n [\n {\n "FilmId": 1022,\n "Title": "x",\n "Language": {\n "LanguageId": 1,\n "Name": "English"\n },\n },\n {\n "FilmId": 1023,\n "Title": "x",\n "Language": {\n "LanguageId": 1,\n "Name": "English"\n },\n }\n ]\n ]\n }\n}\n')))))}u.isMDXComponent=!0},89999:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/create-webhook-1-be523f2a91b6829cd8d82915d07e92e4.png"},3896:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/create-webhook-2-ae6af25bd288d16427ddbcd283a32eb2.png"}}]); |