Search.../

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 to true.

Syntax

function deleteSession(sessionId: string, [options: DeleteSessionOptions]): Promise<string>

deleteSession Parameters

NAME
TYPE
DESCRIPTION
sessionId
string

ID of the session to delete.

options
Optional
DeleteSessionOptions

An object representing the available options for deleting a session.

Returns

Fulfilled - ID of the deleted session.

Return Type:

Promise<string>

Was this helpful?

Delete a session.

Copy Code
1import { sessions } from "wix-bookings-backend";
2
3export function myDeleteSession(sessionId) {
4 const deleteSessionOptions = {
5 suppressAuth: true,
6 participantNotification: {
7 notifyParticipants: true
8 }
9 };
10 return sessions.deleteSession(sessionId, deleteSessionOptions)
11 .then((result) => {
12 return result;
13 })
14 .catch((error) => {
15 console.error("Delete session failed:", error);
16 });
17}
18
19/* Returns a Promise that resolves to a sessionId:
20 *
21 "4jOkD28c0FrsNUSgzQzuLRkA2t1rv1FLTwquKmJyctoZm00vdeKFMyH4n9cCLtmQe8wvOVwmsJCUCPWT3LA2geDOBViOg62YOeTGcgvAnGyw6uKEiNVqqdHt8QVz4i7qMZu5irOPVjACrV2o5F5SFkTukwrkodDkJBBtH3JaGj18FY3z9vvxDE0COr8D282JjVfq7YMAwQnTq4tYWYJkfPm7PDLI6zoWZREstI4jt6L0rFzLgnygdPd34xwV1XTWy29NYFXkahlmVNGcT28Psi8J35SjuXKVSpBiz8AbGJNwhVjBiZ8mSR1C8AqlOXknDFaYIQ2dd1Bsgub"
22 *
23 */