Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
ced3f88
fix: don't throw when the token is missing
foleyatwork Jan 4, 2024
79b0766
chore: lock versions, migrate the db, prep for production
foleyatwork Jan 5, 2024
68e9e1d
chore: forgot to add the migration
foleyatwork Jan 5, 2024
aa9f051
Merge remote-tracking branch 'upstream/main' into main
sajxraj Feb 6, 2024
b66cc87
written schema to fetch internal user list
aatbip Feb 7, 2024
2404c72
added IU as senderID in settings
aatbip Feb 7, 2024
5f6ecd1
added IU as senderID in message service
aatbip Feb 7, 2024
5201e0e
filtered users with isClientAccessLimited true
aatbip Feb 7, 2024
70ec9ca
added console error
aatbip Feb 8, 2024
01756ca
removed comment
aatbip Feb 8, 2024
f7748f9
Merge pull request #1 from copilot-platforms/OUT-33
aatbip Feb 8, 2024
e0e4ca5
updated copilot-node-sdk to 1.1.3
aatbip Feb 13, 2024
96d8b2e
Merge pull request #2 from copilot-platforms/sdk-update
aatbip Feb 13, 2024
69d3750
udpate fixes
aatbip Feb 13, 2024
e3fb4a4
Merge pull request #3 from copilot-platforms/fixes-1
aatbip Feb 13, 2024
33205fe
Add github workflow for prod migration
sajxraj Feb 14, 2024
f88c05e
Merge pull request #4 from copilot-platforms/prod-migration
sujansh Feb 14, 2024
5209ad7
make senderId optional
Feb 14, 2024
c8c479b
Merge pull request #5 from copilot-platforms/senderId-fix
sujansh Feb 14, 2024
16eb9c1
feat: default to current user on new workspace
rrojan Feb 15, 2024
0eccb73
Rename github secret
sajxraj Feb 15, 2024
ef3776d
Remove github workflow for deploy
sajxraj Feb 15, 2024
8bb7e38
fix: order of migrations is incorrect
rrojan Feb 16, 2024
e79bb41
fix: make senderId col non-nullable
rrojan Feb 16, 2024
bd96cab
fix: add workspaceId to settings table
rrojan Feb 16, 2024
1af7ad8
fix: remove uuid constraint
rrojan Feb 16, 2024
1bf49bf
feat: implement settings set and retrieve from workspaceId
rrojan Feb 16, 2024
2031280
fix: fetch by workspace in message webhook
rrojan Feb 16, 2024
a63dc32
chore: bump copilot-node-sdk to 1.2.0
rrojan Feb 19, 2024
f2ad78a
feat: use current internal user as default user in new setting
rrojan Feb 19, 2024
ce5f26f
chore!: lock node version to 18.18.2
rrojan Feb 19, 2024
755bef4
Merge branch 'main' of github.com:copilot-platforms/auto-responder in…
rrojan Feb 19, 2024
034f659
chore: log current node version
rrojan Feb 19, 2024
5305e4b
revert: unlog version and id
rrojan Feb 19, 2024
182bbab
chore: upgrade lint workflow to use node 18.19.1
rrojan Feb 19, 2024
24d79ce
chore!: re set node version for lint workflow
rrojan Feb 19, 2024
eaa78bc
fix: minor fixes
rrojan Feb 20, 2024
27a7034
chore: add a license and update the sdk
foleyatwork Feb 21, 2024
4e647e9
Merge pull request #8 from copilot-platforms/auto-responder-maintenance
foleyatwork Feb 21, 2024
769dbe7
Merge pull request #6 from copilot-platforms/OUT-65
rrojan Feb 23, 2024
7074d73
fix: merge conflicts
rrojan Feb 23, 2024
56cb0d8
fix: accomodate change from SDK in portalName
rrojan Feb 23, 2024
87bc980
Merge pull request #7 from copilot-platforms/OUT-64
rrojan Feb 23, 2024
d22c4ff
chore!: bump minimum patch version to 1.2.2
rrojan Feb 26, 2024
4004170
chore: use latest 18.x node version for linting
rrojan Feb 26, 2024
d857002
Add callout about 1 hour limit in UI (#10)
Feb 27, 2024
6756a02
more copy (touch) (#11)
Feb 27, 2024
941a876
hotfix: show InvalidToken when token is not passed
rrojan Mar 6, 2024
c165b55
feat: implement sentry for error monitoring
rrojan Mar 17, 2024
cab9e59
feat: implement sentry config in next.config
rrojan Mar 17, 2024
e92ff0b
hotfix: add loader
rrojan Mar 19, 2024
15bff34
Merge pull request #9 from copilot-platforms/OUT-101
rrojan Mar 19, 2024
392a456
Merge pull request #12 from copilot-platforms/OUT-169
rrojan Mar 19, 2024
60f544c
Change channelId from uuid to string in message table (#13)
sajxraj Mar 20, 2024
781d78a
fix: day validation was active even when always on
rrojan Mar 27, 2024
d87df8e
Merge pull request #14 from copilot-platforms/OUT-226
rrojan Mar 27, 2024
3057081
validation not needed when set to always on (#15)
Mar 27, 2024
3ccc02e
fix: also check condition for auto response turned off
rrojan Mar 28, 2024
ed800f6
Merge pull request #16 from copilot-platforms/OUT-226-re
rrojan Mar 28, 2024
7255924
fix: isDirty not working like it is supposed to
rrojan Mar 29, 2024
e3dade5
chore!: bump copilot sdk to v2.0.0
rrojan Apr 5, 2024
2cebc38
fix: change module resolution to Bundler to fix copilot sdk import
rrojan Apr 5, 2024
8be5983
fix: deprecate use of `me`
rrojan Apr 5, 2024
d68ebdb
fix: change CopilotAPI util to use new sdk methods
rrojan Apr 5, 2024
e1d5bf3
fix!: use custom error as copilot ApiError is no longer exported
rrojan Apr 5, 2024
569997e
feat: add custom CopilotAPIError
rrojan Apr 5, 2024
bef3b5b
fix: copilot exception class match issue
rrojan Apr 8, 2024
0ec87ac
refactor: cleaner typing
rrojan Apr 11, 2024
6de6612
Merge pull request #17 from copilot-platforms/OUT-263
rrojan Apr 11, 2024
63c2deb
chore(OUT-1491): bump up copilot SDK to 3.5.1 (#18)
rrojan Mar 4, 2025
2abde46
fix(OUT-2106): Autoresponder sending messages very late due to slow w…
arpandhakal Aug 4, 2025
2522cf3
Merge pull request #19 from copilot-platforms/OUT-2106
arpandhakal Aug 4, 2025
ec7795a
chore(OUT-2147): bump CI node-version to 20
rrojan Aug 11, 2025
6626c33
add(OUT-2226): Support custom client/company labels
SandipBajracharya Aug 20, 2025
c361a2c
update(OUT-2226): update workspace response type for label
SandipBajracharya Aug 22, 2025
21ac0e4
fix(OUT-2397): change metadata to Assembly
rrojan Sep 22, 2025
693f586
chore(OUT-2397): bump up license term for Copilot Platforms
rrojan Sep 22, 2025
3a24ca9
patch(out-3087) - patch cve vulnerability
priosshrsth Feb 11, 2026
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
28 changes: 0 additions & 28 deletions .env.example

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 18.17.0
node-version: 20
cache: yarn
cache-dependency-path: './yarn.lock'

Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,6 @@ next-env.d.ts
/migrations/migration_lock.toml
.idea
/.vscode/

# Sentry Config File
.sentryclirc
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 - 2025 Copilot Platforms Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,21 @@ CREATE TABLE "Setting" (
"createdById" UUID NOT NULL,
"message" TEXT,
"createdAt" TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
"updatedAt" TIMESTAMPTZ NOT NULL,

CONSTRAINT "Setting_pkey" PRIMARY KEY ("id")
);

-- CreateIndex
CREATE UNIQUE INDEX "Setting_createdById_key" ON "Setting"("createdById");
-- CreateTable
CREATE TABLE "Message" (
"id" UUID NOT NULL DEFAULT gen_random_uuid(),
"message" TEXT NOT NULL,
"clientId" UUID NOT NULL,
"channelId" UUID NOT NULL,
"senderId" UUID NOT NULL,
"createdAt" TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMPTZ NOT NULL,

CONSTRAINT "Message_pkey" PRIMARY KEY ("id")
);

14 changes: 0 additions & 14 deletions migrations/20231020073838_create_message_table/migration.sql

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "Setting" ADD COLUMN "senderId" UUID;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- AlterTable
UPDATE "Setting" SET "senderId"="createdById";
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
Warnings:

- Made the column `senderId` on table `Setting` required. This step will fail if there are existing NULL values in that column.

*/
-- AlterTable
ALTER TABLE "Setting" ALTER COLUMN "senderId" SET NOT NULL;
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
Warnings:

- Added the required column `workspaceId` to the `Setting` table without a default value. This is not possible if the table is not empty.

*/
-- AlterTable
ALTER TABLE "Setting" ADD COLUMN "workspaceId" UUID NOT NULL;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "Setting" ALTER COLUMN "workspaceId" SET DATA TYPE TEXT;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "Message" ALTER COLUMN "channelId" SET DATA TYPE TEXT;
44 changes: 44 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,47 @@ const withSvgr = require('next-plugin-svgr');
const nextConfig = {};

module.exports = withSvgr(nextConfig);

// Injected content via Sentry wizard below

const { withSentryConfig } = require('@sentry/nextjs');

module.exports = withSentryConfig(
module.exports,
{
// For all available options, see:
// https://github.com/getsentry/sentry-webpack-plugin#options

// Suppresses source map uploading logs during build
silent: true,
org: 'copilot-platforms',
project: 'auto-responder',
},
{
// For all available options, see:
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/

// Upload a larger set of source maps for prettier stack traces (increases build time)
widenClientFileUpload: true,

// Transpiles SDK to be compatible with IE11 (increases bundle size)
transpileClientSDK: true,

// Routes browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers. (increases server load)
// Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-
// side errors will fail.
tunnelRoute: '/monitoring',

// Hides source maps from generated client bundles
hideSourceMaps: true,

// Automatically tree-shake Sentry logger statements to reduce bundle size
disableLogger: true,

// Enables automatic instrumentation of Vercel Cron Monitors.
// See the following for more information:
// https://docs.sentry.io/product/crons/
// https://vercel.com/docs/cron-jobs
automaticVercelMonitors: true,
},
);
23 changes: 17 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,28 @@
"prettier:check": "prettier --check \"{src,test}/**/*.{ts,tsx}\"",
"prettier:fix": "prettier --write .",
"lint-staged": "npx lint-staged",
"postinstall": "prisma generate"
"postinstall": "prisma generate",
"db:migrate": "dotenv-run-script .env.development.local -- db:_migrate",
"db:_migrate": "prisma migrate dev",
"db:seed": "dotenv-run-script .env.development.local -- db:_seed",
"db:_seed": "prisma migrate resolve --applied 0_init"
},
"dependencies": {
"@emotion/react": "^11.11.3",
"@emotion/styled": "^11.11.0",
"@hookform/resolvers": "^3.3.2",
"@js-joda/core": "^5.6.1",
"@js-joda/timezone": "^2.18.2",
"@prisma/client": "^5.4.2",
"@mui/material": "^5.15.7",
"@prisma/client": "^5.9.1",
"@radix-ui/react-select": "^2.0.0",
"@sentry/nextjs": "^7.105.0",
"@vercel/postgres": "^0.5.0",
"copilot-node-sdk": "^0.0.45",
"next": "^14.0.4",
"copilot-node-sdk": "^3.5.1",
"dotenv-run-script": "^0.4.1",
"next": "14.2.35",
"next-plugin-svgr": "^1.1.8",
"prisma": "^5.4.2",
"prisma": "^5.9.1",
"react": "latest",
"react-dom": "latest",
"react-error-boundary": "^4.0.11",
Expand All @@ -49,12 +58,14 @@
"prettier": "^3.1.1",
"prisma": "^5.4.2",
"tailwindcss": "latest",
"ts-node": "^10.9.2",
"typescript": "latest"
},
"lint-staged": {
"src/**/*.{ts,tsx}": [
"yarn lint:fix",
"yarn prettier:fix"
]
}
},
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
}
4 changes: 3 additions & 1 deletion schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ model Setting {
timezone String?
workingHours Json? @db.JsonB
createdById String @db.Uuid
senderId String @db.Uuid
workspaceId String
message String?
createdAt DateTime @default(now()) @db.Timestamptz()
updatedAt DateTime @updatedAt @ignore @db.Timestamptz()
Expand All @@ -29,7 +31,7 @@ model Message {
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
message String
clientId String @db.Uuid
channelId String @db.Uuid
channelId String
senderId String @db.Uuid
createdAt DateTime @default(now()) @db.Timestamptz()
updatedAt DateTime @updatedAt @ignore @db.Timestamptz()
Expand Down
31 changes: 31 additions & 0 deletions sentry.client.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// This file configures the initialization of Sentry on the client.
// The config you add here will be used whenever a users loads a page in their browser.
// https://docs.sentry.io/platforms/javascript/guides/nextjs/

import appConfig from '@/config/app';
import * as Sentry from '@sentry/nextjs';

Sentry.init({
dsn: appConfig.sentry.DSN,

// Adjust this value in production, or use tracesSampler for greater control
tracesSampleRate: 1,

// Setting this option to true will print useful information to the console while you're setting up Sentry.
debug: false,

replaysOnErrorSampleRate: 1.0,

// This sets the sample rate to be 10%. You may want this to be 100% while
// in development and sample at a lower rate in production
replaysSessionSampleRate: 0.1,

// You can remove this option if you're not planning to use the Sentry Session Replay feature:
integrations: [
Sentry.replayIntegration({
// Additional Replay configuration goes in here, for example:
maskAllText: true,
blockAllMedia: true,
}),
],
});
16 changes: 16 additions & 0 deletions sentry.edge.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// This file configures the initialization of Sentry for edge features (middleware, edge routes, and so on).
// The config you add here will be used whenever one of the edge features is loaded.
// Note that this config is unrelated to the Vercel Edge Runtime and is also required when running locally.
// https://docs.sentry.io/platforms/javascript/guides/nextjs/

import appConfig from '@/config/app';
import * as Sentry from '@sentry/nextjs';

Sentry.init({
dsn: appConfig.sentry.DSN,
// Adjust this value in production, or use tracesSampler for greater control
tracesSampleRate: 1,

// Setting this option to true will print useful information to the console while you're setting up Sentry.
debug: false,
});
18 changes: 18 additions & 0 deletions sentry.server.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// This file configures the initialization of Sentry on the server.
// The config you add here will be used whenever the server handles a request.
// https://docs.sentry.io/platforms/javascript/guides/nextjs/

import appConfig from '@/config/app';
import * as Sentry from '@sentry/nextjs';

Sentry.init({
dsn: appConfig.sentry.DSN,
// Adjust this value in production, or use tracesSampler for greater control
tracesSampleRate: 1,

// Setting this option to true will print useful information to the console while you're setting up Sentry.
debug: false,

// uncomment the line below to enable Spotlight (https://spotlightjs.com)
// spotlight: process.env.NODE_ENV === 'development',
});
22 changes: 22 additions & 0 deletions src/app/api/internal-users/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { errorHandler } from '@/utils/common';
import { CopilotAPI } from '@/utils/copilotApiUtils';
import { NextResponse, NextRequest } from 'next/server';
import { z } from 'zod';

export async function GET(request: NextRequest) {
const searchParams = request.nextUrl.searchParams;
const token = searchParams.get('token');
if (!token) {
return errorHandler('Missing token', 422);
}

const copilotClient = new CopilotAPI(z.string().parse(token));
try {
const clients = await copilotClient.getInternalUsers();

return NextResponse.json(clients);
} catch (error) {
console.error('getInternalUsers', error);
return errorHandler('Clients not found.', 404);
}
}
Loading