{
  "name": "New Amazon releases to Slack every morning",
  "nodes": [
    {
      "id": "162701ae-f153-56b9-ad78-89b1aca7d955",
      "name": "Overview",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -720,
        0
      ],
      "parameters": {
        "content": "## New Amazon releases to Slack every morning\n\n### How it works\nFor product researchers, sellers and buyers watching new products in a category. Every day at 07:00, the workflow runs the [Amazon Best Sellers Scraper](https://apify.com/aurelix/amazon-best-sellers) Actor on Apify and reads Amazon's New Releases list for your categories and posts only the products that joined it since the last run (rank, title, price, rating, link) to Slack; nothing is posted when nothing is new.\n\n### Setup\n1. Install the **Apify** node (verified community node: on n8n Cloud search *Apify* in the nodes panel and click Install; self-hosted: Settings > Community nodes > `@apify/n8n-nodes-apify`). Create an **Apify API** credential with your API token (Apify Console > Settings > API & Integrations) and select it on the Apify node. Tested with `@apify/n8n-nodes-apify` 0.9.0 on n8n 2.46; install guide: https://docs.apify.com/platform/integrations/n8n\n2. Create a **Slack** credential for a bot with `chat:write`, invite the bot to the channel set in the Set node, and select it on **Post to Slack**.\n3. Open **Set search** and change the values: what to search, the Slack target, and `maxChargeUsd`, the most one run may cost.\n4. Run once by hand, check the result, then activate.\n\n### Cost\nAbout $0.075 per run at most on Apify's free plan for up to 100 products on the first run; `maxChargeUsd` caps every run.\n\n### Limitations\nNeeds an Apify account (Apify bills the Actor's results to it) and the Apify community node. Runs that fail or hit `maxChargeUsd` stop the workflow at the Apify node; check the run in Apify Console.\n\n### Customization\nThe first run posts the whole list once; later runs post only newcomers. Add categories, or change `amazonDomain` for another marketplace.",
        "height": 860,
        "width": 640
      }
    },
    {
      "id": "4a44d39f-0e74-51c9-b34f-906a902b5433",
      "name": "Run the Actor",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        220,
        140
      ],
      "parameters": {
        "content": "## Run the Actor\nEdit the search and the spend cap in **Set search**. The Apify node waits for the run and returns its results.",
        "height": 340,
        "width": 540,
        "color": 7
      }
    },
    {
      "id": "908c5620-9353-5567-a9cd-f2a1494eac3f",
      "name": "Deliver",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        740,
        140
      ],
      "parameters": {
        "content": "## Deliver\nKeep result rows, shape them and send them to Slack. Nothing is sent when there is nothing new.",
        "height": 340,
        "width": 540,
        "color": 7
      }
    },
    {
      "id": "51171242-0d91-54f2-b4da-af2b7bda44d8",
      "name": "Every day at 07:00",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        0,
        300
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "days",
              "triggerAtHour": 7
            }
          ]
        }
      }
    },
    {
      "id": "cefc1f6e-dc8c-5850-83e5-f1f4f5be995e",
      "name": "Set search",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        260,
        300
      ],
      "parameters": {
        "mode": "manual",
        "assignments": {
          "assignments": [
            {
              "id": "8106ff4d-52b7-53a6-b39c-9f7b71b9c149",
              "name": "categories",
              "value": "[\"toys-and-games\"]",
              "type": "array"
            },
            {
              "id": "38957e64-ce6d-5589-b771-07124ba4873c",
              "name": "amazonDomain",
              "value": "com",
              "type": "string"
            },
            {
              "id": "e560bb08-2cd5-5e5d-8b73-ab13919ffb77",
              "name": "maxChargeUsd",
              "value": 0.1,
              "type": "number"
            },
            {
              "id": "05c6f64f-46a3-5532-b52e-4da766e24aae",
              "name": "slackChannel",
              "value": "#alerts",
              "type": "string"
            }
          ]
        },
        "options": {}
      }
    },
    {
      "id": "d87edf17-13e4-5f53-a6f2-2a7a7fed93f2",
      "name": "Run Amazon Best Sellers Scraper",
      "type": "@apify/n8n-nodes-apify.apify",
      "typeVersion": 1,
      "position": [
        520,
        300
      ],
      "parameters": {
        "resource": "Actors",
        "operation": "Run actor and get dataset",
        "actorSource": "store",
        "actorId": {
          "__rl": true,
          "mode": "list",
          "value": "NETmBbX7fdm72qFIs",
          "cachedResultName": "Amazon Best Sellers Scraper (aurelix/amazon-best-sellers)",
          "cachedResultUrl": "https://console.apify.com/actors/NETmBbX7fdm72qFIs/input"
        },
        "actorInputMode": "json",
        "customBody": "={{ JSON.stringify({ categories: $json.categories, amazonDomain: $json.amazonDomain, listType: 'new-releases', maxPages: 2, onlyNewEntries: true, stateKey: 'n8n-new-releases-' + $json.categories.join('-') }) }}",
        "memory": 256,
        "timeout": 900,
        "maxTotalChargeUsd": "={{ $json.maxChargeUsd }}"
      }
    },
    {
      "id": "90268144-8110-5ea6-b67b-986dd831643d",
      "name": "Shape results",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        780,
        300
      ],
      "parameters": {
        "jsCode": "const rows = $input.all().map(i => i.json).filter(p => p.asin);\nif (!rows.length) return [];\nconst lines = rows.map(p => `#${p.rank} ${p.title} | ${p.price ?? ''} ${p.currency ?? ''} | ${p.rating ?? '-'}★ (${p.reviews_count ?? 0}) | <${p.product_url}|view>`);\nreturn [{ json: { text: `*New on Amazon New Releases* (${rows.length})\\n` + lines.join('\\n') } }];"
      }
    },
    {
      "id": "f7fd5abf-85af-510c-8304-598c48a5da54",
      "name": "Post to Slack",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2.2,
      "parameters": {
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "name",
          "value": "={{ $('Set search').first().json.slackChannel }}"
        },
        "text": "={{ $json.text }}",
        "otherOptions": {
          "unfurl_links": false
        }
      },
      "position": [
        1040,
        300
      ]
    }
  ],
  "connections": {
    "Every day at 07:00": {
      "main": [
        [
          {
            "node": "Set search",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set search": {
      "main": [
        [
          {
            "node": "Run Amazon Best Sellers Scraper",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run Amazon Best Sellers Scraper": {
      "main": [
        [
          {
            "node": "Shape results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Shape results": {
      "main": [
        [
          {
            "node": "Post to Slack",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "pinData": {},
  "tags": []
}
