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
removed_by_moderator
PUT
(the ad details can be updated, but the status will remain the same)
outdatedPUT
ACTIVATE
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: removed_by_moderator.

Code: active

If an advert was activated 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

If an advert was outdated by the expiration, you will receive the lifecycle notification like in the example below:

{
  "data": {
    "data": {
      "activated_at": "2020-06-24T08:02:30.000+0000",
      "code": "outdated",
      "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"
  }