1"use strict";(self.webpackChunkembedded_workflow_builder_docs=self.webpackChunkembedded_workflow_builder_docs||[]).push([["7205"],{69123(e,n,t){t.r(n),t.d(n,{metadata:()=>r,default:()=>a,frontMatter:()=>i,contentTitle:()=>o,toc:()=>l,assets:()=>c});var r=JSON.parse('{"id":"connectors/code","title":"Code Connector","description":"Author and run your own code","source":"@site/docs/connectors/code.md","sourceDirName":"connectors","slug":"/connectors/code","permalink":"/connectors/code","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{"title":"Code Connector","sidebar_label":"Code","description":"Author and run your own code"},"sidebar":"docs","previous":{"title":"ClickUp","permalink":"/connectors/click-up"},"next":{"title":"Collection Tools","permalink":"/connectors/collection-tools"}}'),s=t(74848),d=t(28453);let i={title:"Code Connector",sidebar_label:"Code",description:"Author and run your own code"},o,c={},l=[{value:"Connections",id:"connections",level:2},{value:"API Key",id:"apikey",level:3},{value:"API Key Secret",id:"apikeysecret",level:3},{value:"Basic Username/Password",id:"basic",level:3},{value:"OAuth 2.0 Authorization Code",id:"authorizationcode",level:3},{value:"OAuth 2.0 Client Credentials",id:"clientcredentials",level:3},{value:"Private Key",id:"privatekey",level:3},{value:"Triggers",id:"triggers",level:2},{value:"Code Block Trigger",id:"runcodetrigger",level:3},{value:"Actions",id:"actions",level:2},{value:"Code Block",id:"runcode",level:3}];function h(e){let n={a:"a",br:"br",code:"code",h2:"h2",h3:"h3",img:"img",p:"p",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,d.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.img,{alt:"Code",src:t(39982).A+"#connector-icon",width:"32",height:"32"}),"\nAuthor and run your own code"]}),"\n",(0,s.jsx)(n.h2,{id:"connections",children:"Connections"}),"\n",(0,s.jsx)(n.h3,{id:"apikey",children:"API Key"}),"\n",(0,s.jsx)(n.p,{children:"API Key connection"}),"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",(0,s.jsxs)(n.table,{children:[(0,s.jsx)(n.thead,{children:(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.th,{children:"Input"}),(0,s.jsx)(n.th,{children:"Comments"}),(0,s.jsx)(n.th,{children:"Default"})]})}),(0,s.jsx)(n.tbody,{children:(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:"API Key"}),(0,s.jsx)(n.td,{children:"API Key"}),(0,s.jsx)(n.td,{})]})})]}),"\n",(0,s.jsx)(n.h3,{id:"apikeysecret",children:"API Key Secret"}),"\n",(0,s.jsx)(n.p,{children:"API Key Secret connection"}),"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",(0,s.jsxs)(n.table,{children:[(0,s.jsx)(n.thead,{children:(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.th,{children:"Input"}),(0,s.jsx)(n.th,{children:"Comments"}),(0,s.jsx)(n.th,{children:"Default"})]})}),(0,s.jsxs)(n.tbody,{children:[(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:"API Key"}),(0,s.jsx)(n.td,{children:"API Key"}),(0,s.jsx)(n.td,{})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:"API Secret"}),(0,s.jsx)(n.td,{children:"API Secret"}),(0,s.jsx)(n.td,{})]})]})]}),"\n",(0,s.jsx)(n.h3,{id:"basic",children:"Basic Username/Password"}),"\n",(0,s.jsx)(n.p,{children:"Basic Username and Password connection"}),"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",(0,s.jsxs)(n.table,{children:[(0,s.jsx)(n.thead,{children:(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.th,{children:"Input"}),(0,s.jsx)(n.th,{children:"Comments"}),(0,s.jsx)(n.th,{children:"Default"})]})}),(0,s.jsxs)(n.tbody,{children:[(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:"Username"}),(0,s.jsx)(n.td,{children:"Username"}),(0,s.jsx)(n.td,{})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:"Password"}),(0,s.jsx)(n.td,{children:"Password"}),(0,s.jsx)(n.td,{})]})]})]}),"\n",(0,s.jsx)(n.h3,{id:"authorizationcode",children:"OAuth 2.0 Authorization Code"}),"\n",(0,s.jsx)(n.p,{children:"OAuth 2.0 Authorization Code flow"}),"\n",(0,s.jsxs)(n.p,{children:["This connection uses OAuth 2.0, a common authentication mechanism for integrations.\nRead about how OAuth 2.0 works ",(0,s.jsx)(n.a,{href:"/oauth2",children:"here"}),"."]}),"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",(0,s.jsxs)(n.table,{children:[(0,s.jsx)(n.thead,{children:(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.th,{children:"Input"}),(0,s.jsx)(n.th,{children:"Comments"}),(0,s.jsx)(n.th,{children:"Default"})]})}),(0,s.jsxs)(n.tbody,{children:[(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:"Authorize URL"}),(0,s.jsx)(n.td,{children:"The OAuth 2.0 Authorization URL for the API"}),(0,s.jsx)(n.td,{})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:"Token URL"}),(0,s.jsx)(n.td,{children:"The OAuth 2.0 Token URL for the API"}),(0,s.jsx)(n.td,{})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:"Scopes"}),(0,s.jsx)(n.td,{children:"Space separated OAuth 2.0 permission scopes for the API"}),(0,s.jsx)(n.td,{})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:"Client ID"}),(0,s.jsx)(n.td,{children:"Client Identifier of your app for the API"}),(0,s.jsx)(n.td,{})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:"Client Secret"}),(0,s.jsx)(n.td,{children:"Client Secret of your app for the API"}),(0,s.jsx)(n.td,{})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:"Headers"}),(0,s.jsx)(n.td,{children:"Additional header to supply to authorization requests"}),(0,s.jsx)(n.td,{})]})]})]}),"\n",(0,s.jsx)(n.h3,{id:"clientcredentials",children:"OAuth 2.0 Client Credentials"}),"\n",(0,s.jsx)(n.p,{children:"OAuth 2.0 Client Credentials flow"}),"\n",(0,s.jsxs)(n.p,{children:["This connection uses OAuth 2.0, a common authentication mechanism for integrations.\nRead about how OAuth 2.0 works ",(0,s.jsx)(n.a,{href:"/oauth2",children:"here"}),"."]}),"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",(0,s.jsxs)(n.table,{children:[(0,s.jsx)(n.thead,{children:(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.th,{children:"Input"}),(0,s.jsx)(n.th,{children:"Comments"}),(0,s.jsx)(n.th,{children:"Default"})]})}),(0,s.jsxs)(n.tbody,{children:[(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:"Token URL"}),(0,s.jsx)(n.td,{children:"The OAuth 2.0 Token URL for the API"}),(0,s.jsx)(n.td,{})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:"Scopes"}),(0,s.jsx)(n.td,{children:"Space separated OAuth 2.0 permission scopes for the API"}),(0,s.jsx)(n.td,{})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:"Client ID"}),(0,s.jsx)(n.td,{children:"Client Identifier of your app for the API"}),(0,s.jsx)(n.td,{})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:"Client Secret"}),(0,s.jsx)(n.td,{children:"Client Secret of your app for the API"}),(0,s.jsx)(n.td,{})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:"Headers"}),(0,s.jsx)(n.td,{children:"Additional header to supply to token requests"}),(0,s.jsx)(n.td,{})]})]})]}),"\n",(0,s.jsx)(n.h3,{id:"privatekey",children:"Private Key"}),"\n",(0,s.jsx)(n.p,{children:"Private key connection"}),"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",(0,s.jsxs)(n.table,{children:[(0,s.jsx)(n.thead,{children:(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.th,{children:"Input"}),(0,s.jsx)(n.th,{children:"Comments"}),(0,s.jsx)(n.th,{children:"Default"})]})}),(0,s.jsxs)(n.tbody,{children:[(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:"Username"}),(0,s.jsx)(n.td,{children:"Username"}),(0,s.jsx)(n.td,{})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:"Private Key"}),(0,s.jsx)(n.td,{children:"Private Key"}),(0,s.jsx)(n.td,{})]})]})]}),"\n",(0,s.jsx)(n.h2,{id:"triggers",children:"Triggers"}),"\n",(0,s.jsx)(n.h3,{id:"runcodetrigger",children:"Code Block Trigger"}),"\n",(0,s.jsx)(n.p,{children:"Author and run your own code as a trigger"}),"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",(0,s.jsxs)(n.table,{children:[(0,s.jsx)(n.thead,{children:(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.th,{children:"Input"}),(0,s.jsx)(n.th,{children:"Comments"}),(0,s.jsx)(n.th,{children:"Default"})]})}),(0,s.jsx)(n.tbody,{children:(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:"Code"}),(0,s.jsx)(n.td,{children:"The code to be executed"}),(0,s.jsxs)(n.td,{children:["/*",(0,s.jsx)(n.br,{})," Access config variables by name through the configVars object. e.g.",(0,s.jsx)(n.br,{})," const apiEndpoint = ",(0,s.jsx)(n.code,{children:'${configVars["App Base URL"]}/api'}),";",(0,s.jsx)(n.br,{}),(0,s.jsx)(n.br,{})," Access the trigger payload using the payload argument. This includes",(0,s.jsx)(n.br,{})," headers, the body of the request, and more information about the request.",(0,s.jsx)(n.br,{}),(0,s.jsx)(n.br,{})," You can return string, number or complex object data. e.g.",(0,s.jsx)(n.br,{}),' return { payload: { foo: "Hello", bar: 123.45, baz: true } };',(0,s.jsx)(n.br,{}),(0,s.jsx)(n.br,{})," You are also able to return an optional response to the webhook caller.",(0,s.jsx)(n.br,{})," For example, you can respond with a CSV response like the following:",(0,s.jsx)(n.br,{})," return {",(0,s.jsx)(n.br,{}),' payload: { foo: "Hello", bar: 123.45, baz: true },',(0,s.jsx)(n.br,{}),' response: { statusCode: 200, contentType: "text/csv", body: "hello,world" },',(0,s.jsx)(n.br,{})," }",(0,s.jsx)(n.br,{}),"*/",(0,s.jsx)(n.br,{}),(0,s.jsx)(n.br,{}),"module.exports = async ({ logger, configVars }, payload) => {",(0,s.jsx)(n.br,{})," const response = {",(0,s.jsx)(n.br,{})," statusCode: 200,",(0,s.jsx)(n.br,{}),' contentType: "text/plain",',(0,s.jsx)(n.br,{}),' body: "hello",',(0,s.jsx)(n.br,{})," };",(0,s.jsx)(n.br,{})," return { payload, response };",(0,s.jsx)(n.br,{}),"};"]})]})})]}),"\n",(0,s.jsx)(n.h2,{id:"actions",children:"Actions"}),"\n",(0,s.jsx)(n.h3,{id:"runcode",children:"Code Block"}),"\n",(0,s.jsx)(n.p,{children:"Author and run your own code"}),"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",(0,s.jsxs)(n.table,{children:[(0,s.jsx)(n.thead,{children:(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.th,{children:"Input"}),(0,s.jsx)(n.th,{children:"Comments"}),(0,s.jsx)(n.th,{children:"Default"})]})}),(0,s.jsx)(n.tbody,{children:(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:"Code"}),(0,s.jsx)(n.td,{children:"The code to be executed"}),(0,s.jsxs)(n.td,{children:["/*",(0,s.jsx)(n.br,{})," Access config variables by name through the configVars object. e.g.",(0,s.jsx)(n.br,{})," const apiEndpoint = ",(0,s.jsx)(n.code,{children:'${configVars["App Base URL"]}/api'}),";",(0,s.jsx)(n.br,{}),(0,s.jsx)(n.br,{})," Access previous steps' results through the stepResults object. Trigger",(0,s.jsx)(n.br,{}),' and step names are camelCased. If the step "Get Data from API" returned',(0,s.jsx)(n.br,{}),' {"foo": "bar", "baz": 123}, you could destructure that data with:',(0,s.jsx)(n.br,{})," const { foo, baz } = stepResults.getDataFromApi.results;",(0,s.jsx)(n.br,{}),(0,s.jsx)(n.br,{})," You can return string, number or complex object data. e.g.",(0,s.jsx)(n.br,{}),' return { data: { foo: "Hello", bar: 123.45, baz: true } };',(0,s.jsx)(n.br,{}),"*/",(0,s.jsx)(n.br,{}),(0,s.jsx)(n.br,{}),"module.exports = async ({ logger, configVars }, stepResults) => {",(0,s.jsx)(n.br,{})," return { data: null };",(0,s.jsx)(n.br,{}),"};",(0,s.jsx)(n.br,{})]})]})})]})]})}function a(e={}){let{wrapper:n}={...(0,d.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(h,{...e})}):h(e)}},39982(e,n,t){t.d(n,{A:()=>r});let r="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAABcRAAAXEQHKJvM/AAAEDElEQVRYhb1X3W4UNxSekKtSQQrs39ie8Tme2VRQCQm4BankHaBSfx6iSOkDtFULJdntBi5KsgHx8yK0AqmQl2ig7UULUhEqF0nW1fHYg3d3vNmINEfyzuz4+PuOz7GPj6MoLDNRFM3aZ9TK87pQ6lOBeIuDeiIA/+KAW9SKd/WE+gTiZ02lGh5OibEXOWRb1JLyJJP4Ewf4O1GZTlQ2EKg0Bxxq9I36SIcBvKAxNHYUbwq5RBZHcRwfZil8xwD/JVBLtGNnTc+BZ8BgpI+M0TSWMOL43OEC2nhjoszSj8iynEn4lUCEAYTtEcLd2oDG0FhjiISnXKm2zxEkZzI/IwCf2Vlv7ZG4whDcs
1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>i,x:()=>o});var r=t(96540);let s={},d=r.createContext(s);function i(e){let n=r.useContext(d);return r.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:i(e.components),r.createElement(d.Provider,{value:n},e.children)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.