refactor: remove-zapier-setup-screen (#24652)
* refactor: remove-zapier-setup-screen * remove setup page files, related config and update readme * make zapier a redirecting app * update readme * add check for missing website * add noopener,noreferrer for _blank links
This commit is contained in:
1 parent
1fdd04215d
commit
8e818e0567
50 files changed
+69
-433
No files matched your search
@@ -3,7 +3,6 @@ import type { GetServerSidePropsContext } from "next";
|
||||
export const AppSetupPageMap = {
|
||||
alby: import("../../alby/pages/setup/_getServerSideProps"),
|
||||
make: import("../../make/pages/setup/_getServerSideProps"),
|
||||
zapier: import("../../zapier/pages/setup/_getServerSideProps"),
|
||||
stripe: import("../../stripepayment/pages/setup/_getServerSideProps"),
|
||||
hitpay: import("../../hitpay/pages/setup/_getServerSideProps"),
|
||||
btcpayserver: import("../../btcpayserver/pages/setup/_getServerSideProps"),
|
||||
|
||||
@@ -17,6 +17,7 @@ export const REDIRECT_APPS = [
|
||||
"telli",
|
||||
"vimcal",
|
||||
"wordpress",
|
||||
"zapier",
|
||||
];
|
||||
|
||||
export const isRedirectApp = (slug: string): boolean => {
|
||||
|
||||
@@ -105,7 +105,7 @@ import whatsapp_config_json from "./whatsapp/config.json";
|
||||
import whereby_config_json from "./whereby/config.json";
|
||||
import { metadata as wipemycalother__metadata_ts } from "./wipemycalother/_metadata";
|
||||
import wordpress_config_json from "./wordpress/config.json";
|
||||
import { metadata as zapier__metadata_ts } from "./zapier/_metadata";
|
||||
import zapier_config_json from "./zapier/config.json";
|
||||
import zoho_bigin_config_json from "./zoho-bigin/config.json";
|
||||
import zohocalendar_config_json from "./zohocalendar/config.json";
|
||||
import zohocrm_config_json from "./zohocrm/config.json";
|
||||
@@ -215,7 +215,7 @@ export const appStoreMetadata = {
|
||||
whereby: whereby_config_json,
|
||||
wipemycalother: wipemycalother__metadata_ts,
|
||||
wordpress: wordpress_config_json,
|
||||
zapier: zapier__metadata_ts,
|
||||
zapier: zapier_config_json,
|
||||
"zoho-bigin": zoho_bigin_config_json,
|
||||
zohocalendar: zohocalendar_config_json,
|
||||
zohocrm: zohocrm_config_json,
|
||||
|
||||
@@ -4,4 +4,6 @@ items:
|
||||
- 2.jpg
|
||||
---
|
||||
|
||||
Workflow automation for everyone. Use the [Cal.com](https://cal.com) Zapier app to automate your workflows when a booking is created, rescheduled, cancelled or when a meeting ended.<br /><br />**After Installation:** Have you lost your API key? You can always generate a new key on the <a href="/apps/zapier/setup">**<ins>Zapier Setup Page</ins>**</a>
|
||||
Connect Cal.com with 8,000+ apps through Zapier to automate your scheduling workflows. Set up triggers for booking events (created, rescheduled, cancelled, meeting ended) and integrate with popular tools like Slack, Gmail, Google Sheets, and more.
|
||||
|
||||
**Get started:** Click "Visit" to access the Zapier integrations page and create your first automation workflow.
|
||||
@@ -5,87 +5,30 @@
|
||||
</a>
|
||||
</div>
|
||||
|
||||
# Setting up Zapier Integration
|
||||
# Zapier Integration – Developer Guide
|
||||
|
||||
If you run it on localhost, check out the [additional information](https://github.com/CarinaWolli/cal.com/edit/feat/zapier-app/packages/app-store/zapier/README.md#localhost) below.
|
||||
**Note:** This is a redirect app. End users should connect Cal.com to Zapier directly via the Zapier Integrations page: https://zapier.com/apps/calcom/integrations
|
||||
|
||||
1. Create [Zapier Account](https://zapier.com/sign-up?next=https%3A%2F%2Fdeveloper.zapier.com%2F)
|
||||
2. If not redirected to developer account, go to: [Zapier Developer Account](https://developer.zapier.com)
|
||||
3. Click **Start a Zapier Integration**
|
||||
4. Create Integration
|
||||
- Name: Cal.com
|
||||
- Description: [Cal.com](https://cal.com) is a scheduling infrastructure for absolutely everyone.
|
||||
- Intended Audience: Private
|
||||
- Role: choose whatever is appropriate
|
||||
- Category: Calendar
|
||||
The Zapier app in Cal.com now functions as a redirect app that takes users directly to Zapier's integration page. No local setup or OAuth configuration is required.
|
||||
|
||||
## Authentication
|
||||
## How It Works
|
||||
|
||||
1. Go to Authentication, choose Api key and click save
|
||||
2. Click Add Fields
|
||||
- Key: apiKey
|
||||
- Check the box ‘is this field required?’
|
||||
3. Configure a Test
|
||||
- Test: GET `<baseUrl>`/api/integrations/zapier/listBookings
|
||||
- URL Params
|
||||
- apiKey: {{bundle.authData.apiKey}}
|
||||
4. Test your authentication —> First you have to install Zapier in the [Cal.com](https://cal.com)App Store and generate an API key, use this API key to test your authentication (only zapier Api key works)
|
||||
1. **User clicks "Visit"** → Opens Zapier integrations page
|
||||
2. **User sets up automation** → Directly on Zapier's platform
|
||||
3. **No Cal.com credentials needed** → Users authenticate directly with Zapier
|
||||
|
||||
## Triggers
|
||||
## For Developers
|
||||
|
||||
Booking created, Booking rescheduled, Booking cancelled, Meeting ended, Out Of Office Created
|
||||
This app uses the `link-as-an-app` template and requires no additional configuration beyond the redirect URL.
|
||||
|
||||
### Booking created
|
||||
## Legacy API Endpoints
|
||||
|
||||
1. Settings
|
||||
- Key: booking_created
|
||||
- Name: Booking created
|
||||
- Noun: Booking
|
||||
- Description: Triggers when a new booking is created
|
||||
2. API Configuration (apiKey is set automatically, leave it like it is):
|
||||
- Trigger Type: REST Hook
|
||||
- Subscribe: POST `<baseUrl>`/api/integrations/zapier/addSubscription
|
||||
- Request Body
|
||||
- subscriberUrl: {{bundle.targetUrl}}
|
||||
- triggerEvent: BOOKING_CREATED
|
||||
- Unsubscribe: DELETE `<baseUrl>`/api/integrations/zapier/deleteSubscription
|
||||
- URL Params (in addition to apiKey)
|
||||
- id: {{bundle.subscribeData.id}}
|
||||
- PerformList: GET `<baseUrl>`/api/integrations/zapier/listBookings
|
||||
3. Test your API request
|
||||
The following API endpoints are maintained for backward compatibility with existing Zapier integrations:
|
||||
|
||||
Create the other triggers (booking rescheduled, booking cancelled and meeting ended) exactly like this one, just use the appropriate naming (e.g. booking_rescheduled instead of booking_created)
|
||||
- `GET /api/integrations/zapier/listBookings` - List user bookings
|
||||
- `GET /api/integrations/zapier/listOOOEntries` - List out-of-office entries
|
||||
- `POST /api/integrations/zapier/addSubscription` - Subscribe to webhooks
|
||||
- `DELETE /api/integrations/zapier/deleteSubscription` - Unsubscribe from webhooks
|
||||
- `GET /api/integrations/zapier/me` - Get user/team information
|
||||
|
||||
### Out Of Office Created
|
||||
|
||||
1. Settings
|
||||
- Key: ooo_created
|
||||
- Name: Out Of Office Created
|
||||
- Noun: OOO Entry
|
||||
- Description: Triggers when a new Out Of Office entry is created.
|
||||
2. API Configuration (apiKey is set automatically, leave it like it is):
|
||||
- Trigger Type: REST Hook
|
||||
- Subscribe: POST `<baseUrl>`/api/integrations/zapier/addSubscription
|
||||
- Request Body
|
||||
- subscriberUrl: {{bundle.targetUrl}}
|
||||
- triggerEvent: OOO_CREATED
|
||||
- Unsubscribe: DELETE `<baseUrl>`/api/integrations/zapier/deleteSubscription
|
||||
- URL Params (in addition to apiKey)
|
||||
- id: {{bundle.subscribeData.id}}
|
||||
- PerformList: GET `<baseUrl>`/api/integrations/zapier/listOOOEntries
|
||||
3. Test your API request
|
||||
4. Note: When creating the ZAP you need to remember that data is stored in the { payload: { oooEntry: { ... } } }
|
||||
|
||||
### Set ZAPIER_INVITE_LINK
|
||||
|
||||
The invite link can be found under Manage → Sharing.
|
||||
|
||||
## Localhost
|
||||
|
||||
Localhost urls can not be used as the base URL for api endpoints
|
||||
|
||||
Possible solution: using [https://ngrok.com/](https://ngrok.com/)
|
||||
|
||||
1. Create Account
|
||||
2. [Download](https://ngrok.com/download) ngrok and start a tunnel to your running localhost
|
||||
- Use forwarding url as your baseUrl for the URL endpoints
|
||||
**Note:** These endpoints support both API key and OAuth authentication for existing integrations. The endpoints are dynamically routed through `/api/integrations/[...args].ts`.
|
||||
@@ -13,7 +13,7 @@ export const metadata = {
|
||||
slug: "zapier",
|
||||
title: "Zapier",
|
||||
type: "zapier_automation",
|
||||
url: "https://cal.com/apps/zapier",
|
||||
url: "https://zapier.com/apps/calcom/integrations",
|
||||
variant: "automation",
|
||||
email: "[email protected]",
|
||||
dirName: "zapier",
|
||||
|
||||
@@ -1,39 +1,22 @@
|
||||
import type { NextApiRequest, NextApiResponse } from "next";
|
||||
import { createDefaultInstallation } from "@calcom/app-store/_utils/installation";
|
||||
import type { AppDeclarativeHandler } from "@calcom/types/AppHandler";
|
||||
|
||||
import prisma from "@calcom/prisma";
|
||||
import appConfig from "../config.json";
|
||||
|
||||
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
if (!req.session?.user?.id) {
|
||||
return res.status(401).json({ message: "You must be logged in to do this" });
|
||||
}
|
||||
const appType = "zapier_automation";
|
||||
try {
|
||||
const alreadyInstalled = await prisma.credential.findFirst({
|
||||
where: {
|
||||
type: appType,
|
||||
userId: req.session.user.id,
|
||||
},
|
||||
});
|
||||
if (alreadyInstalled) {
|
||||
throw new Error("Already installed");
|
||||
}
|
||||
const installation = await prisma.credential.create({
|
||||
data: {
|
||||
type: appType,
|
||||
key: {},
|
||||
userId: req.session.user.id,
|
||||
appId: "zapier",
|
||||
},
|
||||
});
|
||||
if (!installation) {
|
||||
throw new Error("Unable to create user credential for zapier");
|
||||
}
|
||||
} catch (error: unknown) {
|
||||
if (error instanceof Error) {
|
||||
return res.status(500).json({ message: error.message });
|
||||
}
|
||||
return res.status(500);
|
||||
}
|
||||
const handler: AppDeclarativeHandler = {
|
||||
appType: appConfig.type,
|
||||
variant: appConfig.variant,
|
||||
slug: appConfig.slug,
|
||||
supportsMultipleInstalls: false,
|
||||
handlerType: "add",
|
||||
redirect: {
|
||||
newTab: true,
|
||||
url: "https://zapier.com/apps/calcom/integrations",
|
||||
},
|
||||
// Creates minimal credential record for tracking purposes only
|
||||
// No actual credentials are stored since this is a redirect app
|
||||
createCredential: ({ appType, user, slug, teamId }) =>
|
||||
createDefaultInstallation({ appType, user: user, slug, key: {}, teamId }),
|
||||
};
|
||||
|
||||
return res.status(200).json({ url: "/apps/zapier/setup" });
|
||||
}
|
||||
export default handler;
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"/*": "Don't modify slug - If required, do it using cli edit command",
|
||||
"name": "Zapier",
|
||||
"slug": "zapier",
|
||||
"type": "zapier_automation",
|
||||
"logo": "icon.svg",
|
||||
"url": "https://zapier.com/apps/calcom/integrations",
|
||||
"variant": "automation",
|
||||
"categories": ["automation"],
|
||||
"publisher": "Cal.com",
|
||||
"email": "[email protected]",
|
||||
"description": "Workflow automation for everyone. Use the Cal.com Zapier app to automate your workflows when a booking is created, rescheduled, cancelled or when a meeting ends.",
|
||||
"isTemplate": false,
|
||||
"__createdUsingCli": true,
|
||||
"__template": "link-as-an-app"
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
import type { GetServerSidePropsContext } from "next";
|
||||
|
||||
import getAppKeysFromSlug from "../../../_utils/getAppKeysFromSlug";
|
||||
|
||||
export interface IZapierSetupProps {
|
||||
inviteLink: string;
|
||||
}
|
||||
|
||||
export const getServerSideProps = async (ctx: GetServerSidePropsContext) => {
|
||||
const notFound = { notFound: true } as const;
|
||||
|
||||
if (typeof ctx.params?.slug !== "string") return notFound;
|
||||
let inviteLink = "";
|
||||
const appKeys = await getAppKeysFromSlug("zapier");
|
||||
if (typeof appKeys.invite_link === "string") inviteLink = appKeys.invite_link;
|
||||
|
||||
return {
|
||||
props: {
|
||||
inviteLink,
|
||||
},
|
||||
};
|
||||
};
|
||||
@@ -59,7 +59,8 @@ export function AppCard({ app, credentials, searchText, userAdminTeams }: AppCar
|
||||
|
||||
const handleAppInstall = () => {
|
||||
if (isRedirectApp(app.slug)) {
|
||||
mutation.mutate({ type: app.type, variant: app.variant, slug: app.slug });
|
||||
// For redirect apps, open the external URL directly
|
||||
if (app.url) window.open(app.url, "_blank", "noopener,noreferrer");
|
||||
return;
|
||||
}
|
||||
if (isConferencing(app.categories) && !app.concurrentMeetings) {
|
||||
@@ -137,7 +138,9 @@ export function AppCard({ app, credentials, searchText, userAdminTeams }: AppCar
|
||||
data-testid={`app-store-app-card-${app.slug}`}>
|
||||
{t("details")}
|
||||
</Button>
|
||||
{app.isGlobal || (credentials && credentials.length > 0 && allowedMultipleInstalls)
|
||||
{app.isGlobal ||
|
||||
(credentials && credentials.length > 0 && allowedMultipleInstalls) ||
|
||||
(credentials && credentials.length > 0 && isRedirectApp(app.slug))
|
||||
? !app.isGlobal && (
|
||||
<InstallAppButton
|
||||
type={app.type}
|
||||
@@ -186,7 +189,9 @@ export function AppCard({ app, credentials, searchText, userAdminTeams }: AppCar
|
||||
)}
|
||||
</div>
|
||||
<div className="max-w-44 absolute right-0 mr-4 flex flex-wrap justify-end gap-1">
|
||||
{appAdded > 0 ? <Badge variant="green">{t("installed", { count: appAdded })}</Badge> : null}
|
||||
{appAdded > 0 && !isRedirectApp(app.slug) ? (
|
||||
<Badge variant="green">{t("installed", { count: appAdded })}</Badge>
|
||||
) : null}
|
||||
{app.isTemplate && (
|
||||
<span className="bg-error rounded-md px-2 py-1 text-sm font-normal text-red-800">Template</span>
|
||||
)}
|
||||
|
||||
Reference in new issue
Block a user