This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Triggered when a badge is updated.
function wixBadges_onBadgeUpdated(event: BadgeUpdated): void;
// Place this code in the events.js file
// of your site's Backend section.
// Add the file if it doesn't exist.
export function wixBadges_onBadgeUpdated(event) {
const badgeID = event.entity._id;
const eventTime = event.metadata.eventTime;
console.log(`Badge ID: ${badgeID} has been updated at ${eventTime}`);
}
/* Full event object:
* {
* "entity": {
* "_createdDate": "2024-03-29T09:00:20.395Z",
* "_id": "3e536ad8-486e-45d8-9c0a-eab0cce4f98c",
* "_updatedDate": "2024-03-29T09:12:59.128Z",
* "backgroundColor": "#FF5C79",
* "description": "Contributed more than 5 blog posts.",
* "icon": "https://static.wixstatic.com/shapes/11062b_73d6472a03884c758f9d39f83a1218c2.svg",
* "permissionsEnabled": false,
* "slug": "super-contributer",
* "textColor": "#796EFF",
* "title": "Super Contributer"
* },
* "metadata": {
* "entityId": "3e536ad8-486e-45d8-9c0a-eab0cce4f98c",
* "eventTime": "2024-03-29T09:12:59.194287142Z",
* "id": "ace58c39-ddd6-467d-9d0a-6ad6cc1be97a",
* "triggeredByAnonymizeRequest": false
* }
* }
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.