copyEvent( )


Copies a Wix event.

The copyEvent() function returns a Promise that resolves to the newly-copied Wix event after it has successfully been copied.

This function copies a Wix event, including its registration form, notifications, and ticket settings. The newly-copied event is scheduled two weeks from the date of the original event.

When copying Wix events:

  • If your site has multilingual enabled, and your event has additional, translated elements (such as registration messages), the translated elements are also copied to the new event.
  • When an event with same title already exists, the title of the newly-copied event has a numeric suffix in parentheses appended to it. For example: Copying an event titled "My Event" creates "My Event (1)".
  • Very long event titles are cropped: For example: "Daily stand-up ev... (2)". The maximum number of characters allowed is 120, which includes the suffix identifying the copy of the event.

The onEventCreated( ) event handler runs when a Wix event is copied. The received CreatedEvent object contains information about the new Wix event that was copied.

Only those with "Manage Events" permissions can copy Wix events.

Note: This function requires elevated permissions to run.

This function is not universal and runs only on the backend.

Method Declaration
Copy
function copyEvent(eventId: string): Promise<WixEvent>;
Method Parameters
eventIdstringRequired

Event ID.

Returns
Return Type:Promise<WixEvent>
Copy a Wix event
JavaScript
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'; */ export const myCopyEventFunction = webMethod( Permissions.Anyone, async (eventId) => { try { const elevatedCopyEvent = elevate(wixEvents.copyEvent); const copiedEvent = await elevatedCopyEvent(eventId); console.log("Success! Copied event:", copiedEvent); return copiedEvent; } catch (error) { console.error(error); // Handle the error } }, ); /* Promise resolves to: { "about": "Learn to design and handmake your own custom, leather sandals from scratch.", "assignedContactsLabel": "custom.artisanal-leather-shoemaking-for-beginners-a-cou-4", "calendarLinks": { "google": "http://calendar.google.com/calendar/render?action=TEMPLATE&text=Artisanal+Leather+Shoemaking+for+Beginners%2C+A+course+by+Marta+Grau+%282%29&dates=&location=Washington%2C+USA&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%0AArtisanal+Leather+Shoemaking+for+Beginners%2C+A+course+by+Marta+Grau+%282%29%0ATime+is+TBD%0AOnline%2C+Washington%2C+USA", "ics": "https://www.wixevents.com/media/v2/calendar?token=JWS.eyJraWQiOiJpb21iOUJ0eSIsImFsZyI6IkhTMjU2In0.eyJkYXRhIjoie1wiaW5zdGFuY2VJZFwiOlwiMWY2ZGM5MDYtODAzZC00NjUwLTgzZjUtNzJlYTFkODgxMDBiXCIsXCJldmVudElkXCI6e1widmFsdWVcIjpcIjRlNWU0YWRiLTk3NzgtNDE3MS1hOWJiLTQ0ZTI3ODM0YWM4OVwifSxcIm9jTGlua1wiOm51bGx9IiwiaWF0IjoxNjk5NDQ4MTg4fQ.VeW4d5EuToAZ0A53h8kHEmmjUQdulyU-EOuAu4oZ0FE" }, "categories": [], "createdBy": "", "_createdDate": "2023-11-08T12:56:28.545Z", "description": "", "eventUrl": { "baseUrl": "https://mysite.com/events", "path": "/event-details-registration/artisanal-leather-shoemaking-for-beginners-a-course-by-marta-grau-2" }, "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 waiting list" }, "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": "4e5e4adb-9778-4171-a9bb-44e27834ac89", "language": "en", "location": { "address": { "formatted": "Washington, USA", "location": { "latitude": 47.7510741, "longitude": -120.7401386 }, "subdivision": "WA", "country": "US", "streetAddress": { "name": "", "number": "", "apt": "" } }, "name": "Online", "tbd": false, "type": "VENUE" }, "mainImage": "wix:image://v1/8a8b9b_c91a236e494c4e66b771b1acf59021ff~mv2.webp/file#originWidth=1280&originHeight=720", "registration": { "initialType": "TICKETS", "restrictedTo": "VISITOR", "rsvp": { "responseOptions": "YES_ONLY", "waitlist": false }, "status": "CLOSED", "tickets": { "currency": "EUR", "formAssignedPerTicket": false, "highestTicketPrice": {}, "lowestTicketPrice": { "currency": "EUR", "value": "0.00" }, "lowestTicketPriceFormatted": "€0", "tax": {} }, "type": "TICKETS" }, "scheduling": { "formatted": "Time is TBD", "hideEndDate": false, "showTimeZone": false, "startDateFormatted": "", "startTimeFormatted": "", "tbd": true, "tbdMessage": "Time is TBD" }, "slug": "artisanal-leather-shoemaking-for-beginners-a-course-by-marta-grau-2", "status": "SCHEDULED", "summary": { "rsvp": { "noCount": 0, "totalRsvps": 0, "waitlistCount": 0, "yesCount": 0 }, "tickets": { "currencyLocked": false, "revenue": {}, "totalOrders": 0, "totalSales": {}, "totalTickets": 0 } }, "title": "Artisanal Leather Shoemaking for Beginners, A course by Marta Grau (2)", "_updatedDate": "2023-11-08T12:56:28.000Z", "videoConferencing": { "session": { "guestLink": "https://www.wixevents.com/oc?join=JWS.eyJraWQiOiJpb21iOUJ0eSIsImFsZyI6IkhTMjU2In0.eyJkYXRhIjoie1wiYWN0aW9uXCI6XCJqb2luXCIsXCJpbnN0YW5jZUlkXCI6XCIxZjZkYzkwNi04MDNkLTQ2NTAtODNmNS03MmVhMWQ4ODEwMGJcIixcImV2ZW50SWRcIjpcIjRlNWU0YWRiLTk3NzgtNDE3MS1hOWJiLTQ0ZTI3ODM0YWM4OVwifSIsImlhdCI6MTY5OTQ0ODE4OH0.l4M7dk9tCmOtfLpwJC7AfHlVfzMbqsDNqr5ne-Y_ry8", "hostLink": "https://www.wixevents.com/oc?start=JWS.eyJraWQiOiJpb21iOUJ0eSIsImFsZyI6IkhTMjU2In0.eyJkYXRhIjoie1wiYWN0aW9uXCI6XCJzdGFydFwiLFwiaW5zdGFuY2VJZFwiOlwiMWY2ZGM5MDYtODAzZC00NjUwLTgzZjUtNzJlYTFkODgxMDBiXCIsXCJldmVudElkXCI6XCI0ZTVlNGFkYi05Nzc4LTQxNzEtYTliYi00NGUyNzgzNGFjODlcIn0iLCJpYXQiOjE2OTk0NDgxODh9.bFuTU4SXSL8BuDV7uA3dLw2dfZa9y4KKWpmPxhNo81M" } } } */
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?