How to run a script after publishing

Dear, i am trying to create a personal website bookmarking site,
but i am stuck because i want to take a screenshot of a published bookmarks url

i have this simple model

      "kind": "collectionType",
      "collectionName": "bookmarks",
      "info": {
        "name": "Bookmark",
        "description": ""

      "options": {
        "increments": true,
        "timestamps": true,
        "draftAndPublish": false

      "pluginOptions": {},
      "attributes": {
        "title": {
          "type": "string",
          "required": true,
          "unique": true

        "slug": {
          "type": "uid",
          "targetField": "title",
          "required": true

        "url": {
          "type": "string",
          "required": true,
          "unique": true

        "description": {
          "type": "richtext"

        "thumb": {
          "model": "file",
          "via": "related",
          "allowedTypes": [
          "plugin": "upload",
          "required": false,
          "pluginOptions": {}

Now my question is where can i implement the code i want to run after i publish

do i have to extend the controller Update method or findOne, or the Create method?

Also after taking a screenshot, how do i assign it to the Thumb model ?