{
    "name": "Sociamonials \u2014 create a social post, then read the published-messages report",
    "flow": [
        {
            "id": 1,
            "module": "http:ActionSendData",
            "version": 3,
            "parameters": {
                "handleErrors": true
            },
            "mapper": {
                "url": "https://www.sociamonials.com/api/v1/posts",
                "serializeUrl": false,
                "method": "post",
                "headers": [
                    {
                        "name": "Authorization",
                        "value": "PASTE_YOUR_API_KEY_HERE"
                    },
                    {
                        "name": "Content-Type",
                        "value": "application/json"
                    }
                ],
                "qs": [],
                "bodyType": "raw",
                "parseResponse": true,
                "authUser": "",
                "authPass": "",
                "timeout": null,
                "shareCookies": false,
                "ca": "",
                "rejectUnauthorized": true,
                "followRedirect": true,
                "useQuerystring": false,
                "gzip": true,
                "useMtls": false,
                "contentType": "application/json",
                "data": "{\n    \"mode\": \"draft\",\n    \"message\": \"Type your post here, or map a field from your data\",\n    \"networks\": {\n        \"fb\": {\n            \"profile_refs\": [\n                \"Paste your profile ID from the API Keys page\"\n            ],\n            \"message\": \"\"\n        }\n    },\n    \"publish_at\": \"\",\n    \"link\": \"\",\n    \"image_urls\": [],\n    \"video_url\": \"\",\n    \"video_thumbnail_url\": \"\",\n    \"alt_text\": \"\",\n    \"first_comment\": \"\",\n    \"category\": \"\",\n    \"watermark\": \"\",\n    \"hashtag_group\": \"\",\n    \"cta_group\": \"\",\n    \"post_preset\": \"\",\n    \"team_note\": \"\"\n}",
                "followAllRedirects": false
            },
            "metadata": {
                "designer": {
                    "x": 0,
                    "y": 0,
                    "name": "Create a social post"
                },
                "notes": "READ ME FIRST\n-------------\n1) Open the 'Create a social post' module below.\n2) In the Authorization header, select everything in the field and paste your API\n   key over it. Your key looks like sm_agent_XXXX. Create one at\n   https://www.sociamonials.com/login.php?redirect=accounts%2Fapi_keys.php\n   (sign in first, then Create API Key.)\n3) Put your post text in 'message' and paste one profile ID into 'profile_refs'\n   (your profile IDs are on the API Console). Leave 'mode' as draft for your first run.\n4) The common fields are filled in below. Leave any you don't need EMPTY \u2014 empty\n   fields are ignored. For extra options (Pinterest boards, TikTok, YouTube,\n   scheduling) see the field guide: https://www.sociamonials.com/developers.php#no-code\n5) Run once. It creates a DRAFT (nothing publishes) so you can check it safely."
            }
        },
        {
            "id": 2,
            "module": "http:ActionSendData",
            "version": 3,
            "parameters": {
                "handleErrors": true
            },
            "mapper": {
                "url": "https://www.sociamonials.com/api/v1/workspaces",
                "serializeUrl": false,
                "method": "get",
                "headers": [
                    {
                        "name": "Authorization",
                        "value": "PASTE_YOUR_API_KEY_HERE"
                    }
                ],
                "qs": [],
                "bodyType": "raw",
                "parseResponse": true,
                "authUser": "",
                "authPass": "",
                "timeout": null,
                "shareCookies": false,
                "ca": "",
                "rejectUnauthorized": true,
                "followRedirect": true,
                "useQuerystring": false,
                "gzip": true,
                "useMtls": false,
                "contentType": "application/json",
                "data": "",
                "followAllRedirects": false
            },
            "metadata": {
                "designer": {
                    "x": 300,
                    "y": 0,
                    "name": "List your workspaces"
                },
                "notes": "Runs with no configuration at all. Its output feeds the workspace id\ninto module 3, so you never have to look one up by hand."
            }
        },
        {
            "id": 3,
            "module": "http:ActionSendData",
            "version": 3,
            "parameters": {
                "handleErrors": true
            },
            "mapper": {
                "url": "https://www.sociamonials.com/api/v1/workspaces/{{2.data.workspaces[1].workspace_registration_id}}/published-messages",
                "serializeUrl": false,
                "method": "get",
                "headers": [
                    {
                        "name": "Authorization",
                        "value": "PASTE_YOUR_API_KEY_HERE"
                    }
                ],
                "qs": [
                    {
                        "name": "date_range",
                        "value": "last_30_days"
                    },
                    {
                        "name": "limit",
                        "value": "50"
                    }
                ],
                "bodyType": "raw",
                "parseResponse": true,
                "authUser": "",
                "authPass": "",
                "timeout": null,
                "shareCookies": false,
                "ca": "",
                "rejectUnauthorized": true,
                "followRedirect": true,
                "useQuerystring": false,
                "gzip": true,
                "useMtls": false,
                "contentType": "application/json",
                "data": "",
                "followAllRedirects": false
            },
            "metadata": {
                "designer": {
                    "x": 600,
                    "y": 0,
                    "name": "Published messages report (last 30 days)"
                },
                "notes": "Per published message: clicks, leads, sales, revenue, likes, comments and\ncustom conversions. date_range accepts all | last_30_days | last_60_days |\nlast_90_days, or send from_utc / to_utc instead for a custom range."
            }
        },
        {
            "id": 4,
            "module": "builtin:BasicFeeder",
            "version": 1,
            "parameters": {},
            "mapper": {
                "array": "{{3.data.messages}}"
            },
            "metadata": {
                "designer": {
                    "x": 900,
                    "y": 0,
                    "name": "Iterate published messages"
                },
                "notes": "REPORT + ITERATOR (modules 2-4)\n-------------------------------\nModule 2 lists your workspaces. Module 3 reads the published-messages report\nfor the first one \u2014 its workspace id is mapped in from module 2, so there is\nnothing to fill in.\n\nModule 4 is an Iterator, and it is the point of this branch. The API returns\nthe rows INSIDE an array (messages[] here, campaigns[] on the campaigns\nreport). Make collapses an array into a single bundle unless you iterate it,\nso without an Iterator you can only map the first row. Feed the array into an\nIterator and every following module sees one row at a time.\n\nSame pattern for the campaigns report:\n  https://www.sociamonials.com/api/v1/workspaces/<id>/campaigns-report\n  Iterator array: {{3.data.campaigns}}"
            }
        }
    ],
    "metadata": {
        "version": 1,
        "scenario": {
            "roundtrips": 1,
            "autoCommit": true
        }
    }
}