Skip to content

Commit 47c2fc3

Browse files
joeauyeungPeerRich
andauthored
Add contributing to app store doc - V2 (#2118)
* Add contributing to app store docs * Edit file structure diagram and fix build * Add doc to meta * Wrap example variabels in code block Co-authored-by: Peer Richelsen <peeroke@gmail.com>
1 parent 53b2027 commit 47c2fc3

File tree

3 files changed

+62
-12
lines changed

3 files changed

+62
-12
lines changed
+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
title: Contributing to App Store
3+
---
4+
5+
# Contributing to the App Store
6+
7+
Since Cal.com is open source we encourage developers to create new apps for others to use. This guide is to help you get started.
8+
9+
## Structure
10+
11+
All apps can be found under `packages/app-store`. In this folder is `_example` which shows the general structure of an app.
12+
13+
```sh
14+
├──_example
15+
| ├──index.ts
16+
| ├──package.json
17+
| ├──.env.example
18+
|
19+
| ├──api
20+
| | ├──example.ts
21+
| | ├──index.ts
22+
|
23+
| ├──lib
24+
| | ├──adaptor.ts
25+
| | ├──index.ts
26+
|
27+
| ├──static
28+
| | ├──icon.svg
29+
```
30+
31+
## Getting Started
32+
33+
In the `package.json` name your package appropriately and list the dependencies needed for the package.
34+
35+
Next in the `.env.example` specify the environmental variables (ex. auth token, API secrets) that your app will need. In a comment add a link to instructions on how to obtain the credentials. Create a `.env` with your the filled in environmental variables.
36+
37+
In `index.js` fill out the meta data that will be rendered on the app page. Under `packages/app-store/index.ts`, import your app and add it under `appStore`. Your app should now appear in the app store.
38+
39+
Under the `/api` folder, this is where any API calls that are associated with your app will be handled. Since cal.com uses Next.js we use dynamic API routes. In this example if we want to hit `/api/example.ts` the route would be `{BASE_URL}/api/integrations/_example/example`. Export your endpoints in an `index.ts` file under `/api` folder and import them in your main `index.ts` file.
40+
41+
The `/lib` folder is where the functions of your app live. For example, when creating a booking with a MS Teams link the function to make the call to grab the link lives in the `/lib` folder. Export your endpoints in an `index.ts` file under `/lib` folder and import them in your main `index.ts` file.
42+
43+
The `/static` folder is where your assets live.
44+
45+
If you need any help feel free to join us on [Slack](https://cal.com/slack)

apps/docs/pages/developer/meta.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
"code-styling": "Code styling",
55
"project-structure": "Project structure",
66
"pull-requests": "Pull requests",
7-
"adding-css": "Adding CSS"
7+
"adding-css": "Adding CSS",
8+
"app-store": "Contributing to App Store"
89
}

apps/docs/pages/webhooks.mdx

+15-11
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ title: Webhooks
33
---
44

55
# Webhooks
6+
67
## Create a new Webhook
78

89
1. Go to [Your Integrations](https://app.cal.com/integrations).
@@ -23,22 +24,27 @@ title: Webhooks
2324
3. Press the button and from here your webhook will no longer work and be deleted.
2425

2526
## Webhook metadata
27+
2628
Metadata is a way to pass extra information to Cal.com about a booking that is returned through a webhook.
2729

2830
### Example
31+
2932
The best way to explain this is with an example. Let's say you're a bank, and people register an account on your website, but you want them to book an onboarding call with your team to get set up. You could send them to your Cal.com booking link as part of your onboarding process, but when the webhook is returned, it may be difficult to match up which user booked a meeting with the user's account in your own database. Hence, you can pass a `user_id` value for instance as a URL parameter, which makes no difference to the booking process, but when the webhook is returned, you will receive the metadata as part of the webhook payload.
3033

3134
Metadata is passed as a URL parameter on top of your booking link and follows the following syntax:
35+
3236
```text
3337
metadata[key_name]=value
3438
```
3539

3640
For example, if your booking link is `cal.com/rick/quick-chat`, you can pass a user ID of 123 like so:
41+
3742
```text
3843
cal.com/rick/quick-chat?metadata[user_id]=123
3944
```
4045

4146
As a result, the webhook will be returned in this format:
47+
4248
```text
4349
{ <other event details>, metadata: { user_id: 123 } }
4450
```
@@ -47,10 +53,10 @@ As a result, the webhook will be returned in this format:
4753

4854
Customizable webhooks are a great way reduce the development effort and in many cases remove the need for a developer to build an additional integration service. Using a custom template you can easily decide what data you receive in your webhook endpoint, manage the payload and setup related workflows accordingly. Here’s a breakdown of the payload that you would receive via an incoming webhook.
4955

50-
### Webhook structure
56+
### Webhook structure
5157

5258
| Variable | Type | Description |
53-
|---------------------|----------|----------------------------------------------------------------------------------------|
59+
| ------------------- | -------- | -------------------------------------------------------------------------------------- |
5460
| triggerEvent | String | The name of the trigger event [BOOKING_CREATED, BOOKING_RESHEDULED, BOOKING_CANCELLED] |
5561
| createdAt | String | The time of the webhook trigger |
5662
| type | String | The event-type slug |
@@ -68,27 +74,25 @@ Customizable webhooks are a great way reduce the development effort and in many
6874
| team?.name | String | Name of the team booked |
6975
| team?.members | String[] | Members of the team booked |
7076

71-
### Person structure
77+
### Person structure
7278

7379
| Variable | Type | Description |
74-
|-----------------|--------|-----------------------------------------------------------------------|
80+
| --------------- | ------ | --------------------------------------------------------------------- |
7581
| name | String | Name of the individual |
7682
| email | String | Email of the individual |
7783
| timeZone | String | Timezone of the individual ("America/New_York", "Asia/Kolkata", etc.) |
7884
| language.locale | String | Locale of the individual ("en", "fr", etc.) |
7985

8086
### Example usage of variables for custom template:
8187

88+
```sh
8289
{
83-
90+
8491
"content": "A new event has been scheduled",
85-
"type": "{{type}}",
92+
"type": "{{type}}",
8693
"name": "{{title}}",
8794
"organizer": "{{organizer.name}}",
8895
"booker": "{{attendees.0.name}}"
89-
90-
}
91-
92-
93-
9496

97+
}
98+
```

0 commit comments

Comments
 (0)