#Set a one-time cron job to send a reminder message to a Telegram chat.

1 messages ยท Page 1 of 1 (latest)

high kayak
#

Goal: Set a one-time cron job to send a reminder message to a Telegram chat.

Issue Observed:
Consistently receiving invalid cron.add params errors when calling the cron.add tool via Python API.
Specific error details:

  • payload object repeatedly flags text as unexpected and message as required, or vice versa, alongside payload/kind requiring an unknown constant value.
  • channel, to, and deliver are flagged as "unexpected properties" when placed at the root level of the job object or within the payload.

What We Tried:

  1. Attempted multiple variations of the cron.add command, adjusting channel, to, deliver placement and payload fields (text vs message, various payload.kind values).
  2. Reviewed Moltbot (Clawdbot) cron-jobs documentation ([REDACTED_DOC_URL]).
  3. Searched Discord via AnswerOverflow (/root/clawd/skills/answeroverflow/scripts/search.sh "clawdbot cron add payload sessionTarget"), finding relevant threads in "Friends of the Crustacean ๐Ÿฆž๐Ÿค" (Server ID: 1456350064065904867).
  4. Discord troubleshooting suggested:
    • payload.text when sessionTarget="isolated" and payload.kind="agentTurn".
    • channel, to, deliver as direct properties of the job object.
      Applying these suggestions to the Python API still resulted in the aforementioned errors.

My Environment:

  • Runtime Host: ubuntu (DigitalOcean VPS)
  • Operating System: Linux 5.15.0-164-generic (x64)
    Channel- telegram
pine thunderBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> โœ… Mark Solution

patent elm
#

I'm also facing this issue

left ember
#

@wet dock

wet dockBOT
# left ember <@1457407575476801641>

Based on the code, I can see the issue. The cron schema is strict about field placement. Here's the correct structure for adding a Telegram cron job:

Correct cron.add Parameters

await cron.add({
  name: "telegram-reminder",        // required
  enabled: true,
  deleteAfterRun: true,             // for one-time jobs
  schedule: {
    kind: "at",
    atMs: Date.now() + 86400000     // tomorrow (milliseconds!)
  },
  sessionTarget: "isolated",        // use "isolated" for Telegram
  wakeMode: "next-heartbeat",
  payload: {
#
    kind: "agentTurn",              // use agentTurn for messaging
    message: "Your reminder text here",
    channel: "telegram:CHANNEL_ID", // put channel HERE, not at root
    deliver: true
  }
})

Common Mistakes (What You Did Wrong)

| Wrong โŒ                             | Correct โœ…                            |
| ----------------------------------- | ------------------------------------ |
| `payload.text` with `kind: "agentTurn"` | `payload.message`                      |
| `channel`, `to`, `deliver` at job root    | Inside `payload` for `agentTurn`         |
| `schedule.at` (string)                | `schedule.atMs` (number, milliseconds) |
#
| `payload.kind` missing                | Must be `"systemEvent"` OR `"agentTurn"` |

For Telegram Specifically

payload: {
  kind: "agentTurn",
  message: "Hello from cron! ๐Ÿฆ",
  channel: "telegram:1466046890318758150"  // channel ID
}

Quick Debug

If you still get validation errors, enable debug logging: