Search.../

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
eventInfo
WixEventInfo

Info used to create the Wix event.

options
WixEventInfoOptions

Options to use when creating the Wix event.

Returns

Fulfilled - The created Wix event. Rejected - Error message.

Return Type:

Promise<WixEvent>
NAME
TYPE
DESCRIPTION
_id
string

Wix event ID.

location
Location

Wix event location details.

scheduling
Scheduling

Wix event scheduling details.

title
string

Wix event title.

description
string

Wix event description.

about
string

Rich-text (HTML) content for the "About Event" section.

mainImage
string

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>]

slug
string

URL-friendly version of the Wix event title. Unique across all Wix events in the same site.

language
string

ISO 639-1 language code of the Wix event. Use to translate content on forms, and so on.

_createdDate
Date

Date the Wix event was created.

_updatedDate
Date

Date the Wix event was updated.

status
string

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
Registration

Registration details for the Wix event.

calendarLinks
CalendarLinks

"Add to calendar" URLs.

eventUrl
SiteUrl

Event page URL components.

form
Form

Registration form for the site guest to fill out with their contact details, and other information, as relevant.

summary
Summaries

Summaries of Wix event sales.

guestList
GuestListSettings

Guest list settings for the Wix event.

createdBy
string

ID of the creator of the Wix event. If the creator is not logged in when creating the event, the createdBy property is empty.

videoConferencing
OnlineConferencing

Online conferencing details for the Wix event.

assignedContactsLabel
string

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?

Create a Wix event

This example creates a ticketed event.

Copy Code
1import { wixEvents } from "wix-events-backend";
2import { elevate } from "wix-auth";
3
4/* Sample eventInfo value:
5
6{
7 title: "Nature's Symphony: A Musical Journey Through Wildlife.",
8 description: "Immerse yourself in the enchanting harmony of nature's symphony as it intertwines with the power of music!",
9 registration: {
10 initialType: "TICKETS",
11 restrictedTo: "VISITOR",
12 tickets: {
13 formAssignedPerTicket: false,
14 tax: {
15 type: "INCLUDED"
16 }
17 }
18 },
19 guestList: {
20 public: true
21 },
22 about: "Join us for Nature's Symphony: A Musical Journey Through Wildlife at the iconic Royal Albert Hall.",
23 location: {
24 name: "Royal Albert Hall",
25 address: {
26 formatted: "Kensington Gore, London SW7, UK",
27 location: {
28 latitude: 51.5009132,
29 longitude: -0.1766086
30 },
31 city: "London",
32 country: "GB",
33 postalCode: "SW7 2BL",
34 streetAddress: {
35 name: "Kensington Gore",
36 number: "SW7"
37 }
38 },
39 type: "VENUE"
40 },
41 scheduling: {
42 tbd: false,
43 startDate: new Date("2024-09-14T19:00:00.000Z"),
44 endDate: new Date ("2024-09-14T23:00:00.000Z"),
45 timeZoneId: "Europe/Dublin",
46 hideEndDate: false,
47 showTimeZone: false
48 }
49}
50
51Sample options value:
52
53{
54 "language": "de"
55}
56
57*/
58
59export async function myCreateEventFunction(eventInfo, options) {
60 try {
61 const elevatedCreateEvent = elevate(wixEvents.createEvent);
62 const createdEvent = await elevatedCreateEvent(eventInfo, options);
63 console.log('Success! CreatedEvent:', createdEvent);
64 return createdEvent;
65 } catch (error) {
66 console.error(error);
67 // Handle the error
68 }
69}
70
71/* Promise resolves to:
72 {
73 "about": "Join us for Nature's Symphony: A Musical Journey Through Wildlife at the iconic Royal Albert Hall.",
74 "assignedContactsLabel": "custom.natures-symphony-a-musical-journey-through-wildlif",
75 "calendarLinks": {
76 "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",
77 "ics": "https://www.wixevents.com/media/v2/calendar?token=JWS.eyJraWQiOiJpb21iOUJ0eSIsImFsZyI6IkhTMjU2In0.eyJkYXRhIjoie1wiaW5zdGFuY2VJZFwiOlwiMWY2ZGM5MDYtODAzZC00NjUwLTgzZjUtNzJlYTFkODgxMDBiXCIsXCJldmVudElkXCI6e1widmFsdWVcIjpcImMyNDFlNmUyLWM5NTEtNDQwZC04YjYyLTUyYTZlYzM4MjE0MFwifSxcIm9jTGlua1wiOm51bGx9IiwiaWF0IjoxNjk5NDUwMDE2fQ.2wZA5WH2TOR4f8M1QICFOu8oD4gX70jBaCRMCFQRbqI"
78 },
79 "categories": [],
80 "createdBy": "8a8b9b73-4da8-47a5-8268-4396e68a0605",
81 "_createdDate": "2023-07-13T12:52:00.911Z",
82 "description": "Immerse yourself in the enchanting harmony of nature's symphony as it intertwines with the power of music!",
83 "eventUrl": {
84 "baseUrl": "https://mysite.com/events",
85 "path": "/event-details-registration/natures-symphony-a-musical-journey-through-wildlife"
86 },
87 "form": {
88 "inputGroups": [
89 {
90 "_id": "name",
91 "inputs": [
92 {
93 "additionalLabels": [],
94 "label": "First name",
95 "maxLength": 50,
96 "name": "firstName",
97 "options": [],
98 "required": true,
99 "type": "TEXT"
100 },
101 {
102 "additionalLabels": [],
103 "label": "Last name",
104 "maxLength": 50,
105 "name": "lastName",
106 "options": [],
107 "required": true,
108 "type": "TEXT"
109 }
110 ],
111 "orderIndex": 0,
112 "system": true,
113 "type": "NAME"
114 },
115 {
116 "_id": "email",
117 "inputs": [
118 {
119 "additionalLabels": [],
120 "label": "Email",
121 "maxLength": 255,
122 "name": "email",
123 "options": [],
124 "required": true,
125 "type": "TEXT"
126 }
127 ],
128 "orderIndex": 1,
129 "system": true,
130 "type": "INPUT"
131 }
132 ],
133 "messages": {
134 "checkout": {
135 "checkoutLabel": "Continue",
136 "title": "Add your details"
137 },
138 "registrationClosed": {
139 "exploreEventsLabel": "See other events",
140 "message": "Registration is closed"
141 },
142 "rsvp": {
143 "noMessages": {
144 "confirmationTitle": "Sorry You Can't Make It",
145 "shareLabel": "Share",
146 "title": "Add your details"
147 },
148 "rsvpNo": "Not Going",
149 "rsvpYes": "I'm Going",
150 "submitRsvpLabel": "SUBMIT",
151 "waitingMessages": {
152 "addToCalendarLabel": "Add to Calendar",
153 "confirmationMessage": "We'll update you if additional spots become available.",
154 "confirmationTitle": "Thanks! You've been added to the waitlist.",
155 "shareLabel": "Share",
156 "title": "Looks like this event is full. Join the waitlist."
157 },
158 "yesMessages": {
159 "addToCalendarLabel": "Add to Calendar",
160 "confirmationMessage": "An email with all the event info was sent to you.",
161 "confirmationTitle": "Thank you!",
162 "shareLabel": "Share",
163 "title": "Add your details"
164 }
165 }
166 }
167 },
168 "guestList": {
169 "public": true
170 },
171 "_id": "c241e6e2-c951-440d-8b62-52a6ec382140",
172 "language": "en",
173 "location": {
174 "address": {
175 "formatted": "Kensington Gore, London SW7, UK",
176 "location": {
177 "latitude": 51.5009132,
178 "longitude": -0.1766086
179 },
180 "city": "London",
181 "country": "GB",
182 "postalCode": "SW7 2BL",
183 "streetAddress": {
184 "name": "Kensington Gore",
185 "number": "SW7",
186 "apt": ""
187 }
188 },
189 "name": "Royal Albert Hall",
190 "tbd": false,
191 "type": "VENUE"
192 },
193 "registration": {
194 "initialType": "TICKETS",
195 "restrictedTo": "VISITOR",
196 "rsvp": {
197 "responseOptions": "YES_ONLY",
198 "waitlist": false
199 },
200 "status": "OPEN_TICKETS",
201 "tickets": {
202 "currency": "EUR",
203 "formAssignedPerTicket": false,
204 "highestTicketPrice": {
205 "currency": "EUR",
206 "value": "20.00"
207 },
208 "highestTicketPriceFormatted": "€20",
209 "lowestTicketPrice": {
210 "currency": "EUR",
211 "value": "20.00"
212 },
213 "lowestTicketPriceFormatted": "€20",
214 "tax": {}
215 },
216 "type": "TICKETS"
217 },
218 "scheduling": {
219 "endDate": "2023-11-29T23:00:00.137Z",
220 "formatted": "29 November 2023, 19:00–23:00",
221 "hideEndDate": false,
222 "showTimeZone": false,
223 "startDate": "2023-11-29T19:00:00.000Z",
224 "startDateFormatted": "29 November 2023",
225 "startTimeFormatted": "19:00",
226 "tbd": false,
227 "timeZoneId": "Europe/Dublin"
228 },
229 "slug": "natures-symphony-a-musical-journey-through-wildlife",
230 "status": "SCHEDULED",
231 "summary": {
232 "rsvp": {
233 "noCount": 0,
234 "totalRsvps": 0,
235 "waitlistCount": 0,
236 "yesCount": 0
237 },
238 "tickets": {
239 "currencyLocked": false,
240 "revenue": {},
241 "totalOrders": 0,
242 "totalSales": {},
243 "totalTickets": 0
244 }
245 },
246 "title": "Nature's Symphony: A Musical Journey Through Wildlife",
247 "_updatedDate": "2023-11-08T13:22:57.000Z",
248 "videoConferencing": {
249 "session": {
250 "guestLink": "https://www.wixevents.com/oc?join=JWS.eyJraWQiOiJpb21iOUJ0eSIsImFsZyI6IkhTMjU2In0.eyJkYXRhIjoie1wiYWN0aW9uXCI6XCJqb2luXCIsXCJpbnN0YW5jZUlkXCI6XCIxZjZkYzkwNi04MDNkLTQ2NTAtODNmNS03MmVhMWQ4ODEwMGJcIixcImV2ZW50SWRcIjpcImMyNDFlNmUyLWM5NTEtNDQwZC04YjYyLTUyYTZlYzM4MjE0MFwifSIsImlhdCI6MTY5OTQ1MDAxNn0.AfJHpzU54hY8M1oVB0KGe47GUSzOzkWBVpKTTWEXk5Y",
251 "hostLink": "https://www.wixevents.com/oc?start=JWS.eyJraWQiOiJpb21iOUJ0eSIsImFsZyI6IkhTMjU2In0.eyJkYXRhIjoie1wiYWN0aW9uXCI6XCJzdGFydFwiLFwiaW5zdGFuY2VJZFwiOlwiMWY2ZGM5MDYtODAzZC00NjUwLTgzZjUtNzJlYTFkODgxMDBiXCIsXCJldmVudElkXCI6XCJjMjQxZTZlMi1jOTUxLTQ0MGQtOGI2Mi01MmE2ZWMzODIxNDBcIn0iLCJpYXQiOjE2OTk0NTAwMTZ9.VmvnxZHBL6cCyE0ZYRdAa6cCud8aNchTTrLJX0b-Mhs"
252 }
253 }
254}
255*/
Create a "TBD" Wix event

This example creates a TBD ticketed event.

Copy Code
1import { wixEvents } from "wix-events-backend";
2import { elevate } from "wix-auth";
3
4/* Sample eventInfo value:
5
6{
7 title: "Nature's Symphony: A Musical Journey Through Wildlife.",
8 description: "Immerse yourself in the enchanting harmony of nature's symphony as it intertwines with the power of music!",
9 registration: {
10 initialType: "TICKETS",
11 restrictedTo: "VISITOR",
12 tickets: {
13 formAssignedPerTicket: false,
14 tax: {
15 type: "INCLUDED"
16 }
17 }
18 },
19 guestList: {
20 public: true
21 },
22 about: "Join us for Nature's Symphony: A Musical Journey Through Wildlife at the iconic Royal Albert Hall.",
23 location: {
24 name: "Royal Albert Hall",
25 address: {
26 formatted: "Kensington Gore, London SW7, UK",
27 location: {
28 latitude: 51.5009132,
29 longitude: -0.1766086
30 },
31 city: "London",
32 country: "GB",
33 postalCode: "SW7 2BL",
34 streetAddress: {
35 name: "Kensington Gore",
36 number: "SW7"
37 }
38 },
39 type: "VENUE"
40 },
41 scheduling: {
42 tbd: true,
43 tbdMessage: "The date will be announced soon, stay tuned!"
44 hideEndDate: false,
45 showTimeZone: false
46 }
47}
48
49Sample options value:
50
51{
52 "language": "de"
53}
54
55*/
56
57
58export async function myCreateEventFunction(eventInfo, options) {
59 try {
60 const elevatedCreateEvent = elevate(wixEvents.createEvent);
61 const createdEvent = await elevatedCreateEvent(eventInfo, options);
62 console.log('Success! CreatedEvent:', createdEvent);
63 return createdEvent;
64 } catch (error) {
65 console.error(error);
66 // Handle the error
67 }
68}
69
70/* Promise resolves to:
71 {
72 "about": "Join us for Nature's Symphony: A Musical Journey Through Wildlife at the iconic Royal Albert Hall.",
73 "assignedContactsLabel": "custom.natures-symphony-a-musical-journey-through-wildl",
74 "calendarLinks": {
75 "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",
76 "ics": "https://www.wixevents.com/media/v2/calendar?token=JWS.eyJraWQiOiJpb21iOUJ0eSIsImFsZyI6IkhTMjU2In0.eyJkYXRhIjoie1wiaW5zdGFuY2VJZFwiOlwiMWY2ZGM5MDYtODAzZC00NjUwLTgzZjUtNzJlYTFkODgxMDBiXCIsXCJldmVudElkXCI6e1widmFsdWVcIjpcImQxNTJmNDJjLTcyMWMtNDc3MC1hMTc4LWYwZTZjMWQ1NWYyN1wifSxcIm9jTGlua1wiOm51bGx9IiwiaWF0IjoxNjk5NDU1OTczfQ.jRP6qkUbDv_HIfIEVFKmBB1cf2R5XdgF3X50gHNW-Go"
77 },
78 "categories": [],
79 "createdBy": "",
80 "_createdDate": "2023-11-08T15:06:13.353Z",
81 "description": "Immerse yourself in the enchanting harmony of nature's symphony as it intertwines with the power of music!",
82 "eventUrl": {
83 "baseUrl": "https://mysite.com/events",
84 "path": "/event-details-registration/natures-symphony-a-musical-journey-through-wildlife"
85 },
86 "form": {
87 "inputGroups": [
88 {
89 "_id": "name",
90 "inputs": [
91 {
92 "additionalLabels": [],
93 "label": "First name",
94 "maxLength": 50,
95 "name": "firstName",
96 "options": [],
97 "required": true,
98 "type": "TEXT"
99 },
100 {
101 "additionalLabels": [],
102 "label": "Last name",
103 "maxLength": 50,
104 "name": "lastName",
105 "options": [],
106 "required": true,
107 "type": "TEXT"
108 }
109 ],
110 "orderIndex": 0,
111 "system": true,
112 "type": "NAME"
113 },
114 {
115 "_id": "email",
116 "inputs": [
117 {
118 "additionalLabels": [],
119 "label": "Email",
120 "maxLength": 255,
121 "name": "email",
122 "options": [],
123 "required": true,
124 "type": "TEXT"
125 }
126 ],
127 "orderIndex": 1,
128 "system": true,
129 "type": "INPUT"
130 }
131 ],
132 "messages": {
133 "checkout": {
134 "checkoutLabel": "Continue",
135 "title": "Add your details"
136 },
137 "registrationClosed": {
138 "exploreEventsLabel": "See other events",
139 "message": "Registration is closed"
140 },
141 "rsvp": {
142 "noMessages": {
143 "confirmationTitle": "Sorry You Can't Make It",
144 "shareLabel": "Share",
145 "title": "Add your details"
146 },
147 "rsvpNo": "Not Going",
148 "rsvpYes": "I'm Going",
149 "submitRsvpLabel": "SUBMIT",
150 "waitingMessages": {
151 "addToCalendarLabel": "Add to Calendar",
152 "confirmationMessage": "We'll update you if additional spots become available.",
153 "confirmationTitle": "Thanks! You've been added to the waitlist.",
154 "shareLabel": "Share",
155 "title": "Looks like this event is full. Join the waitlist."
156 },
157 "yesMessages": {
158 "addToCalendarLabel": "Add to Calendar",
159 "confirmationMessage": "An email with all the event info was sent to you.",
160 "confirmationTitle": "Thank you!",
161 "shareLabel": "Share",
162 "title": "Add your details"
163 }
164 }
165 }
166 },
167 "guestList": {
168 "public": true
169 },
170 "_id": "d152f42c-721c-4770-a178-f0e6c1d55f27",
171 "language": "en",
172 "location": {
173 "address": {
174 "formatted": "Kensington Gore, London SW7, UK",
175 "location": {
176 "latitude": 51.5009132,
177 "longitude": -0.1766086
178 },
179 "city": "London",
180 "country": "GB",
181 "postalCode": "SW7 2BL",
182 "streetAddress": {
183 "name": "Kensington Gore",
184 "number": "SW7",
185 "apt": ""
186 }
187 },
188 "name": "Royal Albert Hall",
189 "tbd": false,
190 "type": "VENUE"
191 },
192 "registration": {
193 "initialType": "TICKETS",
194 "restrictedTo": "VISITOR",
195 "rsvp": {
196 "responseOptions": "YES_ONLY",
197 "waitlist": false
198 },
199 "status": "CLOSED",
200 "tickets": {
201 "formAssignedPerTicket": false,
202 "highestTicketPrice": {},
203 "lowestTicketPrice": {},
204 "tax": {}
205 },
206 "type": "TICKETS"
207 },
208 "scheduling": {
209 "formatted": "The date will be announced soon, stay tuned!",
210 "hideEndDate": false,
211 "showTimeZone": false,
212 "startDateFormatted": "",
213 "startTimeFormatted": "",
214 "tbd": true,
215 "tbdMessage": "The date will be announced soon, stay tuned!"
216 },
217 "slug": "natures-symphony-a-musical-journey-through-wildlife-2",
218 "status": "SCHEDULED",
219 "summary": {
220 "rsvp": {
221 "noCount": 0,
222 "totalRsvps": 0,
223 "waitlistCount": 0,
224 "yesCount": 0
225 },
226 "tickets": {
227 "currencyLocked": false,
228 "revenue": {},
229 "totalOrders": 0,
230 "totalSales": {},
231 "totalTickets": 0
232 }
233 },
234 "title": "Nature's Symphony: A Musical Journey Through Wildlife.",
235 "_updatedDate": "2023-11-08T15:06:13.000Z",
236 "videoConferencing": {
237 "session": {
238 "guestLink": "https://www.wixevents.com/oc?join=JWS.eyJraWQiOiJpb21iOUJ0eSIsImFsZyI6IkhTMjU2In0.eyJkYXRhIjoie1wiYWN0aW9uXCI6XCJqb2luXCIsXCJpbnN0YW5jZUlkXCI6XCIxZjZkYzkwNi04MDNkLTQ2NTAtODNmNS03MmVhMWQ4ODEwMGJcIixcImV2ZW50SWRcIjpcImQxNTJmNDJjLTcyMWMtNDc3MC1hMTc4LWYwZTZjMWQ1NWYyN1wifSIsImlhdCI6MTY5OTQ1NTk3M30.DSiViUeWe2Yr9aqWtdp_TCA97sUwfOmZ3uE8XyLmXQk",
239 "hostLink": "https://www.wixevents.com/oc?start=JWS.eyJraWQiOiJpb21iOUJ0eSIsImFsZyI6IkhTMjU2In0.eyJkYXRhIjoie1wiYWN0aW9uXCI6XCJzdGFydFwiLFwiaW5zdGFuY2VJZFwiOlwiMWY2ZGM5MDYtODAzZC00NjUwLTgzZjUtNzJlYTFkODgxMDBiXCIsXCJldmVudElkXCI6XCJkMTUyZjQyYy03MjFjLTQ3NzAtYTE3OC1mMGU2YzFkNTVmMjdcIn0iLCJpYXQiOjE2OTk0NTU5NzN9.LZ5MYRXsUE-Pqzn4YtLJdAk7PXzKoJelPJvj1wUTjw8"
240 }
241 }
242}
243*/