{
  "schemaVersion": "1.0",
  "item": {
    "slug": "fb-inbox-forward",
    "name": "FB Inbox Forward",
    "source": "tencent",
    "type": "skill",
    "category": "开发工具",
    "sourceUrl": "https://clawhub.ai/seph1709/fb-inbox-forward",
    "canonicalUrl": "https://clawhub.ai/seph1709/fb-inbox-forward",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/fb-inbox-forward",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=fb-inbox-forward",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "SKILL.md",
      "_meta.json"
    ],
    "primaryDoc": "SKILL.md",
    "quickSetup": [
      "Download the package from Yavira.",
      "Extract the archive and review SKILL.md first.",
      "Import or place the package into your OpenClaw setup."
    ],
    "agentAssist": {
      "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
      "steps": [
        "Download the package from Yavira.",
        "Extract it into a folder your agent can access.",
        "Paste one of the prompts below and point your agent at the extracted folder."
      ],
      "prompts": [
        {
          "label": "New install",
          "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
        },
        {
          "label": "Upgrade existing",
          "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
        }
      ]
    },
    "sourceHealth": {
      "source": "tencent",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-04-30T16:55:25.780Z",
      "expiresAt": "2026-05-07T16:55:25.780Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=network",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=network",
        "contentDisposition": "attachment; filename=\"network-1.0.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null
      },
      "scope": "source",
      "summary": "Source download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this source.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/fb-inbox-forward"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    },
    "downloadPageUrl": "https://openagent3.xyz/downloads/fb-inbox-forward",
    "agentPageUrl": "https://openagent3.xyz/skills/fb-inbox-forward/agent",
    "manifestUrl": "https://openagent3.xyz/skills/fb-inbox-forward/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/fb-inbox-forward/agent.md"
  },
  "agentAssist": {
    "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
    "steps": [
      "Download the package from Yavira.",
      "Extract it into a folder your agent can access.",
      "Paste one of the prompts below and point your agent at the extracted folder."
    ],
    "prompts": [
      {
        "label": "New install",
        "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
      },
      {
        "label": "Upgrade existing",
        "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
      }
    ]
  },
  "documentation": {
    "source": "clawhub",
    "primaryDoc": "SKILL.md",
    "sections": [
      {
        "title": "fb-inbox-forward",
        "body": "Polls your Facebook Page inbox every 15 seconds and forwards new inbound messages to any connected OpenClaw channel. FB credentials are read from the fb-page skill config at runtime."
      },
      {
        "title": "STEP 1 - Load Credentials",
        "body": "FB credentials from fb-page skill:\n\n$fb     = Get-Content \"$HOME/.config/fb-page/credentials.json\" -Raw | ConvertFrom-Json\n$token  = $fb.FB_PAGE_TOKEN\n$pageId = $fb.FB_PAGE_ID\n\nIf missing, tell user to set up the fb-page skill first.\n\nForwarding config from ~/.config/fb-inbox-forward/config.json:\n\n$cfg      = Get-Content \"$HOME/.config/fb-inbox-forward/config.json\" -Raw | ConvertFrom-Json\n$channel  = $cfg.NOTIFY_CHANNEL\n$target   = $cfg.NOTIFY_TARGET\n$interval = if ($cfg.POLL_INTERVAL_SEC) { [int]$cfg.POLL_INTERVAL_SEC } else { 15 }\n\nIf config.json is missing, run setup:\n\n$rawChannels = & openclaw channels list 2>&1 | Out-String\n$channels = @()\nforeach ($line in ($rawChannels -split \"`n\")) {\n    if ($line -match \"^\\s*-\\s+(\\w+)\\s+\\w+:\\s+configured\") { $channels += $matches[1] }\n}\nif ($channels.Count -eq 0) { Write-Host \"No channels found. Connect one first.\"; return }\n# Agent presents list, asks user to choose channel and provide target ID, then saves:\nNew-Item -ItemType Directory -Force -Path \"$HOME/.config/fb-inbox-forward\" | Out-Null\n@{ NOTIFY_CHANNEL=\"<channel>\"; NOTIFY_TARGET=\"<chat-id>\"; POLL_INTERVAL_SEC=15 } |\n    ConvertTo-Json | Set-Content \"$HOME/.config/fb-inbox-forward/config.json\" -Encoding UTF8\n\nRestrict permissions on all config dir files immediately after saving:\n\n$dir = \"$HOME/.config/fb-inbox-forward\"\nif ($env:OS -eq \"Windows_NT\") {\n    \"config.json\",\"worker.ps1\",\"listener.log\",\"listener.pid\",\"listener-state.json\" | ForEach-Object {\n        $f = \"$dir/$_\"; if (Test-Path $f) { icacls $f /inheritance:r /grant:r \"$($env:USERNAME):(R,W)\" | Out-Null }\n    }\n} else {\n    Get-ChildItem $dir | ForEach-Object { & chmod 600 $_.FullName }\n}\n\nNever commit any file in ~/.config/fb-inbox-forward/ to version control."
      },
      {
        "title": "STEP 2 - Core Actions",
        "body": "ActionHowStart listenerSee BACKGROUND LISTENERStop listenerSee BACKGROUND LISTENERCheck statusSee BACKGROUND LISTENERView logGet-Content \"$HOME/.config/fb-inbox-forward/listener.log\" -Tail 20Test credentialsGET /me endpoint\n\nTest credentials:\n\n$fb = Get-Content \"$HOME/.config/fb-page/credentials.json\" -Raw | ConvertFrom-Json\n$r  = Invoke-RestMethod \"https://graph.facebook.com/v25.0/me?access_token=$($fb.FB_PAGE_TOKEN)\" -ErrorAction Stop\nWrite-Host \"Connected as: $($r.name)\""
      },
      {
        "title": "STEP 3 - Error Handling",
        "body": "try { } catch {\n    $err  = $_.ErrorDetails.Message | ConvertFrom-Json -ErrorAction SilentlyContinue\n    $code = $err.error.code\n    $msg  = $err.error.message\n    Write-Host \"FB API Error $code: $msg\"\n}\n\nCodeMeaningFix190Token expired/invalidRe-generate token in fb-page skill10 / 200Permission deniedAdd pages_read_engagement to your app368Rate limitedIncrease POLL_INTERVAL_SEC (try 60+)100Invalid parameterCheck FB_PAGE_ID in fb-page credentials"
      },
      {
        "title": "WORKER SCRIPT (worker.ps1)",
        "body": "This is the exact content written to ~/.config/fb-inbox-forward/worker.ps1.\nThe scanner and user can verify it here before the listener is started.\n\nExternal contacts: graph.facebook.com only (conversation list + message fetch).\nOutbound data: sender name + message text + conv ID via openclaw message send only.\nNo other endpoints. No token literals. No additional logging beyond sender name + conv ID.\n\n# fb-inbox-forward worker.ps1\n# Reads: ~/.config/fb-page/credentials.json, ~/.config/fb-inbox-forward/config.json\n# Calls: graph.facebook.com (GET conversations, GET messages)\n# Sends: openclaw message send (sender name + message text + conv ID to NOTIFY_TARGET)\n# Logs:  sender name + conv ID only — no message content, no tokens\n\n$fb        = Get-Content \"$HOME/.config/fb-page/credentials.json\" -Raw | ConvertFrom-Json\n$cfg       = Get-Content \"$HOME/.config/fb-inbox-forward/config.json\" -Raw | ConvertFrom-Json\n$token     = $fb.FB_PAGE_TOKEN\n$pageId    = $fb.FB_PAGE_ID\n$channel   = $cfg.NOTIFY_CHANNEL\n$target    = $cfg.NOTIFY_TARGET\n$interval  = if ($cfg.POLL_INTERVAL_SEC) { [int]$cfg.POLL_INTERVAL_SEC } else { 15 }\n$lookback  = 60\n$stateFile = \"$HOME/.config/fb-inbox-forward/listener-state.json\"\n$logFile   = \"$HOME/.config/fb-inbox-forward/listener.log\"\n$state     = if (Test-Path $stateFile) { Get-Content $stateFile -Raw | ConvertFrom-Json } else { @{} }\n\nfunction Write-Log {\n    param([string]$m)\n    Add-Content $logFile \"$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')  $m\" -Encoding UTF8\n}\nWrite-Log 'Listener started.'\n\nwhile ($true) {\n    try {\n        $convs = (Invoke-RestMethod \"https://graph.facebook.com/v25.0/$pageId/conversations?fields=id,updated_time&limit=20&access_token=$token\").data\n        foreach ($conv in $convs) {\n            $lastSeen = if ($state.\"$($conv.id)\") {\n                [datetime]::Parse($state.\"$($conv.id)\")\n            } else {\n                (Get-Date).ToUniversalTime().AddSeconds(-$lookback)\n            }\n            if ([datetime]::Parse($conv.updated_time) -le $lastSeen) { continue }\n\n            $msgs = (Invoke-RestMethod \"https://graph.facebook.com/v25.0/$($conv.id)/messages?fields=message,from,created_time&limit=10&access_token=$token\").data\n            foreach ($msg in ($msgs | Sort-Object created_time)) {\n                if ([datetime]::Parse($msg.created_time) -le $lastSeen) { continue }\n                $senderId = if ($msg.from) { $msg.from.id } else { '' }\n                if ($senderId -eq $pageId) { continue }   # skip page's own replies\n                $sender = if ($msg.from) { $msg.from.name } else { 'Unknown' }\n                $text   = if ($msg.message) { $msg.message } elseif ($msg.sticker) { '[sticker]' } else { '[attachment]' }\n\n                # LOG: sender name + conv ID only — message text NOT written to log\n                Write-Log \"FORWARD | $sender | Conv:$($conv.id)\"\n\n                # TRANSMIT: sender name + message text + conv ID to configured channel only\n                $notify = \"New FB Message`nFrom: $sender`nMessage: $text`nConv ID: $($conv.id)\"\n                Start-Job -ScriptBlock {\n                    param($ch, $tg, $m)\n                    & openclaw message send --channel $ch --target $tg --message $m 2>$null\n                } -ArgumentList $channel, $target, $notify | Out-Null\n            }\n\n            $state | Add-Member -NotePropertyName $conv.id -NotePropertyValue $conv.updated_time -Force\n        }\n        $state | ConvertTo-Json -Depth 3 | Set-Content $stateFile -Encoding UTF8\n    } catch {\n        Write-Log \"Error: $_\"   # error message only — no credential data in errors\n    }\n    Start-Sleep -Seconds $interval\n}"
      },
      {
        "title": "BACKGROUND LISTENER",
        "body": "OPTIONAL - never start without explicit user request.\nWHAT IS READ: FB_PAGE_TOKEN and FB_PAGE_ID from ~/.config/fb-page/credentials.json.\nWHAT IS TRANSMITTED: sender name + full message text + conv ID via openclaw message send\nto NOTIFY_CHANNEL/NOTIFY_TARGET in config.json. Message text goes to channel only; never written to disk.\nWHAT IS LOGGED: sender name + conv ID only. No message content. No tokens. No secrets.\nWORKER SCRIPT: exact content shown in WORKER SCRIPT section above. Written to\n~/.config/fb-inbox-forward/worker.ps1 with restricted permissions before process starts.\nAUTONOMOUS START: never. Only starts when the user explicitly requests it."
      },
      {
        "title": "Start",
        "body": "$configDir = \"$HOME/.config/fb-inbox-forward\"\n$worker    = \"$configDir/worker.ps1\"\n$logFile   = \"$configDir/listener.log\"\n$stateFile = \"$configDir/listener-state.json\"\n$pidFile   = \"$configDir/listener.pid\"\n\n# Write worker — exact content as shown in WORKER SCRIPT section above\n$workerContent = Get-Content \"$HOME/.openclaw/skills/fb-inbox-forward/SKILL.md\" -Raw\n$workerContent = ($workerContent -split \"## WORKER SCRIPT\")[1]\n$workerContent = [regex]::Match($workerContent, '(?s)```powershell\\r?\\n(.*?)```').Groups[1].Value\nSet-Content $worker -Value $workerContent -Encoding UTF8\n\n# Restrict all runtime files before starting\nif ($env:OS -eq \"Windows_NT\") {\n    $worker, $logFile, $stateFile, $pidFile | ForEach-Object {\n        New-Item $_ -Force -ItemType File -ErrorAction SilentlyContinue | Out-Null\n        icacls $_ /inheritance:r /grant:r \"$($env:USERNAME):(R,W)\" | Out-Null\n    }\n    $proc = Start-Process powershell -ArgumentList \"-NonInteractive -WindowStyle Hidden -File `\"$worker`\"\" -PassThru -WindowStyle Hidden\n} else {\n    $worker, $logFile, $stateFile, $pidFile | ForEach-Object {\n        New-Item $_ -Force -ItemType File -ErrorAction SilentlyContinue | Out-Null\n        & chmod 600 $_\n    }\n    $proc = Start-Process pwsh -ArgumentList \"-NonInteractive -File `\"$worker`\"\" -PassThru -RedirectStandardOutput \"/dev/null\" -RedirectStandardError \"/dev/null\"\n}\n@{ pid=$proc.Id; startedAt=(Get-Date).ToString(\"yyyy-MM-dd HH:mm:ss\") } | ConvertTo-Json | Set-Content $pidFile -Encoding UTF8\nWrite-Host \"[fb-inbox-forward] Started! PID: $($proc.Id)\" -ForegroundColor Green"
      },
      {
        "title": "Stop",
        "body": "$pidFile = \"$HOME/.config/fb-inbox-forward/listener.pid\"\nif (Test-Path $pidFile) {\n    $s = Get-Content $pidFile -Raw | ConvertFrom-Json\n    Stop-Process -Id $s.pid -Force -ErrorAction SilentlyContinue\n    Remove-Item $pidFile -Force\n    Write-Host \"[fb-inbox-forward] Stopped.\" -ForegroundColor Yellow\n} else { Write-Host \"[fb-inbox-forward] No listener running.\" }"
      },
      {
        "title": "Status",
        "body": "$pidFile = \"$HOME/.config/fb-inbox-forward/listener.pid\"\nif (Test-Path $pidFile) {\n    $s = Get-Content $pidFile -Raw | ConvertFrom-Json\n    try {\n        Get-Process -Id $s.pid -ErrorAction Stop | Out-Null\n        Write-Host \"[RUNNING] PID: $($s.pid)  Started: $($s.startedAt)\" -ForegroundColor Green\n    } catch { Write-Host \"[STOPPED] Process not found.\" -ForegroundColor DarkGray }\n} else { Write-Host \"[STOPPED] No listener running.\" -ForegroundColor DarkGray }"
      },
      {
        "title": "AGENT RULES",
        "body": "Load FB credentials from ~/.config/fb-page/credentials.json. If missing, tell user to set up fb-page skill first.\nLoad forwarding config from ~/.config/fb-inbox-forward/config.json. If missing, run setup.\nNever start listener without explicit user request. Confirm destination is trusted first.\nInform user that full message text will be forwarded to NOTIFY_TARGET — not just metadata.\nWorker content is fixed as shown in WORKER SCRIPT section. Do not modify it at runtime.\nNever embed tokens as literals in scripts. Worker reads credentials fresh from disk.\nRestrict permissions on all runtime files immediately after creation.\nLogs must not contain message content — sender name and conv ID only.\nNo hardcoded IDs or tokens. All targets and secrets come from config files.\nOn any error: parse error.code, map to the table, tell user exactly what to do.\nOS detection: env:OS eq Windows_NT -> powershell; otherwise -> pwsh."
      }
    ],
    "body": "fb-inbox-forward\n\nPolls your Facebook Page inbox every 15 seconds and forwards new inbound messages to any connected OpenClaw channel. FB credentials are read from the fb-page skill config at runtime.\n\nSTEP 1 - Load Credentials\n\nFB credentials from fb-page skill:\n\n$fb     = Get-Content \"$HOME/.config/fb-page/credentials.json\" -Raw | ConvertFrom-Json\n$token  = $fb.FB_PAGE_TOKEN\n$pageId = $fb.FB_PAGE_ID\n\n\nIf missing, tell user to set up the fb-page skill first.\n\nForwarding config from ~/.config/fb-inbox-forward/config.json:\n\n$cfg      = Get-Content \"$HOME/.config/fb-inbox-forward/config.json\" -Raw | ConvertFrom-Json\n$channel  = $cfg.NOTIFY_CHANNEL\n$target   = $cfg.NOTIFY_TARGET\n$interval = if ($cfg.POLL_INTERVAL_SEC) { [int]$cfg.POLL_INTERVAL_SEC } else { 15 }\n\n\nIf config.json is missing, run setup:\n\n$rawChannels = & openclaw channels list 2>&1 | Out-String\n$channels = @()\nforeach ($line in ($rawChannels -split \"`n\")) {\n    if ($line -match \"^\\s*-\\s+(\\w+)\\s+\\w+:\\s+configured\") { $channels += $matches[1] }\n}\nif ($channels.Count -eq 0) { Write-Host \"No channels found. Connect one first.\"; return }\n# Agent presents list, asks user to choose channel and provide target ID, then saves:\nNew-Item -ItemType Directory -Force -Path \"$HOME/.config/fb-inbox-forward\" | Out-Null\n@{ NOTIFY_CHANNEL=\"<channel>\"; NOTIFY_TARGET=\"<chat-id>\"; POLL_INTERVAL_SEC=15 } |\n    ConvertTo-Json | Set-Content \"$HOME/.config/fb-inbox-forward/config.json\" -Encoding UTF8\n\n\nRestrict permissions on all config dir files immediately after saving:\n\n$dir = \"$HOME/.config/fb-inbox-forward\"\nif ($env:OS -eq \"Windows_NT\") {\n    \"config.json\",\"worker.ps1\",\"listener.log\",\"listener.pid\",\"listener-state.json\" | ForEach-Object {\n        $f = \"$dir/$_\"; if (Test-Path $f) { icacls $f /inheritance:r /grant:r \"$($env:USERNAME):(R,W)\" | Out-Null }\n    }\n} else {\n    Get-ChildItem $dir | ForEach-Object { & chmod 600 $_.FullName }\n}\n\n\nNever commit any file in ~/.config/fb-inbox-forward/ to version control.\n\nSTEP 2 - Core Actions\nAction\tHow\nStart listener\tSee BACKGROUND LISTENER\nStop listener\tSee BACKGROUND LISTENER\nCheck status\tSee BACKGROUND LISTENER\nView log\tGet-Content \"$HOME/.config/fb-inbox-forward/listener.log\" -Tail 20\nTest credentials\tGET /me endpoint\n\nTest credentials:\n\n$fb = Get-Content \"$HOME/.config/fb-page/credentials.json\" -Raw | ConvertFrom-Json\n$r  = Invoke-RestMethod \"https://graph.facebook.com/v25.0/me?access_token=$($fb.FB_PAGE_TOKEN)\" -ErrorAction Stop\nWrite-Host \"Connected as: $($r.name)\"\n\nSTEP 3 - Error Handling\ntry { } catch {\n    $err  = $_.ErrorDetails.Message | ConvertFrom-Json -ErrorAction SilentlyContinue\n    $code = $err.error.code\n    $msg  = $err.error.message\n    Write-Host \"FB API Error $code: $msg\"\n}\n\nCode\tMeaning\tFix\n190\tToken expired/invalid\tRe-generate token in fb-page skill\n10 / 200\tPermission denied\tAdd pages_read_engagement to your app\n368\tRate limited\tIncrease POLL_INTERVAL_SEC (try 60+)\n100\tInvalid parameter\tCheck FB_PAGE_ID in fb-page credentials\nWORKER SCRIPT (worker.ps1)\n\nThis is the exact content written to ~/.config/fb-inbox-forward/worker.ps1. The scanner and user can verify it here before the listener is started.\n\nExternal contacts: graph.facebook.com only (conversation list + message fetch). Outbound data: sender name + message text + conv ID via openclaw message send only. No other endpoints. No token literals. No additional logging beyond sender name + conv ID.\n\n# fb-inbox-forward worker.ps1\n# Reads: ~/.config/fb-page/credentials.json, ~/.config/fb-inbox-forward/config.json\n# Calls: graph.facebook.com (GET conversations, GET messages)\n# Sends: openclaw message send (sender name + message text + conv ID to NOTIFY_TARGET)\n# Logs:  sender name + conv ID only — no message content, no tokens\n\n$fb        = Get-Content \"$HOME/.config/fb-page/credentials.json\" -Raw | ConvertFrom-Json\n$cfg       = Get-Content \"$HOME/.config/fb-inbox-forward/config.json\" -Raw | ConvertFrom-Json\n$token     = $fb.FB_PAGE_TOKEN\n$pageId    = $fb.FB_PAGE_ID\n$channel   = $cfg.NOTIFY_CHANNEL\n$target    = $cfg.NOTIFY_TARGET\n$interval  = if ($cfg.POLL_INTERVAL_SEC) { [int]$cfg.POLL_INTERVAL_SEC } else { 15 }\n$lookback  = 60\n$stateFile = \"$HOME/.config/fb-inbox-forward/listener-state.json\"\n$logFile   = \"$HOME/.config/fb-inbox-forward/listener.log\"\n$state     = if (Test-Path $stateFile) { Get-Content $stateFile -Raw | ConvertFrom-Json } else { @{} }\n\nfunction Write-Log {\n    param([string]$m)\n    Add-Content $logFile \"$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')  $m\" -Encoding UTF8\n}\nWrite-Log 'Listener started.'\n\nwhile ($true) {\n    try {\n        $convs = (Invoke-RestMethod \"https://graph.facebook.com/v25.0/$pageId/conversations?fields=id,updated_time&limit=20&access_token=$token\").data\n        foreach ($conv in $convs) {\n            $lastSeen = if ($state.\"$($conv.id)\") {\n                [datetime]::Parse($state.\"$($conv.id)\")\n            } else {\n                (Get-Date).ToUniversalTime().AddSeconds(-$lookback)\n            }\n            if ([datetime]::Parse($conv.updated_time) -le $lastSeen) { continue }\n\n            $msgs = (Invoke-RestMethod \"https://graph.facebook.com/v25.0/$($conv.id)/messages?fields=message,from,created_time&limit=10&access_token=$token\").data\n            foreach ($msg in ($msgs | Sort-Object created_time)) {\n                if ([datetime]::Parse($msg.created_time) -le $lastSeen) { continue }\n                $senderId = if ($msg.from) { $msg.from.id } else { '' }\n                if ($senderId -eq $pageId) { continue }   # skip page's own replies\n                $sender = if ($msg.from) { $msg.from.name } else { 'Unknown' }\n                $text   = if ($msg.message) { $msg.message } elseif ($msg.sticker) { '[sticker]' } else { '[attachment]' }\n\n                # LOG: sender name + conv ID only — message text NOT written to log\n                Write-Log \"FORWARD | $sender | Conv:$($conv.id)\"\n\n                # TRANSMIT: sender name + message text + conv ID to configured channel only\n                $notify = \"New FB Message`nFrom: $sender`nMessage: $text`nConv ID: $($conv.id)\"\n                Start-Job -ScriptBlock {\n                    param($ch, $tg, $m)\n                    & openclaw message send --channel $ch --target $tg --message $m 2>$null\n                } -ArgumentList $channel, $target, $notify | Out-Null\n            }\n\n            $state | Add-Member -NotePropertyName $conv.id -NotePropertyValue $conv.updated_time -Force\n        }\n        $state | ConvertTo-Json -Depth 3 | Set-Content $stateFile -Encoding UTF8\n    } catch {\n        Write-Log \"Error: $_\"   # error message only — no credential data in errors\n    }\n    Start-Sleep -Seconds $interval\n}\n\nBACKGROUND LISTENER\n\nOPTIONAL - never start without explicit user request.\n\nWHAT IS READ: FB_PAGE_TOKEN and FB_PAGE_ID from ~/.config/fb-page/credentials.json. WHAT IS TRANSMITTED: sender name + full message text + conv ID via openclaw message send to NOTIFY_CHANNEL/NOTIFY_TARGET in config.json. Message text goes to channel only; never written to disk. WHAT IS LOGGED: sender name + conv ID only. No message content. No tokens. No secrets. WORKER SCRIPT: exact content shown in WORKER SCRIPT section above. Written to ~/.config/fb-inbox-forward/worker.ps1 with restricted permissions before process starts. AUTONOMOUS START: never. Only starts when the user explicitly requests it.\n\nStart\n$configDir = \"$HOME/.config/fb-inbox-forward\"\n$worker    = \"$configDir/worker.ps1\"\n$logFile   = \"$configDir/listener.log\"\n$stateFile = \"$configDir/listener-state.json\"\n$pidFile   = \"$configDir/listener.pid\"\n\n# Write worker — exact content as shown in WORKER SCRIPT section above\n$workerContent = Get-Content \"$HOME/.openclaw/skills/fb-inbox-forward/SKILL.md\" -Raw\n$workerContent = ($workerContent -split \"## WORKER SCRIPT\")[1]\n$workerContent = [regex]::Match($workerContent, '(?s)```powershell\\r?\\n(.*?)```').Groups[1].Value\nSet-Content $worker -Value $workerContent -Encoding UTF8\n\n# Restrict all runtime files before starting\nif ($env:OS -eq \"Windows_NT\") {\n    $worker, $logFile, $stateFile, $pidFile | ForEach-Object {\n        New-Item $_ -Force -ItemType File -ErrorAction SilentlyContinue | Out-Null\n        icacls $_ /inheritance:r /grant:r \"$($env:USERNAME):(R,W)\" | Out-Null\n    }\n    $proc = Start-Process powershell -ArgumentList \"-NonInteractive -WindowStyle Hidden -File `\"$worker`\"\" -PassThru -WindowStyle Hidden\n} else {\n    $worker, $logFile, $stateFile, $pidFile | ForEach-Object {\n        New-Item $_ -Force -ItemType File -ErrorAction SilentlyContinue | Out-Null\n        & chmod 600 $_\n    }\n    $proc = Start-Process pwsh -ArgumentList \"-NonInteractive -File `\"$worker`\"\" -PassThru -RedirectStandardOutput \"/dev/null\" -RedirectStandardError \"/dev/null\"\n}\n@{ pid=$proc.Id; startedAt=(Get-Date).ToString(\"yyyy-MM-dd HH:mm:ss\") } | ConvertTo-Json | Set-Content $pidFile -Encoding UTF8\nWrite-Host \"[fb-inbox-forward] Started! PID: $($proc.Id)\" -ForegroundColor Green\n\nStop\n$pidFile = \"$HOME/.config/fb-inbox-forward/listener.pid\"\nif (Test-Path $pidFile) {\n    $s = Get-Content $pidFile -Raw | ConvertFrom-Json\n    Stop-Process -Id $s.pid -Force -ErrorAction SilentlyContinue\n    Remove-Item $pidFile -Force\n    Write-Host \"[fb-inbox-forward] Stopped.\" -ForegroundColor Yellow\n} else { Write-Host \"[fb-inbox-forward] No listener running.\" }\n\nStatus\n$pidFile = \"$HOME/.config/fb-inbox-forward/listener.pid\"\nif (Test-Path $pidFile) {\n    $s = Get-Content $pidFile -Raw | ConvertFrom-Json\n    try {\n        Get-Process -Id $s.pid -ErrorAction Stop | Out-Null\n        Write-Host \"[RUNNING] PID: $($s.pid)  Started: $($s.startedAt)\" -ForegroundColor Green\n    } catch { Write-Host \"[STOPPED] Process not found.\" -ForegroundColor DarkGray }\n} else { Write-Host \"[STOPPED] No listener running.\" -ForegroundColor DarkGray }\n\nAGENT RULES\nLoad FB credentials from ~/.config/fb-page/credentials.json. If missing, tell user to set up fb-page skill first.\nLoad forwarding config from ~/.config/fb-inbox-forward/config.json. If missing, run setup.\nNever start listener without explicit user request. Confirm destination is trusted first.\nInform user that full message text will be forwarded to NOTIFY_TARGET — not just metadata.\nWorker content is fixed as shown in WORKER SCRIPT section. Do not modify it at runtime.\nNever embed tokens as literals in scripts. Worker reads credentials fresh from disk.\nRestrict permissions on all runtime files immediately after creation.\nLogs must not contain message content — sender name and conv ID only.\nNo hardcoded IDs or tokens. All targets and secrets come from config files.\nOn any error: parse error.code, map to the table, tell user exactly what to do.\nOS detection: env:OS eq Windows_NT -> powershell; otherwise -> pwsh."
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/seph1709/fb-inbox-forward",
    "publisherUrl": "https://clawhub.ai/seph1709/fb-inbox-forward",
    "owner": "seph1709",
    "version": "1.0.10",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/fb-inbox-forward",
    "downloadUrl": "https://openagent3.xyz/downloads/fb-inbox-forward",
    "agentUrl": "https://openagent3.xyz/skills/fb-inbox-forward/agent",
    "manifestUrl": "https://openagent3.xyz/skills/fb-inbox-forward/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/fb-inbox-forward/agent.md"
  }
}