deleteSession( )
Deletes a session from a schedule.
Description
The deleteSession()
function returns a Promise that resolves to a session ID when the session has been deleted.
Use the participantNotification
property to send an email to the participants when the session is deleted.
When deleting a session of type "EVENT"
where a booking exists, the booking's status is updated to "CANCELED"
.
To delete a set of recurring sessions, specify the session's recurringSessionId
in the sessionId
property in the parameters.
When deleting a recurrence, only future instances of the recurrence are deleted.
Note: Only users with Bookings Admin permissions can delete a session. You can override the permissions by setting the
suppressAuth
option totrue
.
Syntax
function deleteSession(sessionId: string, [options: DeleteSessionOptions]): Promise<string>
deleteSession Parameters
NAME
TYPE
DESCRIPTION
ID of the session to delete.
An object representing the available options for deleting a session.
Returns
Fulfilled - ID of the deleted session.
Return Type:
Was this helpful?
Delete a session.
12import { Permissions, webMethod } from "wix-web-module";3import { sessions } from "wix-bookings-backend";45export const myDeleteSession = webMethod(Permissions.Anyone, async (sessionId) => {6 const deleteSessionOptions = {7 suppressAuth: true,8 participantNotification: {9 notifyParticipants: true,10 },11 };12 try {13 const result = await sessions.deleteSession(sessionId, deleteSessionOptions);14 return result;15 } catch (error) {16 console.error("Delete session failed:", error);17 }18});1920/* Returns a Promise that resolves to a sessionId:21 *22 "4jOkD28c0FrsNUSgzQzuLRkA2t1rv1FLTwquKmJyctoZm00vdeKFMyH4n9cCLtmQe8wvOVwmsJCUCPWT3LA2geDOBViOg62YOeTGcgvAnGyw6uKEiNVqqdHt8QVz4i7qMZu5irOPVjACrV2o5F5SFkTukwrkodDkJBBtH3JaGj18FY3z9vvxDE0COr8D282JjVfq7YMAwQnTq4tYWYJkfPm7PDLI6zoWZREstI4jt6L0rFzLgnygdPd34xwV1XTWy29NYFXkahlmVNGcT28Psi8J35SjuXKVSpBiz8AbGJNwhVjBiZ8mSR1C8AqlOXknDFaYIQ2dd1Bsgub"23 *24 */25