Event flow name: advert_lifecycle

This flow event is 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 type Description code Next Available Operations
advert_state_changed An event that is triggered when an advert state changes on the site it was created moderated outdated removed_by_moderator (No operation allowed)
outdated_by_package PUT DELETE
active PUT DELETE DEACTIVATE
removed_by_user POST or ACTIVATE (depending on the last operation)


๐Ÿ“˜ 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 Advert Status Codes page.

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",
        "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_moderated.

Code: active

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


{
	  "data": {
	    "activated_at": "2020-06-24T08:02:30.000+0000",
	    "code": "active",
	    "created_at": "2020-06-24T07:56:58.000+0000",
	    "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.olx.ro/d/oferta/qatest-mercury-parte-de-carro-de-ganda-mercedes-stg-urnsiteolxro-IDbi3Mq.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 prepaid packages
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": {
    "activated_at": "2020-06-24T08:02:30.000+0000",
    "code": "outdated_by_package",
    "created_at": "2020-06-24T07:56:58.000+0000",
    "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"
}