{
  "elementsLearnedData": [],
  "elementsTestData": [],
  "flow": {
    "id": "9F53B058-49DF-4996-ADD3-573B5E24DB06",
    "name": "xpost: failed delivery fixed on one network"
  },
  "flowVersion": {
    "clientMetadata": {
      "viewport": {
        "x": -70,
        "y": 0,
        "zoom": 1
      },
      "autoSave": false,
      "descriptions": {
        "flow": "When xpost reports a post that failed on one or more networks, reads the delivery receipt, retries only the deliveries that failed for a passing reason, and tells the account owner in Telegram about any failure a person has to fix.",
        "initialData": "",
        "initialDataFields": {}
      }
    },
    "description": "When xpost reports a post that failed on one or more networks, reads the delivery receipt, retries only the deliveries that failed for a passing reason, and tells the account owner in Telegram about any failure a person has to fix.",
    "elements": [
      {
        "clientMetadata": {
          "notes": "Sends a text message to a specified chat, group, or channel.",
          "elementId": "EXTENSION:::SHARED:::default:::telegram:::sendMessage",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Tell the account owner in Telegram Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::telegram:::sendMessage",
          "legacyElementId": "JS###v1###Telegram###sendMessage",
          "methodName": "sendMessage",
          "position": {
            "x": 766,
            "y": 210
          }
        },
        "flowElementId": "64D4E7FB-05C1-4AEE-990A-77800CCE7689",
        "groupId": null,
        "id": "F48E5569-DFC3-4DEE-8D37-7A5B738AA118",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "chatId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Telegram chat",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Telegram chat"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "text",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Failure sort",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      },
                      {
                        "key": "message",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "8D51A8CC-8C38-444A-A877-741EFB72CC70"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "parseMode",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "disableWebPagePreview",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_TRUE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": true
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "disableNotification",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_FALSE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": false
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "replyToMessageId",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": "Block: 'Tell the account owner in Telegram', Error: The placeholder \"Telegram chat\" has no value",
            "valid": false
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "sendMessage",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Owner message",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "telegram",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Tell the account owner in Telegram",
        "nextElementIds": [],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Fires when a post could not go out on at least one account after every retry, a partly published post included. Each failed delivery carries the network's reason.",
          "elementId": "EXTENSION:::SHARED:::default:::xpost:::onPostFailed",
          "isFirstElement": true,
          "blockDefinitionId": "api-service-trigger",
          "newElementId": "EXTENSION:::SHARED:::default:::xpost:::onPostFailed",
          "legacyElementId": null,
          "methodName": "onPostFailed",
          "position": {
            "x": 110,
            "y": 40
          }
        },
        "flowElementId": "1F20C533-1F2D-4B98-BA38-47D8EA0F9943",
        "groupId": null,
        "id": "7384338D-2FF9-42D5-9ECD-2A542BBDE507",
        "metaInfo": {
          "callbackUrl": null,
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": null,
          "connectionId": null,
          "eventName": "onPostFailed",
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": null
          },
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Failed post",
          "scope": "SINGLE_APP",
          "serviceId": "xpost",
          "slaConditions": [],
          "staticData": {},
          "storeResult": true,
          "subtype": "REALTIME",
          "type": "CUSTOM"
        },
        "name": "Post failed on a network",
        "nextElementIds": [
          "85F5C419-66AC-474B-9DB0-D599C341D73E"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "TRIGGER"
      },
      {
        "clientMetadata": {
          "notes": "Returns a post's delivery receipt, one row per account: status, retries, the live link on success or the reason on failure, and a note where less was published than attached.",
          "elementId": "EXTENSION:::SHARED:::default:::xpost:::getDeliveryReceipts",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Read the delivery receipt Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::xpost:::getDeliveryReceipts",
          "legacyElementId": null,
          "methodName": "getDeliveryReceipts",
          "position": {
            "x": 435,
            "y": 40
          }
        },
        "flowElementId": "0566B8FA-3E05-477B-A0B3-1BFFD138A000",
        "groupId": null,
        "id": "85F5C419-66AC-474B-9DB0-D599C341D73E",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "postId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "Failed post",
                    "subPathSegments": [
                      {
                        "key": "data",
                        "optional": false
                      },
                      {
                        "key": "post",
                        "optional": false
                      },
                      {
                        "key": "id",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "7384338D-2FF9-42D5-9ECD-2A542BBDE507"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "getDeliveryReceipts",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Receipt",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "xpost",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Read the delivery receipt",
        "nextElementIds": [
          "8D51A8CC-8C38-444A-A877-741EFB72CC70"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 1166,
            "y": 219
          }
        },
        "flowElementId": "D1AE9E7B-0780-488A-8E39-8D3C55D3305A",
        "groupId": null,
        "id": "5FAA9EA9-E51F-4A72-B82F-A2E55EA5BFAB",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "33174ea2-345d-4d47-80d9-a4fdf6900bd0",
                "nestedOperation": null,
                "operation": "arrayIsNotEmpty",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "Failure sort",
                      "subPathSegments": [
                        {
                          "key": "output",
                          "optional": false
                        },
                        {
                          "key": "forOwner",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "8D51A8CC-8C38-444A-A877-741EFB72CC70"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "ARRAY",
                "values": []
              }
            ],
            "grouping": [
              "33174ea2-345d-4d47-80d9-a4fdf6900bd0"
            ]
          },
          "elseComponent": null,
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "For owner",
          "storeResult": false,
          "thenComponent": {
            "componentId": "F48E5569-DFC3-4DEE-8D37-7A5B738AA118",
            "componentType": "ELEMENT"
          }
        },
        "name": "Anything for the owner?",
        "nextElementIds": [
          "F48E5569-DFC3-4DEE-8D37-7A5B738AA118"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "elementId": "ai-agent",
          "isFirstElement": false,
          "blockDefinitionId": "ai-agent",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Sort the failures Result"
          },
          "tools": {},
          "position": {
            "x": 816,
            "y": 49
          }
        },
        "flowElementId": "106E3A91-DB82-4454-9D1C-111ECD63B03E",
        "groupId": null,
        "id": "8D51A8CC-8C38-444A-A877-741EFB72CC70",
        "metaInfo": {
          "aiApiKey": null,
          "aiModel": "claude-sonnet-5",
          "aiProvider": "ANTHROPIC",
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "dynamicAiApiKey": {
            "expression": [
              {
                "id": "PLACEHOLDER_DATA",
                "label": "Anthropic key",
                "subPathSegments": null,
                "type": "EXECUTION_CONTEXT_STATIC_DATA",
                "value": "Anthropic key"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "files": [],
          "forceParsedOutput": true,
          "langSmithSettings": {
            "enabled": false,
            "apiKey": null,
            "projectName": null,
            "label": "FlowRunner AI-Agent",
            "accountCluster": "US"
          },
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "messagesHistoryEnabled": false,
          "messagesHistoryLimit": 15,
          "onFailElemId": null,
          "resultAlias": "Failure sort",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "systemPrompt": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "xpost reported a post that could not go out on at least one account after its own retries. You get the post, the event's list of deliveries (network, username, status, reason) and the delivery receipt (one row per account, with the delivery id, network, status, plain_reason and error_code).\n\nSort every delivery whose status is failed:\n- retry: the reason is passing and sending the same post again can work, such as a rate limit, a timeout, the network being unavailable or a temporary server error.\n- forOwner: a person has to act first, such as a login that needs renewing, missing permission, media the network requires, a caption that is too long, a duplicate post or a policy refusal.\nNever put a delivery that succeeded in either list. When you are unsure, put it in forOwner.\n\nMatch receipt rows to usernames by network.\n\nReply with JSON only, with these fields:\nretry: list of { deliveryId, network, account }\nforOwner: list of { network, account, reason, fix }\nmessage: plain text for the person who looks after the accounts, written only when forOwner is not empty, otherwise empty text. Start with the first 80 characters of the caption in quotes, then one line per account in forOwner: network and @account, the network's reason in plain words, and what to do (for a login, sign in to the account again in xpost). End with one line naming any deliveries being retried. Then the post's receipt link if there is one. No markdown."
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "tools": [],
          "type": "AI_AGENT",
          "userPrompt": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "Post: "
              },
              {
                "id": "RESULT",
                "label": "Failed post",
                "subPathSegments": [
                  {
                    "key": "data",
                    "optional": false
                  },
                  {
                    "key": "post",
                    "optional": false
                  }
                ],
                "type": "TRIGGER_DATA",
                "value": "7384338D-2FF9-42D5-9ECD-2A542BBDE507"
              },
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "\n\nDeliveries in the event: "
              },
              {
                "id": "RESULT",
                "label": "Failed post",
                "subPathSegments": [
                  {
                    "key": "data",
                    "optional": false
                  },
                  {
                    "key": "deliveries",
                    "optional": false
                  }
                ],
                "type": "TRIGGER_DATA",
                "value": "7384338D-2FF9-42D5-9ECD-2A542BBDE507"
              },
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "\n\nDelivery receipt: "
              },
              {
                "id": "ELEMENT_RESULT",
                "label": "Receipt",
                "subPathSegments": [
                  {
                    "key": "data",
                    "optional": false
                  }
                ],
                "type": "ELEMENT_LINK",
                "value": "85F5C419-66AC-474B-9DB0-D599C341D73E"
              },
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "\nReceipt link: "
              },
              {
                "id": "ELEMENT_RESULT",
                "label": "Receipt",
                "subPathSegments": [
                  {
                    "key": "approval_url",
                    "optional": false
                  }
                ],
                "type": "ELEMENT_LINK",
                "value": "85F5C419-66AC-474B-9DB0-D599C341D73E"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          }
        },
        "name": "Sort the failures",
        "nextElementIds": [],
        "nextGroupIds": [
          "66049B47-5CEA-43B8-BDB7-035A6C0C097A"
        ],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Sends one failed delivery again. Use it when a post failed on one network: creating the post again would send a second copy to the accounts that worked. A delivery that succeeded is refused.",
          "elementId": "EXTENSION:::SHARED:::default:::xpost:::retryDelivery",
          "isFirstElement": true,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Retry that delivery Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::xpost:::retryDelivery",
          "legacyElementId": null,
          "methodName": "retryDelivery",
          "position": {
            "x": 110,
            "y": 220
          }
        },
        "flowElementId": "9D89A0A3-D196-4264-81D8-C942B17D1D87",
        "groupId": "66049B47-5CEA-43B8-BDB7-035A6C0C097A",
        "id": "7525096C-064D-4CD9-9612-920B1D498F03",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "postId",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "deliveryId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "label": null,
                    "subPathSegments": [
                      {
                        "key": "deliveryId",
                        "optional": false
                      }
                    ],
                    "type": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "value": "66049B47-5CEA-43B8-BDB7-035A6C0C097A"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "retryDelivery",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Retried",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "xpost",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Retry that delivery",
        "nextElementIds": [],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      }
    ],
    "firstElementId": "7384338D-2FF9-42D5-9ECD-2A542BBDE507",
    "groups": [
      {
        "clientMetadata": {
          "elementId": "list-iterator",
          "isFirstElement": false,
          "blockDefinitionId": "list-iterator",
          "viewport": {
            "x": -70,
            "y": -180,
            "zoom": 1
          },
          "position": {
            "x": 1179,
            "y": 49
          }
        },
        "flowElementId": "B1AB54E6-00C2-45E1-BB60-A76D6D250F0F",
        "groupId": null,
        "id": "66049B47-5CEA-43B8-BDB7-035A6C0C097A",
        "loopType": "LIST_ITERATOR",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "enabled": true,
          "firstElementId": "7525096C-064D-4CD9-9612-920B1D498F03",
          "list": {
            "expression": [
              {
                "id": "ELEMENT_RESULT",
                "label": "Failure sort",
                "subPathSegments": [
                  {
                    "key": "output",
                    "optional": false
                  },
                  {
                    "key": "retry",
                    "optional": false
                  }
                ],
                "type": "ELEMENT_LINK",
                "value": "8D51A8CC-8C38-444A-A877-741EFB72CC70"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "onFailElemId": null,
          "resultAlias": "loop",
          "storeResult": true
        },
        "name": "Each passing failure",
        "nextElementIds": [
          "5FAA9EA9-E51F-4A72-B82F-A2E55EA5BFAB"
        ],
        "nextGroupIds": [],
        "type": "LOOP"
      }
    ],
    "id": "21EA73A9-A0AE-4B30-BACB-DDB2757C5CE8",
    "metaInfo": {
      "clientValidationState": {
        "errorMessage": "Please fix problems before start. Blocks with issues have red badge in the top-right corner of a block, hover it to see what needs to be done.",
        "valid": false
      },
      "errorMessage": "Please fix problems before start. Blocks with issues have red badge in the top-right corner of a block, hover it to see what needs to be done.",
      "executionStaticData": [
        {
          "description": "The Anthropic key the agent that sorts failures uses.",
          "error": null,
          "name": "Anthropic key",
          "type": "API_KEY",
          "value": null
        },
        {
          "description": "The Telegram chat ID of the person or group who looks after the social accounts. Your Telegram bot must be a member of that chat.",
          "error": null,
          "name": "Telegram chat",
          "type": "STRING",
          "value": ""
        }
      ],
      "initialData": null,
      "initialDataDefaultValues": {},
      "ownerFlowVersionId": null,
      "schedule": null,
      "sharedMemory": {
        "anchor": {
          "missingAnchorPolicy": null,
          "path": null,
          "type": "FLOW_MEMORY"
        },
        "expirationInSec": null
      },
      "wasLive": false
    }
  },
  "slaCalendars": [],
  "slaGoals": [],
  "subFlows": [],
  "exportDate": "2026-12-02T01:41:52.182Z"
}
