Search.../

onBadgeUpdated( )

Developer Preview

Triggered when a badge is updated.

Syntax

function wixBadges_onBadgeUpdated(event: BadgeUpdated): void

onBadgeUpdated Parameters

NAME
TYPE
DESCRIPTION
event
Optional
BadgeUpdated

Returns

This function does not return anything.

Return Type:

void

Was this helpful?

An event that occurs when a badge is updated

Copy Code
1// Place this code in the events.js file
2// of your site's Backend section.
3// Add the file if it doesn't exist.
4
5export function wixBadges_onBadgeUpdated(event){
6 const badgeID = event.entity._id;
7 const eventTime = event.metadata.eventTime;
8
9 console.log(`Badge ID: ${badgeID} has been updated at ${eventTime}`);
10}
11
12/* Full event object:
13 * {
14 * "entity": {
15 * "_createdDate": "2024-03-29T09:00:20.395Z",
16 * "_id": "3e536ad8-486e-45d8-9c0a-eab0cce4f98c",
17 * "_updatedDate": "2024-03-29T09:12:59.128Z",
18 * "backgroundColor": "#FF5C79",
19 * "description": "Contributed more than 5 blog posts.",
20 * "icon": "https://static.wixstatic.com/shapes/11062b_73d6472a03884c758f9d39f83a1218c2.svg",
21 * "permissionsEnabled": false,
22 * "slug": "super-contributer",
23 * "textColor": "#796EFF",
24 * "title": "Super Contributer"
25 * },
26 * "metadata": {
27 * "entityId": "3e536ad8-486e-45d8-9c0a-eab0cce4f98c",
28 * "eventTime": "2024-03-29T09:12:59.194287142Z",
29 * "id": "ace58c39-ddd6-467d-9d0a-6ad6cc1be97a",
30 * "triggeredByAnonymizeRequest": false
31 * }
32 * }
33*/