runLater := run_later(Args{target_component_id: "...", schedule_when: "1d"})
send_text_message(Args{channel_id: trigger.channel_id, message_content: "Key: " + runLater.key})
BlockLogic
Run a custom block at a later time, like in 10 minutes or 3 days. Its inputs are saved when it's scheduled.
When is a duration from now (30s, 10m, 3d, 2w) or a Unix timestamp. Scheduling a key that's already scheduled replaces that run, or keeps it with "Keep Existing". The custom block runs on its own when it's due, without this flow's trigger, so pass in anything it needs (like a user or channel ID).
- Also takes the inputs defined by the custom block it runs.
Inputs
Custom BlockRequired
The custom block to run.
WhenRequired
A duration from now (30s, 10m, 3d) or a Unix timestamp.
Example: 1d
Key
Names the run so it can be replaced, checked or cancelled later. Leave empty to generate one.
Example: giveaway-123
If Key Is Scheduled
What to do when this key is already scheduled.
OptionsReplaceKeep Existing
Outputs
Key
The run's key, generated when none was given.
Example: giveaway-123
Run At (Unix)
When the custom block will run.
Example: 1700003600
Scheduled
False when the key was already scheduled and kept as it was.
Example: true
Build a bot using blocks like Run Later
Use this block in our visual flow editor. Bots are hosted 24/7 for free on inventor.bot.
Advanced Documentation
This documentation can be useful when using code mode.
ID:
run_later- Also takes the custom block's inputs as
Argskeys. See custom blocks.
Inputs
| Field | InventScript name | Value |
|---|---|---|
| Custom Block | target_component_id | |
| When | schedule_when | e.g. "1d" |
| Key | schedule_key | e.g. "giveaway-123" |
| If Key Is Scheduled | schedule_if_exists | "Replace", "Keep Existing" |
Outputs
| Field | InventScript name | Value |
|---|---|---|
| Key | key | e.g. "giveaway-123" |
| Run At (Unix) | run_at | e.g. "1700003600" |
| Scheduled | scheduled | e.g. "true" |
Example InventScript
More logic blocks
Cancel Scheduled RunCancel a run scheduled with Run Later, by its key.Get Scheduled RunCheck whether a run is scheduled with a key, and when it runs.CooldownLet the rest of the flow run once per key for a set time. While the key is on cooldown, the blocks inside run instead and the flow stops.LoopRun the nested blocks a fixed number of times.While LoopRepeat blocks while a condition is true.If StatementCompare two values and run different blocks based on the result.Advanced ConditionalRun different blocks based on grouped comparisons.Conditional ValueCompare two values and output one of two values based on the result.FolderOrganize blocks into a folder. Creates a variable scope.BreakStop the current loop and continue with the blocks after it.ContinueSkip the rest of this loop iteration and move to the next one.Exit FlowStop the entire flow immediately. No further blocks will run.Call Custom BlockCall a custom block and use its returned outputs.ReturnReturn outputs from the current custom block and stop executing it.