An event that is triggered when a post is deleted.
The onPostDeleted()
event handler runs when a post is deleted. The received PostDeleted
object contains event metadata.
Note: Backend events don't work when previewing your site.
function wixBlog_onPostDeleted(event: PostDeleted): void;
Information about the post that was deleted.
// Place this code in the events.js file
// of your site's Backend section.
// Add the file if it doesn't exist.
export function wixBlog_onPostDeleted(event) {
const deletedPostId = event.metadata.entityId;
console.log("Post deleted", event);
}
/* Full event object:
* {
* "metadata":{
* "id":"416ba1ea-b7a0-432d-9a65-a8b5b0b2208c",
* "entityId":"ecec1fb1-d21a-4bf8-9e01-c6e4f231ae67",
* "eventTime":"2022-06-16T14:21:40.065Z",
* "triggeredByAnonymizeRequest":false
* }
* }
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.
An event that is triggered when a post is liked.
The onPostLiked()
event handler runs when a post is liked. The received PostLikedEvent
object contains data about the liked post including the postId
, and the memberId
or anonymousVisitorId
.
Note: Backend events don't work when previewing your site.
function wixBlog_onPostLiked(event: PostLikedEvent): void;
Information about the post that was liked.
export function wixBlog_onPostLiked(event) {
const postIdLiked = event.metadata.entityId;
const memberId = event.data.memberId;
console.log("Post liked", event);
}
/* Full event object:
* {
* "metadata":{
* "id": "e7ae2019-7d68-4342-8fa0-b28e20e8ec80",
* "entityId": "e65bd5d9-36ca-4388-8064-3d785d0f5460",
* "eventTime":"2022-06-16T15:22:49.242Z",
* "triggeredByAnonymizeRequest":false
* },
* "data":{
* "postId":"e65bd5d9-36ca-4388-8064-3d785d0f5460",
* "memberId": "33d02592-dd28-4eff-9b8e-4c3bb9c737dd"
* }
* }
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.
An event that is triggered when a post is unliked.
The onPostUnliked()
event handler runs when a post is unliked. The received PostUnlikedEvent
object contains the postId
of the unliked post.
Note: Backend events don't work when previewing your site.
function wixBlog_onPostUnliked(event: PostUnlikedEvent): void;
Information about the unliked post.
export function wixBlog_onPostUnliked(event) {
const timeUnliked = event.metadata.eventTime;
const postIdUnliked = event.data.postId;
console.log("Post unliked", event);
}
/* Full event object:
*
* {
* "metadata":{
* "id": "",
* "entityId": "e65bd5d9-36ca-4388-8064-3d785d0f5460",
* "eventTime":"2022-06-16T15:22:49.242Z",
* "triggeredByAnonymizeRequest":false
* },
* "data":{
* "postId":"e65bd5d9-36ca-4388-8064-3d785d0f5460"
* }
* }
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.
An event that triggers when a post is updated.
The onPostUpdated()
event handler runs when a post is updated. The received PostUpdated
object contains information about the post that was updated.
Note: Backend events don't work when previewing your site.
function wixBlog_onPostUpdated(event: PostUpdated): void;
Information about the post that was updated.
// Place this code in the events.js file
// of your site's Backend section.
// Add the file if it doesn't exist.
export function wixBlog_onPostUpdated(event) {
const postId = event.metadata.entityId;
const postUpdateDate = event.entity.lastPublishedDate;
console.log("Post updated", event);
}
/* Full event object:
*
* {
* "metadata":{
* "id":"8b00dc16-9404-4207-92ac-ac03a5ec528b",
* "entityId":"f11052c1-84f1-456e-8583-82173da8509d",
* "eventTime":"2022-06-16T14:49:55.712Z",
* "triggeredByAnonymizeRequest":false
* },
* "entity":{
* "_id":"f11052c1-84f1-456e-8583-82173da8509d",
* "categoryIds":[],
* "commentingEnabled":true,
* "contactId":"33d02592-dd28-4eff-9b8e-4c3bb9c737dd",
* "excerpt":"Updating a blog post.",
* "featured":false,
* "firstPublishedDate":"2022-06-16T14:42:19.087Z",
* "hashtags":[],
* "language":"en",
* "lastPublishedDate":"2022-06-16T14:49:55.554Z",
* "memberId":"33d02592-dd28-4eff-9b8e-4c3bb9c737dd",
* "minutesToRead":1,
* "pinned":false,
* "preview": false,
* "pricingPlanIds":[],
* "relatedPostIds":[],
* "richContent":{
* "nodes":[
* {
* "type":"PARAGRAPH",
* "_id":"foo",
* "nodes":[
* {
* "type":"TEXT",
* "_id":"",
* "nodes":[],
* "textData":{
* "text":"Updating a blog post.",
* "decorations":[]
* }
* }
* ],
* "paragraphData":{
* "textStyle":{
* "textAlignment":"AUTO"
* },
* "indentation":0
* }
* }
* ],
* "metadata":{
* "version":1,
* "createdTimestamp":"2022-06-16T14:49:55.710Z",
* "updatedTimestamp":"2022-06-16T14:49:55.710Z",
* "_id":"253928e4-71bc-41d5-bcb6-35a604ea8229"},
* "documentStyle":{}
* },
* }
* "slug":"new-blog-post",
* "tagIds":[],
* "title":"Updated Blog Post",
* "translationId": "",
* "url":"http://https://tadasz7.wixsite.com/blog-velo-events/post/new-blog-post"
* }
* }
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.
An event that is triggered when a tag is created.
The onTagCreated()
event handler runs when a tag is created. The received TagCreated
object contains information about the tag that was created.
Note: Backend events don't work when previewing your site.
function wixBlog_onTagCreated(event: TagCreated): void;
Information about the tag that was created.
// Place this code in the events.js file
// of your site's Backend section.
// Add the file if it doesn't exist.
export function wixBlog_onTagCreated(event) {
const tagId = event.metadata.entityId;
const tagUrl = event.entity.url;
console.log("Tag created", event);
}
/*
* {
* "metadata":{
* "id":"f48ae946-a320-4805-985a-28384e9487f3",
* "entityId":"2d85ff8e-885e-47ad-a73a-ce9631c73a77",
* "eventTime":"2022-06-16T15:16:20.376Z"
* },
* "entity":{
* "_createdDate":"2022-06-16T15:16:20.347Z",
* "_id":"2d85ff8e-885e-47ad-a73a-ce9631c73a77",
* "_updatedDate":"2022-06-16T15:16:20.347Z",
* "label":"new label",
* "language":"en"
* "postCount":0,
* "publishedPostCount":0,
* "slug":"new-update",
* "url":"http://https://tadasz7.wixsite.com/blog-velo-events/my-blog/tags/new-label"
* }
* }
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.
An event that is triggered when a tag is deleted.
The onTagDeleted()
event handler runs when a tag is deleted. The received TagDeleted
object contains event metadata.
Note: Backend events don't work when previewing your site.
function wixBlog_onTagDeleted(event: TagDeleted): void;
Information about the post that was deleted.
// Place this code in the events.js file
// of your site's Backend section.
// Add the file if it doesn't exist.
export function wixBlog_onTagDeleted(event) {
const categoryId = event.metadata.entityId;
const deletedTagTime = event.metadata.eventTime;
console.log("Tag deleted", event);
}
/*
* {
* "metadata":{
* "id":"4c9f5d4d-743d-4e59-9627-b95c1d8f424b",
* "entityId":"371f53b4-b965-476b-9e51-30095c1a1a91",
* "eventTime":"2022-06-16T15:22:49.242Z",
* "triggeredByAnonymizeRequest":false
* }
* }
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.