Skip to content

[pull] main from baptisteArno:main #290

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion apps/builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@
"emojilib": "3.0.10",
"framer-motion": "11.1.7",
"google-auth-library": "10.1.0",
"google-spreadsheet": "4.1.4",
"immer": "10.0.2",
"ioredis": "5.4.1",
"jsonwebtoken": "9.0.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { isReadWorkspaceFobidden } from "@/features/workspace/helpers/isReadWorkspaceFobidden";
import { authenticatedProcedure } from "@/helpers/server/trpc";
import { TRPCError } from "@trpc/server";
import { getAuthenticatedGoogleClient } from "@typebot.io/credentials/getAuthenticatedGoogleClient";
import { getGoogleSpreadsheet } from "@typebot.io/credentials/getGoogleSpreadsheet";
import prisma from "@typebot.io/prisma";
import { z } from "@typebot.io/zod";
import { GoogleSpreadsheet } from "google-spreadsheet";

export const getSpreadsheetName = authenticatedProcedure
.input(
Expand Down Expand Up @@ -51,22 +50,19 @@ export const getSpreadsheetName = authenticatedProcedure
message: "Credentials not found",
});

const client = await getAuthenticatedGoogleClient(
credentials.id,
workspaceId,
);

if (!client?.credentials.access_token)
throw new TRPCError({
code: "NOT_FOUND",
message: "Google client could not be initialized",
});

try {
const googleSheet = new GoogleSpreadsheet(spreadsheetId, {
token: client.credentials.access_token,
const googleSheet = await getGoogleSpreadsheet({
credentialsId: credentials.id,
spreadsheetId,
workspaceId,
});

if (!googleSheet)
throw new TRPCError({
code: "NOT_FOUND",
message: "Google sheet not found",
});

await googleSheet.loadInfo();

return { name: googleSheet.title };
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { getAuthenticatedUser } from "@/features/auth/helpers/getAuthenticatedUser";
import { getAuthenticatedGoogleClient } from "@typebot.io/credentials/getAuthenticatedGoogleClient";
import { getGoogleSpreadsheet } from "@typebot.io/credentials/getGoogleSpreadsheet";
import {
badRequest,
methodNotAllowed,
notAuthenticated,
} from "@typebot.io/lib/api/utils";
import { isDefined } from "@typebot.io/lib/utils";
import { GoogleSpreadsheet } from "google-spreadsheet";
import type { NextApiRequest, NextApiResponse } from "next";

const handler = async (req: NextApiRequest, res: NextApiResponse) => {
Expand All @@ -18,17 +17,16 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
const workspaceId = req.query.workspaceId as string | undefined;
if (!credentialsId || workspaceId) return badRequest(res);
const spreadsheetId = req.query.id as string;
const client = await getAuthenticatedGoogleClient(
const doc = await getGoogleSpreadsheet({
credentialsId,
spreadsheetId,
workspaceId,
);
if (!client?.credentials.access_token)
});
if (!doc)
return res
.status(404)
.send({ message: "Couldn't find credentials in database" });
const doc = new GoogleSpreadsheet(spreadsheetId, {
token: client.credentials.access_token,
});

try {
await doc.loadInfo();
return res.send({
Expand All @@ -53,6 +51,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
).filter(isDefined),
});
} catch (err) {
console.log(err);
return res.status(404).send({
message:
"Couldn't find sheet, you maybe don't have permission to read it",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ import type {
GoogleSheetsInsertRowOptions,
GoogleSheetsUpdateRowOptions,
} from "@typebot.io/blocks-integrations/googleSheets/schema";
import { getAuthenticatedGoogleDoc } from "@typebot.io/bot-engine/blocks/integrations/googleSheets/helpers/getAuthenticatedGoogleDoc";
import { saveErrorLog } from "@typebot.io/bot-engine/logs/saveErrorLog";
import { saveSuccessLog } from "@typebot.io/bot-engine/logs/saveSuccessLog";
import { LogicalOperator } from "@typebot.io/conditions/constants";
import { ComparisonOperators } from "@typebot.io/conditions/constants";
import { getAuthenticatedGoogleClient } from "@typebot.io/credentials/getAuthenticatedGoogleClient";
import { getGoogleSpreadsheet } from "@typebot.io/credentials/getGoogleSpreadsheet";
import {
badRequest,
initMiddleware,
Expand All @@ -18,10 +17,7 @@ import {
} from "@typebot.io/lib/api/utils";
import { hasValue, isDefined } from "@typebot.io/lib/utils";
import Cors from "cors";
import {
GoogleSpreadsheet,
type GoogleSpreadsheetRow,
} from "google-spreadsheet";
import type { GoogleSpreadsheetRow } from "google-spreadsheet";
import type { NextApiRequest, NextApiResponse } from "next";

const cors = initMiddleware(Cors());
Expand Down Expand Up @@ -67,11 +63,15 @@ const getRows = async (req: NextApiRequest, res: NextApiResponse) => {
return;
}

const doc = await getAuthenticatedGoogleDoc({
const doc = await getGoogleSpreadsheet({
credentialsId,
spreadsheetId,
workspaceId: "",
workspaceId: undefined,
});
if (!doc) {
notFound(res);
return;
}
await doc.loadInfo();
const sheet = doc.sheetsById[Number(sheetId)];
try {
Expand Down Expand Up @@ -123,11 +123,15 @@ const insertRow = async (req: NextApiRequest, res: NextApiResponse) => {
values: { [key: string]: string };
};
if (!hasValue(credentialsId)) return badRequest(res);
const doc = await getAuthenticatedGoogleDoc({
const doc = await getGoogleSpreadsheet({
credentialsId,
spreadsheetId,
workspaceId: "",
workspaceId: undefined,
});
if (!doc) {
notFound(res);
return;
}
try {
await doc.loadInfo();
const sheet = doc.sheetsById[Number(sheetId)];
Expand Down Expand Up @@ -156,11 +160,15 @@ const updateRow = async (req: NextApiRequest, res: NextApiResponse) => {
const { resultId, credentialsId, values } = body;

if (!hasValue(credentialsId) || !referenceCell) return badRequest(res);
const doc = await getAuthenticatedGoogleDoc({
const doc = await getGoogleSpreadsheet({
credentialsId,
spreadsheetId,
workspaceId: "",
workspaceId: undefined,
});
if (!doc) {
notFound(res);
return;
}
try {
await doc.loadInfo();
const sheet = doc.sheetsById[Number(sheetId)];
Expand Down
25 changes: 19 additions & 6 deletions bun.lock
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@
"emojilib": "3.0.10",
"framer-motion": "11.1.7",
"google-auth-library": "10.1.0",
"google-spreadsheet": "4.1.4",
"immer": "10.0.2",
"ioredis": "5.4.1",
"jsonwebtoken": "9.0.1",
Expand Down Expand Up @@ -509,7 +508,7 @@
"@typebot.io/lib": "workspace:*",
"@typebot.io/prisma": "workspace:*",
"@typebot.io/zod": "workspace:*",
"google-auth-library": "10.1.0",
"google-spreadsheet": "4.1.4",
"ky": "1.2.4",
"qs": "6.11.2",
},
Expand Down Expand Up @@ -5467,7 +5466,7 @@

"sade": ["[email protected]", "", { "dependencies": { "mri": "^1.1.0" } }, "sha512-xal3CZX1Xlo/k4ApwCFrHVACi9fBqJ7V+mwhBsuf/1IOKbBy098Fex+Wa/5QMubw09pSZ/u8EY8PWgevJsXp1A=="],

"safe-buffer": ["safe-buffer@5.2.1", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="],
"safe-buffer": ["safe-buffer@5.1.2", "", {}, "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="],

"safe-regex-test": ["[email protected]", "", { "dependencies": { "call-bound": "^1.0.2", "es-errors": "^1.3.0", "is-regex": "^1.2.1" } }, "sha512-x/+Cz4YrimQxQccJf5mKEbIa1NzeCRNI5Ecl/ekmlYaampdNLPalVyIcCZNNH3MvmqBugV5TMYZXv0ljslUlaw=="],

Expand Down Expand Up @@ -6791,8 +6790,6 @@

"babel-plugin-macros/cosmiconfig": ["[email protected]", "", { "dependencies": { "@types/parse-json": "^4.0.0", "import-fresh": "^3.2.1", "parse-json": "^5.0.0", "path-type": "^4.0.0", "yaml": "^1.10.0" } }, "sha512-AdmX6xUzdNASswsFtmwSt7Vj8po9IuqXm0UXz7QKPuEUmPB4XyjGfaAr2PSuELMwkRMVH1EpIkX5bTZGRB3eCA=="],

"basic-auth/safe-buffer": ["[email protected]", "", {}, "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="],

"bl/buffer": ["[email protected]", "", { "dependencies": { "base64-js": "^1.3.1", "ieee754": "^1.1.13" } }, "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ=="],

"body-parser/bytes": ["[email protected]", "", {}, "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg=="],
Expand Down Expand Up @@ -6841,6 +6838,8 @@

"compress-commons/readable-stream": ["[email protected]", "", { "dependencies": { "abort-controller": "^3.0.0", "buffer": "^6.0.3", "events": "^3.3.0", "process": "^0.11.10", "string_decoder": "^1.3.0" } }, "sha512-oIGGmcpTLwPga8Bn6/Z75SVaH1z5dUut2ibSyAMVhmUggWpmDn2dapB0n7f8nwaSiRtepAsfJyfXIO5DCVAODg=="],

"content-disposition/safe-buffer": ["[email protected]", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="],

"crc32-stream/readable-stream": ["[email protected]", "", { "dependencies": { "abort-controller": "^3.0.0", "buffer": "^6.0.3", "events": "^3.3.0", "process": "^0.11.10", "string_decoder": "^1.3.0" } }, "sha512-oIGGmcpTLwPga8Bn6/Z75SVaH1z5dUut2ibSyAMVhmUggWpmDn2dapB0n7f8nwaSiRtepAsfJyfXIO5DCVAODg=="],

"create-emotion/@emotion/cache": ["@emotion/[email protected]", "", { "dependencies": { "@emotion/sheet": "0.9.4", "@emotion/stylis": "0.8.5", "@emotion/utils": "0.11.3", "@emotion/weak-memoize": "0.2.5" } }, "sha512-fU2VtSVlHiF27empSbxi1O2JFdNWZO+2NFHfwO0pxgTep6Xa3uGb+3pVKfLww2l/IBGLNEZl5Xf/++A4wAYDYQ=="],
Expand All @@ -6863,6 +6862,8 @@

"dot-prop/type-fest": ["[email protected]", "", {}, "sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA=="],

"ecdsa-sig-formatter/safe-buffer": ["[email protected]", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="],

"editorconfig/commander": ["[email protected]", "", {}, "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug=="],

"editorconfig/minimatch": ["[email protected]", "", { "dependencies": { "brace-expansion": "^2.0.1" } }, "sha512-0jWhJpD/MdhPXwPuiRkCbfYfSKp2qnn2eOc279qI7f+osl/l+prKSrvhg157zSYvx/1nmgn2NqdT6k2Z7zSH9w=="],
Expand Down Expand Up @@ -6905,6 +6906,8 @@

"express/qs": ["[email protected]", "", { "dependencies": { "side-channel": "^1.0.6" } }, "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg=="],

"express/safe-buffer": ["[email protected]", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="],

"express/setprototypeof": ["[email protected]", "", {}, "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="],

"express/statuses": ["[email protected]", "", {}, "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ=="],
Expand Down Expand Up @@ -7107,6 +7110,10 @@

"juice/commander": ["[email protected]", "", {}, "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA=="],

"jwa/safe-buffer": ["[email protected]", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="],

"jws/safe-buffer": ["[email protected]", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="],

"katex/commander": ["[email protected]", "", {}, "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww=="],

"lambda-local/commander": ["[email protected]", "", {}, "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug=="],
Expand Down Expand Up @@ -7349,6 +7356,8 @@

"public-ip/got": ["[email protected]", "", { "dependencies": { "@sindresorhus/is": "^5.2.0", "@szmarczak/http-timer": "^5.0.1", "cacheable-lookup": "^7.0.0", "cacheable-request": "^10.2.8", "decompress-response": "^6.0.0", "form-data-encoder": "^2.1.2", "get-stream": "^6.0.1", "http2-wrapper": "^2.1.10", "lowercase-keys": "^3.0.0", "p-cancelable": "^3.0.0", "responselike": "^3.0.0" } }, "sha512-mThBblvlAF1d4O5oqyvN+ZxLAYwIJK7bpMxgYqPD9okW0C3qm5FFn7k811QrcuEBwaogR3ngOFoCfs6mRv7teQ=="],

"randombytes/safe-buffer": ["[email protected]", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="],

"react-email/@babel/core": ["@babel/[email protected]", "", { "dependencies": { "@ampproject/remapping": "^2.2.0", "@babel/code-frame": "^7.24.2", "@babel/generator": "^7.24.5", "@babel/helper-compilation-targets": "^7.23.6", "@babel/helper-module-transforms": "^7.24.5", "@babel/helpers": "^7.24.5", "@babel/parser": "^7.24.5", "@babel/template": "^7.24.0", "@babel/traverse": "^7.24.5", "@babel/types": "^7.24.5", "convert-source-map": "^2.0.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", "json5": "^2.2.3", "semver": "^6.3.1" } }, "sha512-tVQRucExLQ02Boi4vdPp49svNGcfL2GhdTCT9aldhXgCJVAI21EtRfBettiuLUwce/7r6bFdgs6JFkcdTiFttA=="],

"react-email/chalk": ["[email protected]", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="],
Expand Down Expand Up @@ -7493,6 +7502,8 @@

"stdin-discarder/bl": ["[email protected]", "", { "dependencies": { "buffer": "^6.0.3", "inherits": "^2.0.4", "readable-stream": "^3.4.0" } }, "sha512-tv1ZJHLfTDnXE6tMHv73YgSJaWR2AFuPwMntBe7XL/GBFHnT0CLnsHMogfk5+GzCDC5ZWarSCYaIGATZt9dNsQ=="],

"string_decoder/safe-buffer": ["[email protected]", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="],

"strip-literal/js-tokens": ["[email protected]", "", {}, "sha512-mxa9E9ITFOt0ban3j6L5MpjwegGz6lBQmM1IJkWeBZGcMxto50+eWdjC/52xDbS2vy0k7vIMK0Fe2wfL9OQSpQ=="],

"style-to-js/style-to-object": ["[email protected]", "", { "dependencies": { "inline-style-parser": "0.2.4" } }, "sha512-G4qppLgKu/k6FwRpHiGiKPaPTFcG3g4wNVX/Qsfu+RqQM30E7Tyu/TEgxcL9PNLF5pdRLwQdE3YKKf+KF2Dzlw=="],
Expand Down Expand Up @@ -7527,6 +7538,8 @@

"tsup/esbuild": ["[email protected]", "", { "optionalDependencies": { "@esbuild/aix-ppc64": "0.25.6", "@esbuild/android-arm": "0.25.6", "@esbuild/android-arm64": "0.25.6", "@esbuild/android-x64": "0.25.6", "@esbuild/darwin-arm64": "0.25.6", "@esbuild/darwin-x64": "0.25.6", "@esbuild/freebsd-arm64": "0.25.6", "@esbuild/freebsd-x64": "0.25.6", "@esbuild/linux-arm": "0.25.6", "@esbuild/linux-arm64": "0.25.6", "@esbuild/linux-ia32": "0.25.6", "@esbuild/linux-loong64": "0.25.6", "@esbuild/linux-mips64el": "0.25.6", "@esbuild/linux-ppc64": "0.25.6", "@esbuild/linux-riscv64": "0.25.6", "@esbuild/linux-s390x": "0.25.6", "@esbuild/linux-x64": "0.25.6", "@esbuild/netbsd-arm64": "0.25.6", "@esbuild/netbsd-x64": "0.25.6", "@esbuild/openbsd-arm64": "0.25.6", "@esbuild/openbsd-x64": "0.25.6", "@esbuild/openharmony-arm64": "0.25.6", "@esbuild/sunos-x64": "0.25.6", "@esbuild/win32-arm64": "0.25.6", "@esbuild/win32-ia32": "0.25.6", "@esbuild/win32-x64": "0.25.6" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-GVuzuUwtdsghE3ocJ9Bs8PNoF13HNQ5TXbEi2AhvVb8xU1Iwt9Fos9FEamfoee+u/TOsn7GUWc04lz46n2bbTg=="],

"tunnel-agent/safe-buffer": ["[email protected]", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="],

"unbzip2-stream/buffer": ["[email protected]", "", { "dependencies": { "base64-js": "^1.3.1", "ieee754": "^1.1.13" } }, "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ=="],

"unctx/unplugin": ["[email protected]", "", { "dependencies": { "acorn": "^8.14.1", "picomatch": "^4.0.2", "webpack-virtual-modules": "^0.6.2" } }, "sha512-RyWSb5AHmGtjjNQ6gIlA67sHOsWpsbWpwDokLwTcejVdOjEkJZh7QKu14J00gDDVSh8kGH4KYC/TNBceXFZhtw=="],
Expand Down Expand Up @@ -8435,7 +8448,7 @@

"jsonwebtoken/jws/jwa": ["[email protected]", "", { "dependencies": { "buffer-equal-constant-time": "^1.0.1", "ecdsa-sig-formatter": "1.0.11", "safe-buffer": "^5.0.1" } }, "sha512-eeH5JO+21J78qMvTIDdBXidBd6nG2kZjg5Ohz/1fpa28Z4CcsWUzJ1ZZyFq/3z3N17aZy+ZuBoHljASbL1WfOw=="],

"lazystream/readable-stream/safe-buffer": ["safe-buffer@5.1.2", "", {}, "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="],
"jsonwebtoken/jws/safe-buffer": ["safe-buffer@5.2.1", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="],

"lazystream/readable-stream/string_decoder": ["[email protected]", "", { "dependencies": { "safe-buffer": "~5.1.0" } }, "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg=="],

Expand Down
16 changes: 14 additions & 2 deletions packages/bot-engine/src/blocks/integrations/googleSheets/getRow.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { GoogleSheetsGetOptions } from "@typebot.io/blocks-integrations/googleSheets/schema";
import type { SessionState } from "@typebot.io/chat-session/schemas";
import { getGoogleSpreadsheet } from "@typebot.io/credentials/getGoogleSpreadsheet";
import { parseUnknownError } from "@typebot.io/lib/parseUnknownError";
import { byId, isDefined, isNotEmpty } from "@typebot.io/lib/utils";
import type { LogInSession } from "@typebot.io/logs/schemas";
Expand All @@ -8,7 +9,6 @@ import { deepParseVariables } from "@typebot.io/variables/deepParseVariables";
import type { VariableWithValue } from "@typebot.io/variables/schemas";
import type { ExecuteIntegrationResponse } from "../../../types";
import { updateVariablesInSession } from "../../../updateVariablesInSession";
import { getAuthenticatedGoogleDoc } from "./helpers/getAuthenticatedGoogleDoc";
import { matchFilter } from "./helpers/matchFilter";

export const getRow = async (
Expand Down Expand Up @@ -45,12 +45,24 @@ export const getRow = async (
],
};

const doc = await getAuthenticatedGoogleDoc({
const doc = await getGoogleSpreadsheet({
credentialsId: options.credentialsId,
spreadsheetId: options.spreadsheetId,
workspaceId: state.workspaceId,
});

if (!doc)
return {
outgoingEdgeId,
logs: [
{
status: "error",
description: "Couldn't find credentials in database",
context: "While getting spreadsheet row",
},
],
};

try {
await doc.loadInfo();
const sheet = doc.sheetsById[Number(sheetId)];
Expand Down

This file was deleted.

Loading
Loading