You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* 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>
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)
Copy file name to clipboardexpand all lines: apps/docs/pages/webhooks.mdx
+15-11
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,7 @@ title: Webhooks
3
3
---
4
4
5
5
# Webhooks
6
+
6
7
## Create a new Webhook
7
8
8
9
1. Go to [Your Integrations](https://app.cal.com/integrations).
@@ -23,22 +24,27 @@ title: Webhooks
23
24
3. Press the button and from here your webhook will no longer work and be deleted.
24
25
25
26
## Webhook metadata
27
+
26
28
Metadata is a way to pass extra information to Cal.com about a booking that is returned through a webhook.
27
29
28
30
### Example
31
+
29
32
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.
30
33
31
34
Metadata is passed as a URL parameter on top of your booking link and follows the following syntax:
35
+
32
36
```text
33
37
metadata[key_name]=value
34
38
```
35
39
36
40
For example, if your booking link is `cal.com/rick/quick-chat`, you can pass a user ID of 123 like so:
41
+
37
42
```text
38
43
cal.com/rick/quick-chat?metadata[user_id]=123
39
44
```
40
45
41
46
As a result, the webhook will be returned in this format:
@@ -47,10 +53,10 @@ As a result, the webhook will be returned in this format:
47
53
48
54
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.
0 commit comments