Skip to content
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

feat: OOO webhook and zapier #15434

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open

Conversation

alannnc
Copy link
Contributor

@alannnc alannnc commented Jun 14, 2024

What does this PR do?

Loom Video: https://www.loom.com/share/b1a4d42ec78944d49248501e2d805c56

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected)
  • I have added a Docs issue here if this PR makes changes that would require a documentation change
  • I have added or modified automated tests that prove my fix is effective or that my feature works (PRs might be rejected if logical changes are not properly tested)

How should this be tested?

  • Are there environment variables that should be set? set environment time to UTC
  • What are the minimal test data to have? Zapier developer account & app
  • What is expected (happy path) to have (input and output)? Create a ooo entry and expect webhooks/zapier triggers
  • Any other important info that could help to test that PR For testing webhooks https://webhook.site/

Checklist

/claim #15430

Copy link

vercel bot commented Jun 14, 2024

@alannnc is attempting to deploy a commit to the cal Team on Vercel.

A member of the Team first needs to authorize it.

@graphite-app graphite-app bot added the community Created by Linear-GitHub Sync label Jun 14, 2024
@graphite-app graphite-app bot requested a review from a team June 14, 2024 07:13
Copy link

algora-pbc bot commented Jun 14, 2024

💵 To receive payouts, sign up on Algora, link your Github account and connect with Stripe/Alipay.

Copy link
Contributor

github-actions bot commented Jun 14, 2024

Hey there and thank you for opening this pull request! 👋🏼

We require pull request titles to follow the Conventional Commits specification and it looks like your proposed title needs to be adjusted.

Details:

Unknown release type "OOO" found in pull request title "OOO: webhook and zapier". 

Available types:
 - feat: A new feature
 - fix: A bug fix
 - docs: Documentation only changes
 - style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
 - refactor: A code change that neither fixes a bug nor adds a feature
 - perf: A code change that improves performance
 - test: Adding missing tests or correcting existing tests
 - build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
 - ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
 - chore: Other changes that don't modify src or test files
 - revert: Reverts a previous commit

@github-actions github-actions bot added the ❗️ migrations contains migration files label Jun 14, 2024
@dosubot dosubot bot added app-store area: app store, apps, calendar integrations, google calendar, outlook, lark, apple calendar webhooks area: webhooks, callback, webhook payload ✨ feature New feature or request labels Jun 14, 2024
@alannnc alannnc changed the title OOO: webhook and zapier feat: OOO: webhook and zapier Jun 14, 2024
Copy link

graphite-app bot commented Jun 14, 2024

Graphite Automations

"Add community label" took an action on this PR • (06/14/24)

1 label was added to this PR based on Keith Williams's automation.

"Add consumer team as reviewer" took an action on this PR • (06/14/24)

1 reviewer was added to this PR based on Keith Williams's automation.

@@ -367,7 +367,7 @@ const OutOfOfficePage = () => {
const { t } = useLocale();

const params = useSearchParams();
const openModalOnStart = !!params?.get("om");
const openModalOnStart = !!params?.get("open");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better name

### Set ZAPIER_INVITE_LINK

The invite link can be found under under Manage → Sharing.
The invite link can be found under Manage → Sharing.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

double under

@@ -67,5 +87,5 @@ 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) gnork and start a tunnel to your running localhost
2. [Download](https://ngrok.com/download) ngrok and start a tunnel to your running localhost
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo

icon: "googleCalendar.svg",
app: "Google Calendar",
text: "Add new calendar event when a team member is out of office",
link: "https://zapier.com/app/editor/template/ToBeDefined",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once you got created this template in your app update ID here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets follow up with this in a different PR so we can merge this one

@@ -92,7 +93,6 @@ const WebhookForm = (props: {
const [newSecret, setNewSecret] = useState("");
const [changeSecret, setChangeSecret] = useState<boolean>(false);
const hasSecretKey = !!props?.webhook?.secret;
// const currentSecret = props?.webhook?.secret;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cleaning

@@ -282,7 +282,7 @@ const WebhookForm = (props: {
<Button
type="submit"
disabled={!formMethods.formState.isDirty && !changeSecret}
loading={formMethods.formState.isSubmitting || formMethods.formState.isSubmitted}>
loading={formMethods.formState.isSubmitting}>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isSubmitted is bad here because after you submit and error happened you still will be seeing the loading.

@@ -451,3 +451,89 @@ export async function updateTriggerForExistingBookings(
);
await Promise.all(promise);
}

export async function listOOOEntries(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functions that helps zapier fetch and look data fields as example for Zap.

EventTypeInfo & {
metadata?: { [key: string]: string | number | boolean | null };
export type WebhookDataType = Partial<CalendarEvent> &
Partial<EventTypeInfo> & {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Partial as open a new path for webhooks that can include different set of data and not just bookings

@@ -17,33 +18,29 @@ type CreateOptions = {
};

export const createHandler = async ({ ctx, input }: CreateOptions) => {
const { user } = ctx;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cleaning since original file had a lot of redundancy

});
} catch (error) {
// Avoid printing raw prisma error on frontend
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No more prisma raw error on website

@github-actions github-actions bot added the 💎 Bounty A bounty on Algora.io label Jun 14, 2024
@dosubot dosubot bot added this to the v4.2 milestone Jun 14, 2024
@Udit-takkar Udit-takkar changed the title feat: OOO: webhook and zapier feat: OOO webhook and zapier Jun 14, 2024
@keithwillcode keithwillcode modified the milestones: v4.2, v4.3 Jun 17, 2024
@dosubot dosubot bot modified the milestones: v4.3, v4.4 Jun 17, 2024
@github-actions github-actions bot added the Low priority Created by Linear-GitHub Sync label Jun 18, 2024
@PeerRich PeerRich mentioned this pull request Jun 21, 2024
3 tasks
@PeerRich PeerRich modified the milestones: v4.4, v4.3 Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
app-store area: app store, apps, calendar integrations, google calendar, outlook, lark, apple calendar 🙋 Bounty claim 💎 Bounty A bounty on Algora.io community Created by Linear-GitHub Sync ✨ feature New feature or request Low priority Created by Linear-GitHub Sync ❗️ migrations contains migration files webhooks area: webhooks, callback, webhook payload
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CAL-3933] OOO: webhook and zapier
3 participants