How to tell in the lifecycle hooks if a content entry was unpublished?

I have one content type named post

I have the lifecycle under post/lifecycles.ts that looks like this

    async afterUpdate(event) {
        if (event.result.publishedAt === null) {
            // I can tell if now it is not published, but have no idea if it was published before??? and just was unpublished

In the afterUpdate i can tell fi something is unpublished but I don’t know if it was published before!

I want a 100% way to trigger an action ONLY when we move from published → unpublished

Is there any way to achieve this ?

Hey @kristijorgji,
To achieve your requirement, apply below logic using beforeUpdate hook in lifecycles.


beforeUpdate({ params }) {
  const data = await strapi.db.query("").findOne({
    select: ['id', 'title', 'publishedAt'],
    where: { id: },

if(data.publishedAt === "Published" && === "Draft") {