Updates a Wix event.
The updateEvent()
function returns a Promise that resolves to the newly-updated Wix event after the Wix event is successfully updated.
Updating a Wix event does not impact existing guests or generated tickets, orders, and invoices.
Updating the title
of a Wix event automatically updates the event's slug
and eventUrl.path
.
Only those with "Manage Events" permissions can update Wix events.
Note: This function requires elevated permissions to run.
This function is not universal and runs only on the backend.
function updateEvent(
eventId: string,
eventInfo: WixEventUpdateInfo,
options: WixEventInfoOptions,
): Promise<WixEvent>;
Event ID.
Info used to update the Wix event.
Options to use when updating the Wix event.
This example demonstrates how to update a TBD event once the date is known. In
addition to updating the date, we set the scheduling.tbd
field to false
.
import { Permissions, webMethod } from "wix-web-module";
import { wixEvents } from "wix-events-backend";
import { elevate } from "wix-auth";
/* Sample eventId value: '3d3d5c04-ece0-45a8-85f0-11a58edaa192'
Sample eventInfo value:
{
scheduling: {
tbd: false,
startDate: new Date("2024-09-14T19:00:00.000Z"),
endDate: new Date ("2024-09-14T23:00:00.000Z"),
timeZoneId: "Europe/Dublin",
hideEndDate: false,
showTimeZone: false
}
}
*/
export const myUpdateEventFunction = webMethod(
Permissions.Anyone,
async (eventId, eventInfo, options) => {
try {
const elevatedUpdateEvent = elevate(wixEvents.updateEvent);
const updatedEvent = await elevatedUpdateEvent(
eventId,
eventInfo,
options,
);
console.log("Success! Updated event:", updatedEvent);
return updatedEvent;
} catch (error) {
console.error(error);
// Handle the error
}
},
);
/* Promise resolves to:
{
"about": "Join us for Nature's Symphony: A Musical Journey Through Wildlife at the iconic Royal Albert Hall.",
"assignedContactsLabel": "custom.natures-symphony-a-musical-journey-through-wildlif",
"calendarLinks": {
"google": "http://calendar.google.com/calendar/render?action=TEMPLATE&text=Nature%27s+Symphony%3A+A+Musical+Journey+Through+Wildlife&dates=20231129T190000Z%2F20231129T230000Z&location=Kensington+Gore%2C+London+SW7%2C+UK&details=Thank+you+for+registering+to+our+event%21+Your+tickets+are+attached+to+this+email.+Don%27t+forget+to+bring+them.%0A%0AWe%27re+looking+forward+to+seeing+you+there.%0A%0AHere+are+the+details%3A%0A%0ANature%27s+Symphony%3A+A+Musical+Journey+Through+Wildlife%0A29+November+2023%2C+19%3A00%E2%80%9323%3A00%0ARoyal+Albert+Hall%2C+Kensington+Gore%2C+London+SW7%2C+UK",
"ics": "https://www.wixevents.com/media/v2/calendar?token=JWS.eyJraWQiOiJpb21iOUJ0eSIsImFsZyI6IkhTMjU2In0.eyJkYXRhIjoie1wiaW5zdGFuY2VJZFwiOlwiMWY2ZGM5MDYtODAzZC00NjUwLTgzZjUtNzJlYTFkODgxMDBiXCIsXCJldmVudElkXCI6e1widmFsdWVcIjpcImMyNDFlNmUyLWM5NTEtNDQwZC04YjYyLTUyYTZlYzM4MjE0MFwifSxcIm9jTGlua1wiOm51bGx9IiwiaWF0IjoxNjk5NDUwMDE2fQ.2wZA5WH2TOR4f8M1QICFOu8oD4gX70jBaCRMCFQRbqI"
},
"categories": [],
"createdBy": "8a8b9b73-4da8-47a5-8268-4396e68a0605",
"_createdDate": "2023-07-13T12:52:00.911Z",
"description": "Immerse yourself in the enchanting harmony of nature's symphony as it intertwines with the power of music!",
"eventUrl": {
"baseUrl": "https://mysite.com/events",
"path": "/event-details-registration/natures-symphony-a-musical-journey-through-wildlife"
},
"form": {
"inputGroups": [
{
"_id": "name",
"inputs": [
{
"additionalLabels": [],
"label": "First name",
"maxLength": 50,
"name": "firstName",
"options": [],
"required": true,
"type": "TEXT"
},
{
"additionalLabels": [],
"label": "Last name",
"maxLength": 50,
"name": "lastName",
"options": [],
"required": true,
"type": "TEXT"
}
],
"orderIndex": 0,
"system": true,
"type": "NAME"
},
{
"_id": "email",
"inputs": [
{
"additionalLabels": [],
"label": "Email",
"maxLength": 255,
"name": "email",
"options": [],
"required": true,
"type": "TEXT"
}
],
"orderIndex": 1,
"system": true,
"type": "INPUT"
}
],
"messages": {
"checkout": {
"checkoutLabel": "Continue",
"title": "Add your details"
},
"registrationClosed": {
"exploreEventsLabel": "See other events",
"message": "Registration is closed"
},
"rsvp": {
"noMessages": {
"confirmationTitle": "Sorry You Can't Make It",
"shareLabel": "Share",
"title": "Add your details"
},
"rsvpNo": "Not Going",
"rsvpYes": "I'm Going",
"submitRsvpLabel": "SUBMIT",
"waitingMessages": {
"addToCalendarLabel": "Add to Calendar",
"confirmationMessage": "We'll update you if additional spots become available.",
"confirmationTitle": "Thanks! You've been added to the waitlist.",
"shareLabel": "Share",
"title": "Looks like this event is full. Join the waitlist."
},
"yesMessages": {
"addToCalendarLabel": "Add to Calendar",
"confirmationMessage": "An email with all the event info was sent to you.",
"confirmationTitle": "Thank you!",
"shareLabel": "Share",
"title": "Add your details"
}
}
}
},
"guestList": {
"public": true
},
"_id": "c241e6e2-c951-440d-8b62-52a6ec382140",
"language": "en",
"location": {
"address": {
"formatted": "Kensington Gore, London SW7, UK",
"location": {
"latitude": 51.5009132,
"longitude": -0.1766086
},
"city": "London",
"country": "GB",
"postalCode": "SW7 2BL",
"streetAddress": {
"name": "Kensington Gore",
"number": "SW7",
"apt": ""
}
},
"name": "Royal Albert Hall",
"tbd": false,
"type": "VENUE"
},
"registration": {
"initialType": "TICKETS",
"restrictedTo": "VISITOR",
"rsvp": {
"responseOptions": "YES_ONLY",
"waitlist": false
},
"status": "OPEN_TICKETS",
"tickets": {
"currency": "EUR",
"formAssignedPerTicket": false,
"highestTicketPrice": {
"currency": "EUR",
"value": "20.00"
},
"highestTicketPriceFormatted": "€20",
"lowestTicketPrice": {
"currency": "EUR",
"value": "20.00"
},
"lowestTicketPriceFormatted": "€20",
"tax": {}
},
"type": "TICKETS"
},
"scheduling": {
"endDate": "2023-11-29T23:00:00.137Z",
"formatted": "29 November 2023, 19:00–23:00",
"hideEndDate": false,
"showTimeZone": false,
"startDate": "2023-11-29T19:00:00.000Z",
"startDateFormatted": "29 November 2023",
"startTimeFormatted": "19:00",
"tbd": false,
"timeZoneId": "Europe/Dublin"
},
"slug": "natures-symphony-a-musical-journey-through-wildlife",
"status": "SCHEDULED",
"summary": {
"rsvp": {
"noCount": 0,
"totalRsvps": 0,
"waitlistCount": 0,
"yesCount": 0
},
"tickets": {
"currencyLocked": false,
"revenue": {},
"totalOrders": 0,
"totalSales": {},
"totalTickets": 0
}
},
"title": "Nature's Symphony: A Musical Journey Through Wildlife",
"_updatedDate": "2023-11-09T15:00:54.345Z",
"videoConferencing": {
"session": {
"guestLink": "https://www.wixevents.com/oc?join=JWS.eyJraWQiOiJpb21iOUJ0eSIsImFsZyI6IkhTMjU2In0.eyJkYXRhIjoie1wiYWN0aW9uXCI6XCJqb2luXCIsXCJpbnN0YW5jZUlkXCI6XCIxZjZkYzkwNi04MDNkLTQ2NTAtODNmNS03MmVhMWQ4ODEwMGJcIixcImV2ZW50SWRcIjpcImMyNDFlNmUyLWM5NTEtNDQwZC04YjYyLTUyYTZlYzM4MjE0MFwifSIsImlhdCI6MTY5OTQ1MDAxNn0.AfJHpzU54hY8M1oVB0KGe47GUSzOzkWBVpKTTWEXk5Y",
"hostLink": "https://www.wixevents.com/oc?start=JWS.eyJraWQiOiJpb21iOUJ0eSIsImFsZyI6IkhTMjU2In0.eyJkYXRhIjoie1wiYWN0aW9uXCI6XCJzdGFydFwiLFwiaW5zdGFuY2VJZFwiOlwiMWY2ZGM5MDYtODAzZC00NjUwLTgzZjUtNzJlYTFkODgxMDBiXCIsXCJldmVudElkXCI6XCJjMjQxZTZlMi1jOTUxLTQ0MGQtOGI2Mi01MmE2ZWMzODIxNDBcIn0iLCJpYXQiOjE2OTk0NTAwMTZ9.VmvnxZHBL6cCyE0ZYRdAa6cCud8aNchTTrLJX0b-Mhs"
}
}
}
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.