Skip to content

Cal-snap-in | Team - Coolhead | By: Pratik Sharma #18

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions cal-snap-in/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
### Cal.com+ DevRev

The integration between Cal.com and DevRev aims to create a seamless scheduling experience that enhances developer productivity and collaboration. By linking Cal.com’s powerful scheduling capabilities with DevRev’s product management and support workflows, this integration will allow teams to automatically reflect their calendar events, such as bookings, cancellations, and reschedules, within the DevRev timeline and product parts.
This proposal outlines the key mappings, integration mechanics, core features, and API interactions required to build a robust Cal.com snap-in for DevRev.



Create a command that would add the cal.com in the discussions of ticket and issues

// A widget which can setup meeting with the Organiser

// Command -> TimelineEntry -> Widget -> Schedule
// Reschedule ->
// Cancel ->



// Syncing with DevRev internal gateway api

https://app.devrev.ai/api/gateway/internal/meetings.create


## Snap-in triggered by an external source: GitHub

Snap-in that adds a comment to the discussions tab of any part, which is configurable, from a GitHub push or commit event.

### Testing locally
You can test your code by adding test events under `src/fixtures` similar to the example event provided. You can add keyring values to the event payload to test API calls as well.

Once you have added the event, you can test your code by running:
```
npm install
npm run start -- --functionName=github_handler --fixturePath=github_event.json
```

### Adding external dependencies
You can add dependencies on external packages in package.json under the “dependencies” key. These dependencies will be made available to your function at runtime and testing.

### Linting

To check for lint errors, run the following command:

```bash
npm run lint
```

To automatically fix fixable lint errors, run:

```bash
npm run lint:fix
```

### Activating snap-ins
Once you are done with the testing, run the following commands to activate your snap-in:

1. Authenticate to devrev CLI
```
devrev profiles authenticate --org <devorg name> --usr <user email>
```
2. Create a snap_in_version
```
devrev snap_in_version create-one --path <template path> --create-package
```
3. Draft the snap_in
```
devrev snap_in draft
```
4. Update the snap_in
```
devrev snap_in update
```
5. Activate the snap_in
```
devrev snap_in activate
```
3 changes: 3 additions & 0 deletions cal-snap-in/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: [['@babel/preset-env', { targets: { node: 'current' } }], '@babel/preset-typescript'],
};
Binary file added cal-snap-in/build.tar.gz
Binary file not shown.
12 changes: 12 additions & 0 deletions cal-snap-in/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
collectCoverage: true,
coverageDirectory: 'coverage',
coverageReporters: ['text'],
coverageThreshold: {
'**/*': {
branches: 60,
},
},
preset: 'ts-jest',
testEnvironment: 'node',
};
70 changes: 70 additions & 0 deletions cal-snap-in/manifest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
version: "2"

name: Cal.com Integration new version
description: Reflects meeting from Cal.com in DevRev by sync with Meeting View .

service_account:
display_name: "Cal.com Bot"

inputs:
organization:
- name: cal_api_key
description: Cal API key
field_type: text
default_value: cal_live_XXXXXXXXXXXXXXXXX

event_sources:
organization:
- name: cal-app-source
type: flow-custom-webhook
description: Event coming from Cal app.
config:
policy: |
package rego
output = {"event": body, "event_key": event_key} {
body := input.request.body
event_key := "cal-event"
} else = {"response": response } {
response := {
"status_code": 400
}
}
setup_instructions: "Please copy the source URL from here: \n\n URL: `{{ source.trigger_url }}` \n\n add the api key in the configure on the right-left corner "


functions:
- name: cal_handler
description: Function to reflect cal activities on DevRev.
- name: cal_command_handler
description: Function handles the cal command in DevRev.
- name: render_widget
description: Function handles the snap-in actions.


commands:
- name: cal
namespace: devrev
description: Create a new Cal Widget
surfaces:
- surface: discussions
object_types:
- issue
- ticket
- part
- conversation
usage_hint: "text"
function: cal_command_handler

snap_kit_actions:
- name: cal_widget
description: Snap kit action for showing cal_widget created using `cal` command
function: render_widget


automations:
- name: cal-commit-tracker
source: cal-app-source
event_types:
- custom:cal-event
function: cal_handler

5 changes: 5 additions & 0 deletions cal-snap-in/nodemon.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"execMap": {
"ts": "ts-node"
}
}
Loading