Advert Lifecycle

Advert Lifecycle Event Flow

Event flow name: advert_lifecycle

This event flow contains events related to the lifecycle of adverts. That means, any time an advert is updated on the site it was created, you will receive a notification with the status update. That can happen through a request made from the flow publish_advert or from any updates on site.

Currently, there's only one event available that informs you about changes to the status of an advert:

Event typeDescriptioncodeNext Available Operations
advert_state_changedAn event that is triggered when an advert state changes on the site it was createdmoderated
outdated
removed_by_moderator
PUT
(the ad details can be updated, but the status will remain the same)
outdated_by_packagePUT

DELETE
activePUT
DELETE
DEACTIVATE
removed_by_userPOST or
 ACTIVATE
(depending on the last operation)
Only for Investments Units, when the Investment is removed/deactivatedremoved_by_parent_adPOST

advert_state_changed

📘

Advert status codes

Once an advert is published it can go through many states like getting removed by a user, moderated, expired, etc. Any time a state change is detected, you'll get a notification in your webhook. Make sure that your app is subscribed to these events in the Application Manager and check out the different status codes here .

Code: moderated

The status of an advert was updated to moderated, the reason why was moderated is included in the lifecycle notification above, like in the example below:

{
    "data": {
        "activated_at": "2018-05-03 14:04:15",
        "code": "moderated",
        "created_at": "2018-04-19T13:47:53.000+0000",
        "visible_in_profile": true,
        "modified_at": null,
        "ttl": "2018-04-26T12:27:02.000+0000",
        "url": "<Advert URL>",
        "moderation": {
            "reason": "Moderation reason",
            "description": "Description of moderation reason"
        }
    },
    "destination": "https://myawesomeapp.com/webhooks",
    "event_type": "advert_state_changed",
    "flow": "advert_lifecycle",
    "object_id": "d6bd341e-90f5-43ed-8ab0-2be56f6054bc",
    "event_timestamp": 1531735505952,
    "timestamp": 1524148443449,
    "transaction_id": "de3cd53c-43cf-11e8-93ed-ff34ffa368f3"
}

Same for all the moderation status: outdated and removed_by_moderator.

Code: active

If an advert was activated through the activation of the package (only for Imovirtual), after a moderation removal, or even after a POST request, you will receive the lifecycle notification like in the example below:

{
  "data": {
    "data": {
      "activated_at": "2020-06-24T08:02:30.000+0000",
      "code": "active",
      "created_at": "2020-06-24T07:56:58.000+0000",
      "visible_in_profile": true,
      "moderation": {
        "description": null,
        "reason": null
      },
      "modified_at": "2020-06-29T10:34:02.000+0000",
      "recorded_at": "2020-06-29T10:34:03.326+0000",
      "ttl": "2020-07-29T10:34:02.000+0000",
      "url": "https://www.imovirtual.com/anuncio/qatest-mercury-anuncio-de-testes-olx-group-ID13b0A.html"
    },
    "destination": "http://https://myawesomeapp.com/webhooks",
    "event_timestamp": 1593426844007,
    "event_type": "advert_state_changed",
    "flow": "advert_lifecycle",
    "object_id": "8e5d6763-20e7-46bc-90c4-93edc3cd3826",
    "timestamp": 1593426843326,
    "transaction_id": "bd553e9d-d983-4cc8-857e-0ec76bb314e3"
  }

Code: outdated_by_package

If an advert was outdated_by_package by the expiration of the prepaid package, you will receive the lifecycle notification like in the example below:

📘

Only for Imovirtual

Imovirtual was a prepaid package process, so when the package expires, all active adverts are inactivated with the status "outdated_by_package". When the client pays for a new package, all "outdated_by_package" adverts will are reactivated with the "active" status. You will receive a notification for each advert updated.

{
  "data": {
    "data": {
      "activated_at": "2020-06-24T08:02:30.000+0000",
      "code": "outdated_by_package",
      "created_at": "2020-06-24T07:56:58.000+0000",
      "visible_in_profile": true,
      "moderation": {
        "description": null,
        "reason": null
      },
      "modified_at": "2020-06-24T08:02:46.000+0000",
      "recorded_at": "2020-06-29T10:30:05.221+0000",
      "ttl": "2020-06-29T10:30:05.000+0000",
      "url": null
    },
    "destination": "http://https://myawesomeapp.com/webhooks",
    "event_timestamp": 1593426605720,
    "event_type": "advert_state_changed",
    "flow": "advert_lifecycle",
    "object_id": "8e5d6763-20e7-46bc-90c4-93edc3cd3826",
    "timestamp": 1593426605221,
    "transaction_id": "0339661b-2b3a-45f0-92c4-56fa45e69f65"
  }