createEvent( )
Creates a Wix event.
Description
The createEvent()
function returns a Promise that resolves to the newly-created Wix event after it has successfully been created.
When creating an event, you must define if the event is an RSVP event or a ticketed event. This is stored in the registration.initialType
property.
After the initial save, you can further define event registration details. If you change the event's registration to be external or unnecessary,
this is reflected in the registration.type
property. The registration.initialType
property after initial creation is read-only.
The new Wix event is created with a default registration form in the site's default language, using the site's default regional settings.
The default registration form includes input fields for first name, last name, and email. Keep in mind that the registration form for a ticketed event has different fields from the form for a non-ticketed event.
By default, the event is automatically configured to send daily summary reports of new registrations to the site's business email.
Only those with "Manage Events" permissions can create Wix events.
Note: This function requires elevated permissions to run.
This function is not universal and runs only on the backend.
Syntax
function createEvent(eventInfo: WixEventInfo, options: WixEventInfoOptions): Promise<WixEvent>
createEvent Parameters
NAME
TYPE
DESCRIPTION
Info used to create the Wix event.
Options to use when creating the Wix event.
Returns
Fulfilled - The created Wix event. Rejected - Error message.
Return Type:
NAME
TYPE
DESCRIPTION
Wix event ID.
Wix event location details.
Wix event scheduling details.
Wix event title.
Wix event description.
Rich-text (HTML) content for the "About Event" section.
The location of an image that represents the Wix event. This image is printed on the ticket (PDF format). The image file must be an image file from the Media Manager.
The URL format is:
wix:image://v1/<uri>/<filename>#originWidth=<width>&originHeight=<height>[&watermark=<watermark_manifest_string>]
URL-friendly version of the Wix event title. Unique across all Wix events in the same site.
ISO 639-1 language code of the Wix event. Use to translate content on forms, and so on.
Date the Wix event was created.
Date the Wix event was updated.
Wix event status. Defaults to "SCHEDULED"
.
One of:
"SCHEDULED"
. The upcoming Wix event is scheduled but has not yet started."STARTED"
. The Wix event has started and is in progress."ENDED"
. The Wix event has ended."CANCELED"
. The Wix event has been canceled.
Registration details for the Wix event.
"Add to calendar" URLs.
Event page URL components.
Registration form for the site guest to fill out with their contact details, and other information, as relevant.
Summaries of Wix event sales.
Guest list settings for the Wix event.
ID of the creator of the Wix event. If the creator is not logged in when creating the event, the createdBy
property is empty.
Online conferencing details for the Wix event.
The "Filter by:" drop-down option for filtering contacts by this event
in the Dashboard's Contact List page.
This read-only property is automatically populated to comprise a "custom" prefix, the title of the event, and other suffixes added for uniqueness. Note that even if
the title of an event is updated, the assignedContactsLabel
does not change.
Related Content:
Was this helpful?
This example creates a ticketed event.
12import { Permissions, webMethod } from 'wix-web-module';3import { wixEvents } from 'wix-events-backend';4import { elevate } from 'wix-auth';56/* Sample eventInfo value:78{9 title: "Nature's Symphony: A Musical Journey Through Wildlife.",10 description: "Immerse yourself in the enchanting harmony of nature's symphony as it intertwines with the power of music!",11 registration: {12 initialType: "TICKETS",13 restrictedTo: "VISITOR",14 tickets: {15 formAssignedPerTicket: false,16 tax: {17 type: "INCLUDED"18 }19 }20 },21 guestList: {22 public: true23 },24 about: "Join us for Nature's Symphony: A Musical Journey Through Wildlife at the iconic Royal Albert Hall.",25 location: {26 name: "Royal Albert Hall",27 address: {28 formatted: "Kensington Gore, London SW7, UK",29 location: {30 latitude: 51.5009132,31 longitude: -0.176608632 },33 city: "London",34 country: "GB",35 postalCode: "SW7 2BL",36 streetAddress: {37 name: "Kensington Gore",38 number: "SW7"39 }40 },41 type: "VENUE"42 },43 scheduling: {44 tbd: false,45 startDate: new Date("2024-09-14T19:00:00.000Z"),46 endDate: new Date ("2024-09-14T23:00:00.000Z"),47 timeZoneId: "Europe/Dublin",48 hideEndDate: false,49 showTimeZone: false50 }51}5253Sample options value:5455{56 "language": "de"57}5859*/6061export const myCreateEventFunction = webMethod(Permissions.Anyone, async (eventInfo, options) => {62 try {63 const elevatedCreateEvent = elevate(wixEvents.createEvent);64 const createdEvent = await elevatedCreateEvent(eventInfo, options);65 console.log('Success! CreatedEvent:', createdEvent);66 return createdEvent;67 } catch (error) {68 console.error(error);69 // Handle the error70 }71});7273/* Promise resolves to:74 {75 "about": "Join us for Nature's Symphony: A Musical Journey Through Wildlife at the iconic Royal Albert Hall.",76 "assignedContactsLabel": "custom.natures-symphony-a-musical-journey-through-wildlif",77 "calendarLinks": {78 "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",79 "ics": "https://www.wixevents.com/media/v2/calendar?token=JWS.eyJraWQiOiJpb21iOUJ0eSIsImFsZyI6IkhTMjU2In0.eyJkYXRhIjoie1wiaW5zdGFuY2VJZFwiOlwiMWY2ZGM5MDYtODAzZC00NjUwLTgzZjUtNzJlYTFkODgxMDBiXCIsXCJldmVudElkXCI6e1widmFsdWVcIjpcImMyNDFlNmUyLWM5NTEtNDQwZC04YjYyLTUyYTZlYzM4MjE0MFwifSxcIm9jTGlua1wiOm51bGx9IiwiaWF0IjoxNjk5NDUwMDE2fQ.2wZA5WH2TOR4f8M1QICFOu8oD4gX70jBaCRMCFQRbqI"80 },81 "categories": [],82 "createdBy": "8a8b9b73-4da8-47a5-8268-4396e68a0605",83 "_createdDate": "2023-07-13T12:52:00.911Z",84 "description": "Immerse yourself in the enchanting harmony of nature's symphony as it intertwines with the power of music!",85 "eventUrl": {86 "baseUrl": "https://mysite.com/events",87 "path": "/event-details-registration/natures-symphony-a-musical-journey-through-wildlife"88 },89 "form": {90 "inputGroups": [91 {92 "_id": "name",93 "inputs": [94 {95 "additionalLabels": [],96 "label": "First name",97 "maxLength": 50,98 "name": "firstName",99 "options": [],100 "required": true,101 "type": "TEXT"102 },103 {104 "additionalLabels": [],105 "label": "Last name",106 "maxLength": 50,107 "name": "lastName",108 "options": [],109 "required": true,110 "type": "TEXT"111 }112 ],113 "orderIndex": 0,114 "system": true,115 "type": "NAME"116 },117 {118 "_id": "email",119 "inputs": [120 {121 "additionalLabels": [],122 "label": "Email",123 "maxLength": 255,124 "name": "email",125 "options": [],126 "required": true,127 "type": "TEXT"128 }129 ],130 "orderIndex": 1,131 "system": true,132 "type": "INPUT"133 }134 ],135 "messages": {136 "checkout": {137 "checkoutLabel": "Continue",138 "title": "Add your details"139 },140 "registrationClosed": {141 "exploreEventsLabel": "See other events",142 "message": "Registration is closed"143 },144 "rsvp": {145 "noMessages": {146 "confirmationTitle": "Sorry You Can't Make It",147 "shareLabel": "Share",148 "title": "Add your details"149 },150 "rsvpNo": "Not Going",151 "rsvpYes": "I'm Going",152 "submitRsvpLabel": "SUBMIT",153 "waitingMessages": {154 "addToCalendarLabel": "Add to Calendar",155 "confirmationMessage": "We'll update you if additional spots become available.",156 "confirmationTitle": "Thanks! You've been added to the waitlist.",157 "shareLabel": "Share",158 "title": "Looks like this event is full. Join the waitlist."159 },160 "yesMessages": {161 "addToCalendarLabel": "Add to Calendar",162 "confirmationMessage": "An email with all the event info was sent to you.",163 "confirmationTitle": "Thank you!",164 "shareLabel": "Share",165 "title": "Add your details"166 }167 }168 }169 },170 "guestList": {171 "public": true172 },173 "_id": "c241e6e2-c951-440d-8b62-52a6ec382140",174 "language": "en",175 "location": {176 "address": {177 "formatted": "Kensington Gore, London SW7, UK",178 "location": {179 "latitude": 51.5009132,180 "longitude": -0.1766086181 },182 "city": "London",183 "country": "GB",184 "postalCode": "SW7 2BL",185 "streetAddress": {186 "name": "Kensington Gore",187 "number": "SW7",188 "apt": ""189 }190 },191 "name": "Royal Albert Hall",192 "tbd": false,193 "type": "VENUE"194 },195 "registration": {196 "initialType": "TICKETS",197 "restrictedTo": "VISITOR",198 "rsvp": {199 "responseOptions": "YES_ONLY",200 "waitlist": false201 },202 "status": "OPEN_TICKETS",203 "tickets": {204 "currency": "EUR",205 "formAssignedPerTicket": false,206 "highestTicketPrice": {207 "currency": "EUR",208 "value": "20.00"209 },210 "highestTicketPriceFormatted": "€20",211 "lowestTicketPrice": {212 "currency": "EUR",213 "value": "20.00"214 },215 "lowestTicketPriceFormatted": "€20",216 "tax": {}217 },218 "type": "TICKETS"219 },220 "scheduling": {221 "endDate": "2023-11-29T23:00:00.137Z",222 "formatted": "29 November 2023, 19:00–23:00",223 "hideEndDate": false,224 "showTimeZone": false,225 "startDate": "2023-11-29T19:00:00.000Z",226 "startDateFormatted": "29 November 2023",227 "startTimeFormatted": "19:00",228 "tbd": false,229 "timeZoneId": "Europe/Dublin"230 },231 "slug": "natures-symphony-a-musical-journey-through-wildlife",232 "status": "SCHEDULED",233 "summary": {234 "rsvp": {235 "noCount": 0,236 "totalRsvps": 0,237 "waitlistCount": 0,238 "yesCount": 0239 },240 "tickets": {241 "currencyLocked": false,242 "revenue": {},243 "totalOrders": 0,244 "totalSales": {},245 "totalTickets": 0246 }247 },248 "title": "Nature's Symphony: A Musical Journey Through Wildlife",249 "_updatedDate": "2023-11-08T13:22:57.000Z",250 "videoConferencing": {251 "session": {252 "guestLink": "https://www.wixevents.com/oc?join=JWS.eyJraWQiOiJpb21iOUJ0eSIsImFsZyI6IkhTMjU2In0.eyJkYXRhIjoie1wiYWN0aW9uXCI6XCJqb2luXCIsXCJpbnN0YW5jZUlkXCI6XCIxZjZkYzkwNi04MDNkLTQ2NTAtODNmNS03MmVhMWQ4ODEwMGJcIixcImV2ZW50SWRcIjpcImMyNDFlNmUyLWM5NTEtNDQwZC04YjYyLTUyYTZlYzM4MjE0MFwifSIsImlhdCI6MTY5OTQ1MDAxNn0.AfJHpzU54hY8M1oVB0KGe47GUSzOzkWBVpKTTWEXk5Y",253 "hostLink": "https://www.wixevents.com/oc?start=JWS.eyJraWQiOiJpb21iOUJ0eSIsImFsZyI6IkhTMjU2In0.eyJkYXRhIjoie1wiYWN0aW9uXCI6XCJzdGFydFwiLFwiaW5zdGFuY2VJZFwiOlwiMWY2ZGM5MDYtODAzZC00NjUwLTgzZjUtNzJlYTFkODgxMDBiXCIsXCJldmVudElkXCI6XCJjMjQxZTZlMi1jOTUxLTQ0MGQtOGI2Mi01MmE2ZWMzODIxNDBcIn0iLCJpYXQiOjE2OTk0NTAwMTZ9.VmvnxZHBL6cCyE0ZYRdAa6cCud8aNchTTrLJX0b-Mhs"254 }255 }256}257*/
This example creates a TBD ticketed event.
12import { Permissions, webMethod } from 'wix-web-module';3import { wixEvents } from 'wix-events-backend';4import { elevate } from 'wix-auth';56/* Sample eventInfo value:78{9 title: "Nature's Symphony: A Musical Journey Through Wildlife.",10 description: "Immerse yourself in the enchanting harmony of nature's symphony as it intertwines with the power of music!",11 registration: {12 initialType: "TICKETS",13 restrictedTo: "VISITOR",14 tickets: {15 formAssignedPerTicket: false,16 tax: {17 type: "INCLUDED"18 }19 }20 },21 guestList: {22 public: true23 },24 about: "Join us for Nature's Symphony: A Musical Journey Through Wildlife at the iconic Royal Albert Hall.",25 location: {26 name: "Royal Albert Hall",27 address: {28 formatted: "Kensington Gore, London SW7, UK",29 location: {30 latitude: 51.5009132,31 longitude: -0.176608632 },33 city: "London",34 country: "GB",35 postalCode: "SW7 2BL",36 streetAddress: {37 name: "Kensington Gore",38 number: "SW7"39 }40 },41 type: "VENUE"42 },43 scheduling: {44 tbd: true,45 tbdMessage: "The date will be announced soon, stay tuned!"46 hideEndDate: false,47 showTimeZone: false48 }49}5051Sample options value:5253{54 "language": "de"55}5657*/585960export const myCreateEventFunction = webMethod(Permissions.Anyone, async (eventInfo, options) => {61 try {62 const elevatedCreateEvent = elevate(wixEvents.createEvent);63 const createdEvent = await elevatedCreateEvent(eventInfo, options);64 console.log('Success! CreatedEvent:', createdEvent);65 return createdEvent;66 } catch (error) {67 console.error(error);68 // Handle the error69 }70});7172/* Promise resolves to:73 {74 "about": "Join us for Nature's Symphony: A Musical Journey Through Wildlife at the iconic Royal Albert Hall.",75 "assignedContactsLabel": "custom.natures-symphony-a-musical-journey-through-wildl",76 "calendarLinks": {77 "google": "http://calendar.google.com/calendar/render?action=TEMPLATE&text=Nature%27s+Symphony%3A+A+Musical+Journey+Through+Wildlife.&dates=&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.%0AThe+date+will+be+announced+soon%2C+stay+tuned%21%0ARoyal+Albert+Hall%2C+Kensington+Gore%2C+London+SW7%2C+UK",78 "ics": "https://www.wixevents.com/media/v2/calendar?token=JWS.eyJraWQiOiJpb21iOUJ0eSIsImFsZyI6IkhTMjU2In0.eyJkYXRhIjoie1wiaW5zdGFuY2VJZFwiOlwiMWY2ZGM5MDYtODAzZC00NjUwLTgzZjUtNzJlYTFkODgxMDBiXCIsXCJldmVudElkXCI6e1widmFsdWVcIjpcImQxNTJmNDJjLTcyMWMtNDc3MC1hMTc4LWYwZTZjMWQ1NWYyN1wifSxcIm9jTGlua1wiOm51bGx9IiwiaWF0IjoxNjk5NDU1OTczfQ.jRP6qkUbDv_HIfIEVFKmBB1cf2R5XdgF3X50gHNW-Go"79 },80 "categories": [],81 "createdBy": "",82 "_createdDate": "2023-11-08T15:06:13.353Z",83 "description": "Immerse yourself in the enchanting harmony of nature's symphony as it intertwines with the power of music!",84 "eventUrl": {85 "baseUrl": "https://mysite.com/events",86 "path": "/event-details-registration/natures-symphony-a-musical-journey-through-wildlife"87 },88 "form": {89 "inputGroups": [90 {91 "_id": "name",92 "inputs": [93 {94 "additionalLabels": [],95 "label": "First name",96 "maxLength": 50,97 "name": "firstName",98 "options": [],99 "required": true,100 "type": "TEXT"101 },102 {103 "additionalLabels": [],104 "label": "Last name",105 "maxLength": 50,106 "name": "lastName",107 "options": [],108 "required": true,109 "type": "TEXT"110 }111 ],112 "orderIndex": 0,113 "system": true,114 "type": "NAME"115 },116 {117 "_id": "email",118 "inputs": [119 {120 "additionalLabels": [],121 "label": "Email",122 "maxLength": 255,123 "name": "email",124 "options": [],125 "required": true,126 "type": "TEXT"127 }128 ],129 "orderIndex": 1,130 "system": true,131 "type": "INPUT"132 }133 ],134 "messages": {135 "checkout": {136 "checkoutLabel": "Continue",137 "title": "Add your details"138 },139 "registrationClosed": {140 "exploreEventsLabel": "See other events",141 "message": "Registration is closed"142 },143 "rsvp": {144 "noMessages": {145 "confirmationTitle": "Sorry You Can't Make It",146 "shareLabel": "Share",147 "title": "Add your details"148 },149 "rsvpNo": "Not Going",150 "rsvpYes": "I'm Going",151 "submitRsvpLabel": "SUBMIT",152 "waitingMessages": {153 "addToCalendarLabel": "Add to Calendar",154 "confirmationMessage": "We'll update you if additional spots become available.",155 "confirmationTitle": "Thanks! You've been added to the waitlist.",156 "shareLabel": "Share",157 "title": "Looks like this event is full. Join the waitlist."158 },159 "yesMessages": {160 "addToCalendarLabel": "Add to Calendar",161 "confirmationMessage": "An email with all the event info was sent to you.",162 "confirmationTitle": "Thank you!",163 "shareLabel": "Share",164 "title": "Add your details"165 }166 }167 }168 },169 "guestList": {170 "public": true171 },172 "_id": "d152f42c-721c-4770-a178-f0e6c1d55f27",173 "language": "en",174 "location": {175 "address": {176 "formatted": "Kensington Gore, London SW7, UK",177 "location": {178 "latitude": 51.5009132,179 "longitude": -0.1766086180 },181 "city": "London",182 "country": "GB",183 "postalCode": "SW7 2BL",184 "streetAddress": {185 "name": "Kensington Gore",186 "number": "SW7",187 "apt": ""188 }189 },190 "name": "Royal Albert Hall",191 "tbd": false,192 "type": "VENUE"193 },194 "registration": {195 "initialType": "TICKETS",196 "restrictedTo": "VISITOR",197 "rsvp": {198 "responseOptions": "YES_ONLY",199 "waitlist": false200 },201 "status": "CLOSED",202 "tickets": {203 "formAssignedPerTicket": false,204 "highestTicketPrice": {},205 "lowestTicketPrice": {},206 "tax": {}207 },208 "type": "TICKETS"209 },210 "scheduling": {211 "formatted": "The date will be announced soon, stay tuned!",212 "hideEndDate": false,213 "showTimeZone": false,214 "startDateFormatted": "",215 "startTimeFormatted": "",216 "tbd": true,217 "tbdMessage": "The date will be announced soon, stay tuned!"218 },219 "slug": "natures-symphony-a-musical-journey-through-wildlife-2",220 "status": "SCHEDULED",221 "summary": {222 "rsvp": {223 "noCount": 0,224 "totalRsvps": 0,225 "waitlistCount": 0,226 "yesCount": 0227 },228 "tickets": {229 "currencyLocked": false,230 "revenue": {},231 "totalOrders": 0,232 "totalSales": {},233 "totalTickets": 0234 }235 },236 "title": "Nature's Symphony: A Musical Journey Through Wildlife.",237 "_updatedDate": "2023-11-08T15:06:13.000Z",238 "videoConferencing": {239 "session": {240 "guestLink": "https://www.wixevents.com/oc?join=JWS.eyJraWQiOiJpb21iOUJ0eSIsImFsZyI6IkhTMjU2In0.eyJkYXRhIjoie1wiYWN0aW9uXCI6XCJqb2luXCIsXCJpbnN0YW5jZUlkXCI6XCIxZjZkYzkwNi04MDNkLTQ2NTAtODNmNS03MmVhMWQ4ODEwMGJcIixcImV2ZW50SWRcIjpcImQxNTJmNDJjLTcyMWMtNDc3MC1hMTc4LWYwZTZjMWQ1NWYyN1wifSIsImlhdCI6MTY5OTQ1NTk3M30.DSiViUeWe2Yr9aqWtdp_TCA97sUwfOmZ3uE8XyLmXQk",241 "hostLink": "https://www.wixevents.com/oc?start=JWS.eyJraWQiOiJpb21iOUJ0eSIsImFsZyI6IkhTMjU2In0.eyJkYXRhIjoie1wiYWN0aW9uXCI6XCJzdGFydFwiLFwiaW5zdGFuY2VJZFwiOlwiMWY2ZGM5MDYtODAzZC00NjUwLTgzZjUtNzJlYTFkODgxMDBiXCIsXCJldmVudElkXCI6XCJkMTUyZjQyYy03MjFjLTQ3NzAtYTE3OC1mMGU2YzFkNTVmMjdcIn0iLCJpYXQiOjE2OTk0NTU5NzN9.LZ5MYRXsUE-Pqzn4YtLJdAk7PXzKoJelPJvj1wUTjw8"242 }243 }244}245*/