[CAL-4491] [V2 Admin API] Add Missing Functionality to the Org Create Event Type Endpoint
Is your proposal related to a problem?
The v2 admin api org create event type endpoint is missing a few pieces of functionality:
- For booking fields, the ability to set field to disable the input if the URL identifier is prefilled.
- Ability to configure a recurring event.
- Ability to configure seats for an event.
- Ability to override the default booking fields (to change the display name for the
nameandemailfields).
Describe the solution you'd like
- In the
bookingFieldsarray of objects, add adisableIfPrefilled: booleanor similar field. - Add a new top level
recurringConfig?: { maxEvents: number, repeatConfig: { value: number, repeatInterval: "week" | "month" | "year"} }(or similar) field. - Add a new top level
seatsConfig?: { numSeats: number, shareAttendeeInfo: boolean, showNumberOfAvailableSeats: boolean }(or similar) field. - Allow overriding the default booking fields.
Describe alternatives you've considered
Right now we're having to create events via the api, then go to the UI to configure these fields. We're creating many different event types for our use case, so this is a time consuming process.
Additional context
N/A
Requirement/Document
N/A
House rules
- If this issue has a
🚨 needs approvallabel, don't start coding yet. Wait until a core member approves feature request by removing this label, then you can start coding.- For clarity: Non-core member issues automatically get the
🚨 needs approvallabel. - Your feature ideas are invaluable to us! However, they undergo review to ensure alignment with the product's direction.
- Follow Best Practices lined out in our Contributor Docs
- For clarity: Non-core member issues automatically get the
cc: @keithwillcode @supalarry @ThyMinimalDev Can we line it up please?
@SteveKekacs We have this PR in review that will allow:
- Specifying
disableOnPrefillproperty for each booking field. - Modify label, placeholder and
disableOnPrefillfor the default name and email fields. I think if you click on Linear ticket linked to the task there is more context available if you are interested.
As for specifying event type recurrence and seats, it is already possible if you check api docs for event types. Specifically recurrence and seats properties.
Great, thanks for the update @supalarry!
Hey @supalarry, just got around to testing this. the disableOnPrefill is working, but it looks like overriding the default name and email fields is not.
- It's returning a 400 BAD REQUEST (duplicate field name) error
- Though the event is getting created, but just with messed up fields
Request details
POST /v2/organizations/{ORG_ID}/teams/{TEAM_IDS}/event-types
Request Body: {
"lengthInMinutes": 60,
"title": "Intake",
"slug": "testing",
"description": "....",
"hosts": [],
"minimumBookingNotice": 4320,
"slotInterval": 30,
"locations": [
{
"type": "integration",
"integration": "cal-video"
}
],
"bookingFields": [
{
"type": "email",
"slug": "email",
"label": "Student Email",
"required": true,
"disableOnPrefill": true
},
{
"type": "text",
"slug": "name",
"label": "Student Name",
"required": true,
"disableOnPrefill": true
},
{
"type": "multiemail",
"slug": "guests",
"label": "Guardian Emails",
"required": false,
"disableOnPrefill": true
}
],
"customName": "{Event type title} between {HOST} and {ATTENDEE}",
"disableGuests": false,
"schedulingType": "ROUND_ROBIN",
"assignAllTeamMembers": false,
"beforeEventBuffer": 0,
"afterEventBuffer": 0,
"onlyShowFirstAvailableSlot": false,
"bookingLimitsCount": {},
"bookingLimitsDuration": {}
}
Response Body: {
"status": "error",
"timestamp": "2024-10-23T18:15:30.429Z",
"path": "/v2/organizations/16327/teams/17510/event-types",
"error": {
"code": "TRPCError",
"message": "Duplicate booking field name: name"
}
}
@SteveKekacs sorry for late reply missed your issue above.
The reason for 400 is that for name and email booking fields you need to skip slug and simply denote their type. The slug for name and email are set automatically later on and is not accepted as input, because the slug is fixed. In your case you need to submit:
{
"bookingFields": [
{
"type": "email",
"label": "Student Email",
"required": true,
"disableOnPrefill": true
},
{
"type": "name",
"label": "Student Name",
"required": true,
"disableOnPrefill": true
},
{
"type": "multiemail",
"slug": "guests",
"label": "Guardian Emails",
"required": false,
"disableOnPrefill": true
}
]
}
I confirm that with booking fields above it is a successful request.
@supalarry ah makes sense, thank you!
Hi @supalarry,
I'm still having issues with this. When I don't include the slug for name & email fields, I'm getting a 400 response on creating a new event:
Request:
{
...,
"bookingFields": [
{
"type": "email",
"label": "Student Email",
"required": true,
"disableOnPrefill": true
},
{
"type": "text",
"label": "Student Name",
"required": true,
"disableOnPrefill": true
}
]
}
Response
{
"status": "error",
"timestamp": "2024-11-21T12:58:17.853Z",
"path": "/v2/organizations/16327/teams/17510/event-types",
"error": {
"code": "BadRequestException",
"message": "Each booking field must have a 'slug' property.",
"details": {
"message": "Each booking field must have a 'slug' property.",
"error": "Bad Request",
"statusCode": 400
}
}
}
Hi @supalarry,
I'm still having issues with this. When I don't include the slug for name & email fields, I'm getting a 400 response on creating a new event:
Request: { ..., "bookingFields": [ { "type": "email", "label": "Student Email", "required": true, "disableOnPrefill": true }, { "type": "text", "label": "Student Name", "required": true, "disableOnPrefill": true } ] } Response { "status": "error", "timestamp": "2024-11-21T12:58:17.853Z", "path": "/v2/organizations/16327/teams/17510/event-types", "error": { "code": "BadRequestException", "message": "Each booking field must have a 'slug' property.", "details": { "message": "Each booking field must have a 'slug' property.", "error": "Bad Request", "statusCode": 400 } } }
Booking fields of type name and email don't need a slug, but all other ones do. In the code above we have type text but it has a missing slug. If you try with the following it should work:
...
{
"type": "text",
"slug": "student-name",
"label": "Student Name",
"required": true,
"disableOnPrefill": true
}
...
@supalarry ah I apologize 🤦♂️ missed that the name field type needs to be "name" not "text".
@supalarry ah I apologize 🤦♂️ missed that the name field type needs to be "name" not "text".
All good, glad to hear it's working! : )