"use strict";(self.webpackChunknewoaks_help=self.webpackChunknewoaks_help||[]).push([[9172],{4901:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>r,contentTitle:()=>c,default:()=>h,frontMatter:()=>i,metadata:()=>n,toc:()=>l});const n=JSON.parse('{"id":"google-sheet","title":"Google Sheets","description":"Apply Changes Immediately in Google Sheets","source":"@site/Integration/020.google-sheet.md","sourceDirName":".","slug":"/google-sheet","permalink":"/guides/integration/google-sheet","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":20,"frontMatter":{"sidebar_position":20},"sidebar":"sidebar","previous":{"title":"Native Stripe integration","permalink":"/guides/integration/stripe-integration"}}');var a=s(4848),o=s(8453);s(9357);const i={sidebar_position:20},c="Google Sheets",r={},l=[{value:"Apply Changes Immediately in Google Sheets",id:"apply-changes-immediately-in-google-sheets",level:2},{value:"Click "Apps Script"",id:"click-apps-script",level:3},{value:"Set CallNewOaks Function",id:"set-callnewoaks-function",level:3},{value:"Save Project",id:"save-project",level:3},{value:"Add triggers",id:"add-triggers",level:3},{value:"Verify data synchronization",id:"verify-data-synchronization",level:3}];function p(e){const t={code:"code",h1:"h1",h2:"h2",h3:"h3",header:"header",img:"img",li:"li",p:"p",pre:"pre",ul:"ul",...(0,o.R)(),...e.components};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(t.header,{children:(0,a.jsx)(t.h1,{id:"google-sheets",children:"Google Sheets"})}),"\n",(0,a.jsx)(t.h2,{id:"apply-changes-immediately-in-google-sheets",children:"Apply Changes Immediately in Google Sheets"}),"\n",(0,a.jsx)(t.h3,{id:"click-apps-script",children:'Click "Apps Script"'}),"\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.img,{src:"https://cdn.newoaks.ai/newoaks/release/static/googlesheets_step1-0a632ca9.png",alt:""}),'- Rename Project - Click "Untitled product"\n',(0,a.jsx)(t.img,{src:"https://cdn.newoaks.ai/newoaks/release/static/googlesheets_step2-eb629f7e.png",alt:""}),(0,a.jsx)(t.img,{src:"https://cdn.newoaks.ai/newoaks/release/static/googlesheets_step2_2-6a2c0f09.png",alt:""})]}),"\n",(0,a.jsx)(t.h3,{id:"set-callnewoaks-function",children:"Set CallNewOaks Function"}),"\n",(0,a.jsx)(t.p,{children:'Replace the serial number value with your chatbot ID within the "callNewOaks" function and copy the function to replace the default function under "Code.gs" section'}),"\n",(0,a.jsx)(t.p,{children:(0,a.jsx)(t.img,{src:"https://cdn.newoaks.ai/newoaks/release/static/googlesheets_step3-c717fad7.png",alt:""})}),"\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.code,{children:"'serialNumber': '<YOUR_SERIAL_NUMBER>'"}),' The value of this "serialNumber" is located in Chatbot -> Settings -> General -> Chatbot ID.']}),"\n",(0,a.jsx)(t.pre,{children:(0,a.jsx)(t.code,{className:"language-JavaScript",children:"// Replace <YOUR_SERIAL_NUMBER> with your chatbot ID.\nfunction callNewOaks(e) {\n var url = SpreadsheetApp.getActiveSpreadsheet().getUrl();\n var options = {\n method: 'post',\n contentType: 'application/x-www-form-urlencoded',\n payload: {\n googleSheetUrl: url,\n serialNumber: '<YOUR_SERIAL_NUMBER>'\n }\n };\n var response = UrlFetchApp.fetch(\n 'https://usapi.hottask.com/chat/chatbot/googlesheetedithook',\n options\n );\n if (response.getResponseCode() == 200) {\n var content_text = response.getContentText();\n if (JSON.parse(content_text).Succescc == false)\n throw new Error('http response not succescc');\n } else throw new Error('http response code ' + response.getResponseCode());\n}\n"})}),"\n",(0,a.jsx)(t.h3,{id:"save-project",children:"Save Project"}),"\n",(0,a.jsxs)(t.p,{children:[(0,a.jsx)(t.img,{src:"https://cdn.newoaks.ai/newoaks/release/static/googlesheets_step3_2-3e87470d.png",alt:""}),"- Run the selected function\n",(0,a.jsx)(t.img,{src:"https://cdn.newoaks.ai/newoaks/release/static/googlesheets_step3_3-9aa481d8.png",alt:""}),'- Click "Review permissions"\n',(0,a.jsx)(t.img,{src:"https://cdn.newoaks.ai/newoaks/release/static/googlesheets_step3_4-c000e66c.png",alt:""}),"- Choose an account\n",(0,a.jsx)(t.img,{src:"https://cdn.newoaks.ai/newoaks/release/static/googlesheets_step3_5-b5387513.png",alt:""}),'- Click "Go to NewOaks AI(unsafe)"\n',(0,a.jsx)(t.img,{src:"https://cdn.newoaks.ai/newoaks/release/static/googlesheets_step3_6-cee14a61.png",alt:""}),'- Click "Allow"\n',(0,a.jsx)(t.img,{src:"https://cdn.newoaks.ai/newoaks/release/static/googlesheets_step3_7-0e8fe0c5.png",alt:""})]}),"\n",(0,a.jsx)(t.h3,{id:"add-triggers",children:"Add triggers"}),"\n",(0,a.jsxs)(t.ul,{children:["\n",(0,a.jsxs)(t.li,{children:['click "Triggers"\n',(0,a.jsx)(t.img,{src:"https://cdn.newoaks.ai/newoaks/release/static/googlesheets_step4-07abca0e.png",alt:""}),"- create a new trigger\n",(0,a.jsx)(t.img,{src:"https://cdn.newoaks.ai/newoaks/release/static/googlesheets_step4_2-306b1c44.png",alt:""}),"- Add Trigger for NewOaks AI\n",(0,a.jsx)(t.img,{src:"https://cdn.newoaks.ai/newoaks/release/static/googlesheets_step4_3-0fb4e8c3.png",alt:""}),"- Choose an account\n",(0,a.jsx)(t.img,{src:"https://cdn.newoaks.ai/newoaks/release/static/googlesheets_step4_4-6f7edfc3.png",alt:""}),(0,a.jsx)(t.img,{src:"https://cdn.newoaks.ai/newoaks/release/static/googlesheets_step4_5-9b147bb0.png",alt:""}),(0,a.jsx)(t.img,{src:"https://cdn.newoaks.ai/newoaks/release/static/googlesheets_step4_6-371ee89c.png",alt:""}),(0,a.jsx)(t.img,{src:"https://cdn.newoaks.ai/newoaks/release/static/googlesheets_step4_7-14774bb3.png",alt:""})]}),"\n"]}),"\n",(0,a.jsx)(t.h3,{id:"verify-data-synchronization",children:"Verify data synchronization"}),"\n",(0,a.jsx)(t.p,{children:"You can modify the content of the Google Sheet and check whether the chatbot data is effective after 15 minutes."})]})}function h(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,a.jsx)(t,{...e,children:(0,a.jsx)(p,{...e})}):p(e)}},9357:(e,t,s)=>{s.d(t,{A:()=>i});s(6540);var n=s(5872),a=s(5363),o=s(4848);function i(e){let{children:t}=e;return(0,o.jsx)(a.A,{children:()=>{const e=(0,n.K)()();if("function"==typeof t){const s=t(e);return(0,o.jsx)("div",{className:"markdown markdown--section",children:s})}return(0,o.jsx)("code",{children:e})}})}},5872:(e,t,s)=>{function n(){return function(){return"undefined"==typeof window?"":window.location.hostname}}s.d(t,{K:()=>n})},8453:(e,t,s)=>{s.d(t,{R:()=>i,x:()=>c});var n=s(6540);const a={},o=n.createContext(a);function i(e){const t=n.useContext(o);return n.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:i(e.components),n.createElement(o.Provider,{value:t},e.children)}}}]);