Search...
onGuestCreated( )
A backend event that fires when a Guest is created.
Description
The onGuestCreated()
event handler runs when a Guest is created on your site. The received GuestCreated
object contains information about the new guest.
Note: Backend events are not fired when previewing your site.
Syntax
function wixEventsGuests_onGuestCreated(event: GuestCreated): void
onGuestCreated Parameters
NAME
TYPE
DESCRIPTION
event
Optional
GuestCreated
Information about the created guest and onGuestCreated
event.
Returns
This function does not return anything.
Return Type:
void
Was this helpful?
A backend event that occurs when a guest is created
Copy Code
1// Place this code in the events.js file2// of your site's Backend section.3// Add the file if it doesn't exist.45export function wixEventsGuests_onGuestCreated(event) {6 const eventId = event.metadata.id7 const entityId = event.entity._id;8 }910/* Full guest object:11{12 "metadata": {13 "id": "02459af3-da70-4173-a607-65678e99ef30",14 "entityId": "afda7995-72d0-4d58-9ba4-3f6c5213c35c",15 "eventTime": "2023-04-19T12:39:05.690213Z",16 "triggeredByAnonymizeRequest": false17 },18 "entity": {19 "_id": "afda7995-72d0-4d58-9ba4-3f6c5213c35c",20 "eventId": "3d3d5c04-ece0-45a8-85f0-11a58edaa192",21 "orderNumber": "2TFG-RXPW-00Z",22 "tickets": [23 {24 "number": "2TFG-RXPW-00Z1P",25 "definitionId": "9b5b5cc0-b017-49d1-a59c-81c7cff580a6",26 "name": "Participant Ticket"27 }28 ],29 "contactId": "023b6403-17e6-42dc-b475-a5ae6c2b8df4",30 "guestDetails": {31 "email": "john.doe@mail.com",32 "firstName": "John",33 "lastName": "Doe",34 "formResponse": {35 "inputValues": [36 {37 "inputName": "firstName",38 "value": "John",39 "values": []40 },41 {42 "inputName": "lastName",43 "value": "Doe",44 "values": []45 },46 {47 "inputName": "email",48 "value": "john.doe@mail.com",49 "values": []50 }51 ]52 },53 "checkedIn": false54 },55 "attendanceStatus": "ATTENDING",56 "_createdDate": "2023-04-19T12:39:05.561Z",57 "_updatedDate": "2023-04-19T12:39:05.602Z",58 "attendanceStatusUpdatedDate": "2023-04-19T12:39:05.424Z",59 "guestType": "BUYER"60 }61}62*/