chore: Org Team workflows endpoints [v2] (#21329)

* chore: workflow endpoints init

* chore: org teams workflow endpoints

* chore: org teams workflow endpoints

* chore: org teams workflow endpoints and tests

* chore: refactor and improvements

* chore: bump libraries

* remove empty module

* update docs and remove AI comments

* chore: only enable workflows for SCALE orgs atm

* bump libraries

* improve dtos

* add hashmaps of enums

* remove unnecessary isOptional

* fix docs

* code review fix controller

* improve docs

* sort steps and improve docs

* fix: add services and rename triggers

* chore: platform libraries bump

* chore: platform libraries bump
This commit is contained in:
Morgan authored and GitHub committed 2025-06-13 15:10:44 +02:00
1 parent 874973d78f
commit d7fd055171
23 files changed
+3596 -4

No files matched your search

+701
View File
@@ -4855,6 +4855,350 @@
"tags": ["Orgs / Teams / Users / Schedules"]
}
},
"/v2/organizations/{orgId}/teams/{teamId}/workflows": {
"get": {
"operationId": "OrganizationTeamWorkflowsController_getWorkflows",
"summary": "Get organization team workflows",
"parameters": [
{
"name": "Authorization",
"in": "header",
"description": "For non-platform customers - value must be `Bearer <token>` where `<token>` is api key prefixed with cal_",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "x-cal-secret-key",
"in": "header",
"description": "For platform customers - OAuth client secret key",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "x-cal-client-id",
"in": "header",
"description": "For platform customers - OAuth client ID",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "orgId",
"required": true,
"in": "path",
"schema": {
"type": "number"
}
},
{
"name": "teamId",
"required": true,
"in": "path",
"schema": {
"type": "number"
}
},
{
"name": "take",
"required": false,
"in": "query",
"description": "Maximum number of items to return",
"example": 25,
"schema": {
"minimum": 1,
"maximum": 250,
"default": 250,
"type": "number"
}
},
{
"name": "skip",
"required": false,
"in": "query",
"description": "Number of items to skip",
"example": 0,
"schema": {
"minimum": 0,
"default": 0,
"type": "number"
}
}
],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/GetWorkflowsOutput"
}
}
}
}
},
"tags": ["Orgs / Teams / Workflows"]
},
"post": {
"operationId": "OrganizationTeamWorkflowsController_createWorkflow",
"summary": "Create organization team workflow",
"parameters": [
{
"name": "Authorization",
"in": "header",
"description": "For non-platform customers - value must be `Bearer <token>` where `<token>` is api key prefixed with cal_",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "x-cal-secret-key",
"in": "header",
"description": "For platform customers - OAuth client secret key",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "x-cal-client-id",
"in": "header",
"description": "For platform customers - OAuth client ID",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "teamId",
"required": true,
"in": "path",
"schema": {
"type": "number"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateWorkflowDto"
}
}
}
},
"responses": {
"201": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/GetWorkflowOutput"
}
}
}
}
},
"tags": ["Orgs / Teams / Workflows"]
}
},
"/v2/organizations/{orgId}/teams/{teamId}/workflows/{workflowId}": {
"get": {
"operationId": "OrganizationTeamWorkflowsController_getWorkflowById",
"summary": "Get organization team workflow",
"parameters": [
{
"name": "Authorization",
"in": "header",
"description": "For non-platform customers - value must be `Bearer <token>` where `<token>` is api key prefixed with cal_",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "x-cal-secret-key",
"in": "header",
"description": "For platform customers - OAuth client secret key",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "x-cal-client-id",
"in": "header",
"description": "For platform customers - OAuth client ID",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "teamId",
"required": true,
"in": "path",
"schema": {
"type": "number"
}
},
{
"name": "workflowId",
"required": true,
"in": "path",
"schema": {
"type": "number"
}
}
],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/GetWorkflowOutput"
}
}
}
}
},
"tags": ["Orgs / Teams / Workflows"]
},
"patch": {
"operationId": "OrganizationTeamWorkflowsController_updateWorkflow",
"summary": "Update workflow",
"parameters": [
{
"name": "Authorization",
"in": "header",
"description": "For non-platform customers - value must be `Bearer <token>` where `<token>` is api key prefixed with cal_",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "x-cal-secret-key",
"in": "header",
"description": "For platform customers - OAuth client secret key",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "x-cal-client-id",
"in": "header",
"description": "For platform customers - OAuth client ID",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "teamId",
"required": true,
"in": "path",
"schema": {
"type": "number"
}
},
{
"name": "workflowId",
"required": true,
"in": "path",
"schema": {
"type": "number"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UpdateWorkflowDto"
}
}
}
},
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/GetWorkflowOutput"
}
}
}
}
},
"tags": ["Orgs / Teams / Workflows"]
},
"delete": {
"operationId": "OrganizationTeamWorkflowsController_deleteWorkflow",
"summary": "Delete organization team workflow",
"parameters": [
{
"name": "Authorization",
"in": "header",
"description": "For non-platform customers - value must be `Bearer <token>` where `<token>` is api key prefixed with cal_",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "x-cal-secret-key",
"in": "header",
"description": "For platform customers - OAuth client secret key",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "x-cal-client-id",
"in": "header",
"description": "For platform customers - OAuth client ID",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "teamId",
"required": true,
"in": "path",
"schema": {
"type": "number"
}
},
{
"name": "workflowId",
"required": true,
"in": "path",
"schema": {
"type": "number"
}
}
],
"responses": {
"200": {
"description": ""
}
},
"tags": ["Orgs / Teams / Workflows"]
}
},
"/v2/organizations/{orgId}/users": {
"get": {
"operationId": "OrganizationsUsersController_getOrganizationsUsers",
@@ -19406,6 +19750,363 @@
}
}
},
"WorkflowActivationOutputDto": {
"type": "object",
"properties": {
"isActiveOnAllEventTypes": {
"type": "boolean",
"default": false,
"description": "Whether the workflow is active for all event types associated with the team/user",
"example": false
},
"activeOnEventTypeIds": {
"description": "List of Event Type IDs the workflow is specifically active on (if not active on all)",
"example": [698191, 698192],
"type": "array",
"items": {
"type": "number"
}
}
}
},
"WorkflowTriggerOffsetOutputDto": {
"type": "object",
"properties": {
"value": {
"type": "number",
"description": "Time value for offset",
"example": 24
},
"unit": {
"type": "string",
"description": "Unit for the offset time",
"example": "hour",
"enum": ["hour", "minute", "day"]
}
},
"required": ["value", "unit"]
},
"WorkflowTriggerOutputDto": {
"type": "object",
"properties": {
"type": {
"type": "string",
"description": "Trigger type for the workflow",
"example": "beforeEvent",
"enum": [
"beforeEvent",
"eventCancelled",
"newEvent",
"afterEvent",
"rescheduleEvent",
"afterHostsCalVideoNoShow",
"afterGuestsCalVideoNoShow"
]
},
"offset": {
"description": "Offset details (present for BEFORE_EVENT/AFTER_EVENT)",
"allOf": [
{
"$ref": "#/components/schemas/WorkflowTriggerOffsetOutputDto"
}
]
}
},
"required": ["type"]
},
"WorkflowMessageOutputDto": {
"type": "object",
"properties": {
"subject": {
"type": "string",
"description": "Subject of the message",
"example": "Reminder: Your Meeting {EVENT_NAME} - {EVENT_DATE_ddd, MMM D, YYYY h:mma} with Cal.com"
},
"html": {
"type": "string",
"description": "HTML content of the message",
"example": "<p>Reminder for {EVENT_NAME}.</p>"
},
"text": {
"type": "string",
"description": "Text content of the message (used for SMS/WhatsApp)",
"example": "Reminder for {EVENT_NAME}."
}
},
"required": ["subject"]
},
"WorkflowStepOutputDto": {
"type": "object",
"properties": {
"id": {
"type": "number",
"description": "Unique identifier of the step",
"example": 67244
},
"stepNumber": {
"type": "number",
"description": "Step number in the workflow sequence",
"example": 1
},
"action": {
"type": "string",
"description": "Action to perform",
"example": "email_host",
"enum": [
"email_host",
"email_attendee",
"email_address",
"sms_attendee",
"sms_number",
"whatsapp_attendee",
"whatsapp_number"
]
},
"recipient": {
"type": "string",
"description": "Intended recipient type",
"example": "const",
"enum": ["const", "attendee", "email", "phone_number"]
},
"email": {
"type": "string",
"description": "Verified Email if action is EMAIL_ADDRESS",
"example": 31214
},
"phone": {
"type": "string",
"description": "Verified Phone if action is SMS_NUMBER or WHATSAPP_NUMBER"
},
"template": {
"type": "string",
"description": "Template type used",
"example": "reminder",
"enum": ["reminder", "custom", "rescheduled", "completed", "rating", "cancelled"]
},
"includeCalendarEvent": {
"type": "object",
"default": false,
"description": "Whether a calendar event (.ics) was included (for email actions)",
"example": true
},
"sender": {
"type": "string",
"description": "Displayed sender name used for this step",
"example": "Cal.com Notifications"
},
"message": {
"description": "Message content for this step",
"allOf": [
{
"$ref": "#/components/schemas/WorkflowMessageOutputDto"
}
]
}
},
"required": ["id", "stepNumber", "action", "recipient", "template", "sender", "message"]
},
"WorkflowOutput": {
"type": "object",
"properties": {
"id": {
"type": "number",
"description": "Unique identifier of the workflow",
"example": 101
},
"name": {
"type": "string",
"description": "Name of the workflow",
"example": "Platform Test Workflow"
},
"userId": {
"type": "number",
"description": "ID of the user who owns the workflow (if not team-owned)",
"example": 2313
},
"teamId": {
"type": "number",
"description": "ID of the team owning the workflow",
"example": 4214321
},
"activation": {
"description": "Activation settings (scope)",
"allOf": [
{
"$ref": "#/components/schemas/WorkflowActivationOutputDto"
}
]
},
"trigger": {
"description": "Trigger configuration",
"allOf": [
{
"$ref": "#/components/schemas/WorkflowTriggerOutputDto"
}
]
},
"steps": {
"description": "Steps comprising the workflow",
"type": "array",
"items": {
"$ref": "#/components/schemas/WorkflowStepOutputDto"
}
},
"createdAt": {
"type": "object",
"description": "Timestamp of creation",
"example": "2024-05-12T10:00:00.000Z"
},
"updatedAt": {
"type": "object",
"description": "Timestamp of last update",
"example": "2024-05-12T11:30:00.000Z"
}
},
"required": ["id", "name", "activation", "trigger", "steps"]
},
"GetWorkflowsOutput": {
"type": "object",
"properties": {
"status": {
"type": "string",
"description": "Indicates the status of the response",
"example": "success",
"enum": ["success", "error"]
},
"data": {
"description": "List of workflows",
"type": "array",
"items": {
"$ref": "#/components/schemas/WorkflowOutput"
}
}
},
"required": ["status", "data"]
},
"GetWorkflowOutput": {
"type": "object",
"properties": {
"status": {
"type": "string",
"description": "Indicates the status of the response",
"example": "success",
"enum": ["success", "error"]
},
"data": {
"description": "workflow",
"type": "array",
"items": {
"$ref": "#/components/schemas/WorkflowOutput"
}
}
},
"required": ["status", "data"]
},
"WorkflowActivationDto": {
"type": "object",
"properties": {
"isActiveOnAllEventTypes": {
"type": "boolean",
"default": false,
"description": "Whether the workflow is active for all the event-types",
"example": false
},
"activeOnEventTypeIds": {
"default": [],
"description": "List of event-types IDs the workflow applies to, required if isActiveOnAllEventTypes is false",
"example": [698191],
"type": "array",
"items": {
"type": "number"
}
}
},
"required": ["isActiveOnAllEventTypes"]
},
"CreateWorkflowDto": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Name of the workflow",
"example": "Platform Test Workflow"
},
"activation": {
"description": "Activation settings for the workflow",
"allOf": [
{
"$ref": "#/components/schemas/WorkflowActivationDto"
}
]
},
"trigger": {
"type": "object",
"description": "Trigger configuration for the workflow",
"items": {
"oneOf": [
{
"$ref": "#/components/schemas/OnBeforeEventTriggerDto"
},
{
"$ref": "#/components/schemas/OnAfterEventTriggerDto"
},
{
"$ref": "#/components/schemas/OnCancelTriggerDto"
},
{
"$ref": "#/components/schemas/OnCreationTriggerDto"
},
{
"$ref": "#/components/schemas/OnRescheduleTriggerDto"
},
{
"$ref": "#/components/schemas/OnAfterCalVideoGuestsNoShowTriggerDto"
},
{
"$ref": "#/components/schemas/OnAfterCalVideoHostsNoShowTriggerDto"
}
]
}
},
"steps": {
"description": "Steps to execute as part of the workflow",
"items": {
"type": "object"
},
"type": "array"
}
},
"required": ["name", "activation", "trigger", "steps"]
},
"UpdateWorkflowDto": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Name of the workflow",
"example": "Platform Test Workflow"
},
"activation": {
"description": "Activation settings for the workflow, the action that will trigger the workflow.",
"allOf": [
{
"$ref": "#/components/schemas/WorkflowActivationDto"
}
]
},
"steps": {
"description": "Steps to execute as part of the workflow",
"items": {
"type": "object"
},
"type": "array"
},
"trigger": {
"type": "object"
}
},
"required": ["trigger"]
},
"StripConnectOutputDto": {
"type": "object",
"properties": {