{
  "name": "Publicador Multiplataforma para Redes Sociales",
  "flow": [
    {
      "id": 1,
      "module": "builtin:BasicSchedule",
      "version": 1,
      "parameters": {
        "interval": "minutes",
        "minutes": 15
      },
      "mapper": {},
      "metadata": {
        "designer": { "x": 0, "y": 0 },
        "restore": {},
        "expect": []
      }
    },
    {
      "id": 2,
      "module": "google-sheets:searchRows",
      "version": 2,
      "parameters": {
        "spreadsheetId": "{{SPREADSHEET_CALENDARIO_ID}}",
        "sheetId": "Calendario",
        "filter": "G:G=Programado",
        "sort": "A:A asc"
      },
      "mapper": {},
      "filter": {
        "name": "Publicaciones para ahora",
        "conditions": [
          { "a": "{{parseDate(2.fechaHora; \"DD/MM/YYYY HH:mm\")}}", "o": "date:lessThanOrEqual", "b": "{{now}}" }
        ]
      },
      "metadata": {
        "designer": { "x": 300, "y": 0 },
        "restore": {
          "spreadsheetId": { "label": "Calendario Editorial" }
        },
        "expect": [
          { "name": "spreadsheetId", "type": "text", "label": "Spreadsheet ID" }
        ]
      }
    },
    {
      "id": 3,
      "module": "google-drive:getFile",
      "version": 2,
      "parameters": {},
      "mapper": {
        "fileId": "{{2.imagenDriveId}}"
      },
      "metadata": {
        "designer": { "x": 600, "y": 0 },
        "restore": {},
        "expect": [
          { "name": "fileId", "type": "text", "label": "File ID" }
        ]
      }
    },
    {
      "id": 4,
      "module": "builtin:BasicRouter",
      "version": 1,
      "parameters": {},
      "mapper": {},
      "routes": [
        {
          "label": "Facebook",
          "filter": { "conditions": [{ "a": "{{2.plataformas}}", "o": "text:contains", "b": "FB" }] },
          "flow": [5]
        },
        {
          "label": "Instagram",
          "filter": { "conditions": [{ "a": "{{2.plataformas}}", "o": "text:contains", "b": "IG" }] },
          "flow": [6]
        },
        {
          "label": "Twitter",
          "filter": { "conditions": [{ "a": "{{2.plataformas}}", "o": "text:contains", "b": "TW" }] },
          "flow": [7]
        }
      ],
      "metadata": {
        "designer": { "x": 900, "y": 0 },
        "restore": {},
        "expect": []
      }
    },
    {
      "id": 5,
      "module": "facebook-pages:createPost",
      "version": 1,
      "parameters": {
        "pageId": "{{FACEBOOK_PAGE_ID}}",
        "accessToken": "{{FACEBOOK_PAGE_TOKEN}}"
      },
      "mapper": {
        "message": "{{2.textoPost}}",
        "link": "{{2.enlace}}",
        "photoUrl": "{{3.webContentLink}}"
      },
      "metadata": {
        "designer": { "x": 1200, "y": -200 },
        "restore": {},
        "expect": [
          { "name": "pageId", "type": "text", "label": "Page ID" },
          { "name": "message", "type": "text", "label": "Message" }
        ]
      }
    },
    {
      "id": 6,
      "module": "instagram-business:createPhoto",
      "version": 1,
      "parameters": {
        "instagramAccountId": "{{INSTAGRAM_BUSINESS_ID}}",
        "accessToken": "{{FACEBOOK_PAGE_TOKEN}}"
      },
      "mapper": {
        "caption": "{{2.textoPost}}\n.\n.\n.\n{{2.hashtags}}",
        "imageUrl": "{{3.webContentLink}}"
      },
      "metadata": {
        "designer": { "x": 1200, "y": 0 },
        "restore": {},
        "expect": [
          { "name": "instagramAccountId", "type": "text", "label": "Instagram Account ID" },
          { "name": "caption", "type": "text", "label": "Caption" }
        ]
      }
    },
    {
      "id": 7,
      "module": "twitter:createTweet",
      "version": 2,
      "parameters": {
        "accessToken": "{{TWITTER_ACCESS_TOKEN}}",
        "accessTokenSecret": "{{TWITTER_ACCESS_TOKEN_SECRET}}"
      },
      "mapper": {
        "text": "{{2.textoPost}}",
        "mediaUrl": "{{3.webContentLink}}"
      },
      "metadata": {
        "designer": { "x": 1200, "y": 200 },
        "restore": {},
        "expect": [
          { "name": "text", "type": "text", "label": "Tweet Text" }
        ]
      }
    },
    {
      "id": 8,
      "module": "google-sheets:updateRow",
      "version": 2,
      "parameters": {
        "spreadsheetId": "{{SPREADSHEET_CALENDARIO_ID}}",
        "sheetId": "Calendario",
        "rowId": "{{2.__ROW_NUMBER__}}"
      },
      "mapper": {
        "values": {
          "6": "Publicado",
          "7": "{{formatDate(now; \"DD/MM/YYYY HH:mm\")}}"
        }
      },
      "metadata": {
        "designer": { "x": 1500, "y": 0 },
        "restore": {},
        "expect": [
          { "name": "spreadsheetId", "type": "text", "label": "Spreadsheet ID" }
        ]
      }
    }
  ],
  "metadata": {
    "instant": false,
    "version": 1,
    "scenario": {
      "roundtrips": 1,
      "maxErrors": 3,
      "autoCommit": true,
      "autoCommitTriggerLast": true,
      "sequential": false
    },
    "designer": {
      "orphans": []
    },
    "zone": "us1.make.com"
  }
}