diff --git a/apps/api/src/controllers/webhook.controller.ts b/apps/api/src/controllers/webhook.controller.ts
index cb3b02b6..440acbeb 100644
--- a/apps/api/src/controllers/webhook.controller.ts
+++ b/apps/api/src/controllers/webhook.controller.ts
@@ -250,7 +250,10 @@ export async function slackWebhook(
}),
);
- reply.send({ success: true });
+ return reply
+ .status(200)
+ .header('Content-Type', 'text/html')
+ .send('
Slack integration added. You can close this window now.
');
} catch (err) {
request.log.error(err);
return reply
diff --git a/apps/dashboard/src/components/integrations/forms/slack-integration.tsx b/apps/dashboard/src/components/integrations/forms/slack-integration.tsx
index 30d3b6d9..fe714323 100644
--- a/apps/dashboard/src/components/integrations/forms/slack-integration.tsx
+++ b/apps/dashboard/src/components/integrations/forms/slack-integration.tsx
@@ -19,11 +19,12 @@ export function SlackIntegrationForm({
defaultValues?: RouterOutputs['integration']['get'];
onSuccess: () => void;
}) {
- const popup = useRef(null);
const { organizationId } = useAppParams();
useWS(`/live/integrations/slack?organizationId=${organizationId}`, (res) => {
- if (popup.current) {
- popup.current.close();
+ // @ts-expect-error
+ if (window.slackPopup && typeof window.slackPopup.close === 'function') {
+ // @ts-expect-error
+ window.slackPopup.close();
}
onSuccess();
});
@@ -42,14 +43,17 @@ export function SlackIntegrationForm({
const height = 800;
const left = window.screenX + (window.outerWidth - width) / 2;
const top = window.screenY + (window.outerHeight - height) / 2.5;
- popup.current = window.open(
+ // @ts-expect-error
+ window.slackPopup = window.open(
url,
'',
`toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=${width}, height=${height}, top=${top}, left=${left}`,
);
// The popup might have been blocked, so we redirect the user to the URL instead
- if (!popup.current) {
+ //
+ // @ts-expect-error
+ if (!window.slackPopup) {
window.location.href = url;
}
},