No-Code Workspace — Block Reference

ActionBlock usage recipe

Webhook (NOTIFY_WEBHOOK)

Sends a notification to a Discord, Telegram, or generic webhook

Documented for app version 1.0.50Updated:

Block Preview

Captured from the in-app Visual Builder block card in the English UI.

English UI
Webhook (NOTIFY_WEBHOOK) block card

What Does It Do?

NOTIFY_WEBHOOK sends a short notification to a webhook target of your choice over an HTTPS POST while the macro runs; it is designed to push a "Round 5/10 done" style ping to Discord or Telegram without touching the phone. There are three presets: Discord and Telegram build the correct body automatically, while Generic gives a flexible POST to your own web service. The block adds no new Lua API; it runs on top of the existing HTTP_POST infrastructure (the runtime Request object) and serializes the body with JSON.stringify, so the variable bindings you weave into the message cannot break the payload. The message text supports both variable binding (the bound variable's VALUE, like the LOG block) and the shared {{ expression }} inline syntax (round counts, etc.).

When to Use?

1

Use when:

2

Learning that a long automation or test flow finished through a compatible webhook service without looking at the phone

3

Getting a remote progress ping when a threshold is crossed (e.g., "5/10 done")

4

Dropping an instant alert to your team or yourself on an error branch

5

Sending a configurable status POST to your own web service (Generic preset)

How to Use?

1

"Add Block" → "Webhook (NOTIFY_WEBHOOK)"

2

PRESET: choose Discord, Telegram, or Generic

3

Discord / Generic: enter the HTTPS address in the WEBHOOK URL field (the Discord address is host-locked to the Discord webhook domains)

4

Telegram: instead of typing the BOT TOKEN, enter the name of the KV KEY that holds the token plus the CHAT ID; the token is never embedded in generated code and is read at runtime with KV.get

5

MESSAGE: enter fixed text, a bound variable, or text with {{ expression }} (e.g., "Round {{ round }}/10 done")

6

On Discord you may set an optional USERNAME override

7

Set a TIMEOUT (ms) if needed; an empty/0 value applies the runtime default (15000 ms) and is rounded up to a 1000 ms minimum

Parameters

Preset

Target type: Discord, Telegram, or Generic; body and host rules follow this

Webhook URL

HTTPS target address for Discord/Generic (the Discord address is host-locked to Discord domains)

Bot Token KV Key

For Telegram, the name of the KV key holding the bot token; the token is not embedded and is read at runtime with KV.get

Chat ID

Telegram target chat identifier

Username

Optional display-name override for Discord

Message

Text to send; supports a bound variable and the {{ expression }} inline syntax

Timeout (ms)

Request timeout; empty/0 = runtime default (15000 ms), minimum 1000 ms

Example Usage

1

Scenario: Report progress to Discord every 10 rounds

2

Keep the round counter in a {{ round }} variable inside a FOR_EACH or WHILE loop

3

COMPARE: branch to TRUE when round % 10 == 0

4

NOTIFY_WEBHOOK → preset=Discord, URL=your Discord webhook address

5

Message: "Round {{ round }}/{{ total }} done"

6

When the loop finishes, send a second NOTIFY_WEBHOOK with "All rounds completed"

Combinations / Used With

1

COMBINATIONS:

2

WHILE/FOR_EACH + COMPARE + NOTIFY_WEBHOOK: threshold-based remote progress pings

3

ERROR_HANDLER + NOTIFY_WEBHOOK: instant Discord/Telegram alert on a critical fault

4

SET_VARIABLE + NOTIFY_WEBHOOK message: send dynamic status text ({{ expression }})

5

KV_SET + NOTIFY_WEBHOOK (Telegram): store the bot token safely in KV and let the block read it at runtime

Tip

Sends a notification to a Discord, Telegram, or generic webhook

Warnings / Cautions

1

WARNING:

2

Every webhook target must be HTTPS; plain HTTP or private/local-network addresses are rejected at save/run time

3

Never embed a Telegram bot token in the block or the generated code; enter only the name of the KV key that holds the token, so a shared/exported project file cannot leak the credential

4

The Discord preset address is host-locked to the Discord webhook domains; the validator rejects any other host

5

The message you send to a webhook target is visible to that service's operator; do not send personal data or secrets

6

Sending many notifications per second can hit the target service's rate limit

Step-by-Step Mastery: Basic → Advanced → Pro

The same block at three levels: a quick start, the real options, and professional techniques.

Basic

NOTIFY_WEBHOOK sends a short notification to a webhook address of your choice over an HTTPS POST while the macro runs. It is built to push a 'Round 5/10 done' style ping to Discord or Telegram without touching the phone. There are three presets: Discord, Telegram, and Generic.

Advanced

The fields change with the preset. For Discord and Generic you enter the HTTPS address in the WEBHOOK URL field (the Discord address is host-locked to the Discord webhook domains); on Discord you may set an optional USERNAME override. For Telegram you do not type the BOT TOKEN: you enter the name of the KV KEY that holds the token plus the CHAT ID, the token is never embedded in generated code and is read at runtime with KV.get. The MESSAGE field supports both a bound variable's value and the {{ expression }} inline syntax. If TIMEOUT is left empty/0 the runtime default (15000 ms) applies, rounded up to a 1000 ms minimum. The block adds no new Lua API; it runs on the existing HTTP_POST infrastructure (Request) and serializes the body with JSON.stringify, so the variables you weave into the message cannot break the payload.

Pro

The secure webhook-token pattern is the most important aspect of this block: never embed a Telegram bot token in the block or the generated code; enter only the name of the KV key that holds it. That way sharing or exporting the project cannot leak the credential. Every target must be HTTPS; plain HTTP or private/local-network addresses are rejected at save/run time, which prevents SSRF-style accidents. Sending many notifications per second can hit the target service's rate limit, so gate notifications behind a COMPARE threshold (e.g., round % 10 == 0). Remember: the message you send is visible to that service's operator; do not send personal data or secrets.

Real-World Scenarios — Step-by-Step Recipes

Small, reproducible examples that combine several blocks — build them straight into your own macro.

Report progress to Discord every 10 rounds
  1. 1Keep the round counter in a {{ round }} variable inside a WHILE or FOR_EACH loop
  2. 2COMPARE: branch TRUE when round % 10 == 0
  3. 3NOTIFY_WEBHOOK -> preset=Discord, URL=your Discord webhook, message='Round {{ round }}/{{ total }} done'
  4. 4When the loop finishes, send a second NOTIFY_WEBHOOK with 'All rounds completed'
Alert to Telegram with a secure token
  1. 1Store the bot token once with KV_SET (key: tgToken)
  2. 2ERROR_HANDLER -> action=CUSTOM
  3. 3NOTIFY_WEBHOOK -> preset=Telegram, botTokenKvKey=tgToken, chatId=..., message='Error: {{ runtimeError }}'

Which Blocks to Pair With — Pro Combinations

This block is useful on its own — but it shines when paired with the right partners.

+ WHILE / FOR_EACH + COMPARE

Builds threshold-based remote progress pings, firing at meaningful points rather than every iteration.

+ ERROR_HANDLER

Drops an instant Discord/Telegram alert on a critical fault.

+ KV_SET (Telegram)

Stores the bot token safely in KV; the block reads it at runtime and never embeds it in code.

+ SET_VARIABLE

Prepares dynamic status text ({{ expression }}) to feed into the message.

Common Mistakes and Fixes

Writing the Telegram bot token in plain text into the message or URL. Fix: put the token in KV and enter only the KV key name; a shared project will not leak it.

Entering an HTTP (or local IP) webhook address. Fix: use only HTTPS public addresses; otherwise the validator rejects save/run.

Sending a notification every loop iteration and hitting the rate limit. Fix: send only at intervals using a COMPARE threshold.

Entering a non-Discord host into the Discord preset. Fix: the Discord address is host-locked to Discord domains; use the Generic preset for your own service.

Pro Tips

Store the token in one KV key and reuse that key across macros; you rotate the token from a single place.

Use two separate NOTIFY_WEBHOOK calls for start and finish; remotely you confirm both that the macro started and that it ended.

This Block's Code (Editor View)

Lua

The Lua below is what the Code Editor generates for this block with sample settings. Adding cases, branches, actions or loops, or changing settings, extends the generated code accordingly. Study it to see what the block does under the hood, to learn Lua, or to copy and adapt it. Use the Copy button (top-right) to paste it into the Code Editor, or “Try in Editor →” to run it in the live editor.

local _webhookBody1 = {}
_webhookBody1["content"] = tostring("farm bitti round " .. tostring(5))
local _webhookUrl1 = "https://discord.com/api/webhooks/1/abc"
local _webhookUrlLower1 = string.lower(_webhookUrl1)
if not (string.match(_webhookUrlLower1, "^https://discord%.com/api/webhooks/") or string.match(_webhookUrlLower1, "^https://discordapp%.com/api/webhooks/") or string.match(_webhookUrlLower1, "^https://canary%.discord%.com/api/webhooks/") or string.match(_webhookUrlLower1, "^https://ptb%.discord%.com/api/webhooks/")) then error("Discord webhook URL rejected") end
local _webhook1 = Request(_webhookUrl1)
_webhook1:setTimeout(15000, 15000)
_webhook1:setContentType("application/json")
_webhook1:setBody(JSON.stringify(_webhookBody1))
_webhook1:post()

Note: generated code can evolve across versions; helper names (e.g. _reg1, m1) and internal optimizations may change. The logic and the called APIs reflect the block’s behavior.

Block ↔ Lua Mapping →

Shared Controls for This Block Family

The guidance below is not identical for every block. It summarizes the professional controls that most often repeat in the selected block family.

📍Target Point or Match Center

Choose clearly between a fixed coordinate, "act on match" (the position the previous search found), or an {x}-bound variable/dialog value to define where the action executes. Binding {matchX},{matchY} does not break across devices or resolutions.

🎛Duration and Repeats

Hold time, repeat count, and inter-action delay shape how aggressive or natural the action feels.

🎲Small Offset

Random offsets or waypoints help validate fixed-coordinate tests across different screen layouts. "In-Match Jitter" randomizes the tap inside the match box and uses the configured margin to stay away from target boundaries. Keep repeated UI tests bounded and record a visible result.

🪜Before and After Waits

Before-waits let UI settle before the action; after-waits let the next block see the updated screen state.

Builder vs Lua Boundary

Raw touch pointer lifecycle stays code-first

TOUCH and TOUCH_BREAK cover recipe-style touch flows. Raw pointer choreography such as Touch.down, Touch.move, Touch.up, Touch.dispatch, Touch.reset, Touch.breakAll, and Touch.releaseAfter is not exposed as a first-class builder block.

Touch.downTouch.moveTouch.upTouch.dispatchTouch.resetTouch.breakAllTouch.releaseAfter
Bounded dialog design is builder-backed; freer composition stays code-first

The DIALOG block and dialog designer cover a bounded field set in the builder: Info Text, Text Input, Checkbox, Description, Radio Group, Dropdown, Multi Select, Tab Group, Date Time, Number Range, Slider, Image Picker, Color Picker, File Picker, Recorder Picker, Tag, Signature, and Spacer. The buttons are designed too: the Positive button and Negative button tabs set each button’s text, background, and border color, corner radius, and minimum height next to a preview. Freer Setting.builder composition, multi-step wizard flows, and mixed HUD/dialog choreography still do not map 1:1 into the builder.

Coming soonv1.0.51Two more fields: Agent Detect references (agent_detect_editor) lets the user pick a saved reference set or add and edit references, and Save confirms the selection; Navigation setup editor (navigation_editor) edits a saved map, marker and route from the Dialog and returns the setup and route selection without moving the character.

Setting.builderDialogHudTextViewAgentDetectEditorNavigationEditor
Advanced HTTP request chaining stays code-first

HTTP_GET, HTTP_POST, and HTTP_PUT cover common fixed-method flows; HTTP_REQUEST covers one bounded request with method, header lines, body, content type, query parameters (GET and DELETE), timeout, and a bounded retry. These blocks never throw; they write the status code (-1 on a network failure). Cookie handling, chained request objects, and lower-level client flows still need the code editor.

Request()Request.setCookieRequest.getCookiesCUSTOM_CODE
General programming surfaces stay code-first

The MAP, LIST, JSON_PARSE, REGEX_MATCH, and METRICS blocks cover the everyday cases: map actions, a static list, reading a value from a JSON path, regex match, find, replace, and split, and metrics actions. The rest of the Map, Array, JSON, Regex, and Metrics APIs (for example Array sort, filter, and map) is broader than the builder recipe model and stays on the CUSTOM_CODE and code editor side.

MapArrayJSONRegexMetrics
Low-level runtime and Lua composition stays code-first

Runtime helpers, raw Request objects, Lua built-ins such as print/pcall/xpcall, and free-form object chaining patterns are represented through CUSTOM_CODE or the code editor.

RuntimeRequestprintpcallxpcallCUSTOM_CODE

Debug Mode and Breakpoints

Each block card now exposes an independent breakpoint toggle. When enabled, the breakpoint preference is stored with the block.

Breakpoints are only emitted into runtime code when Debug Mode is enabled from Visual Builder settings. When Debug Mode is off, breakpoints stay saved but do not pause execution.

Use ASSERT for fail-fast validation, and use breakpoints for step-by-step tracing and controlled pauses in the same flow.

Variable Scope

1

Variables defined with SET_VARIABLE are accessible throughout the macro (global scope). All blocks can read/write the same variable.

2

However, a variable defined inside a GROUP will be 'nil' (undefined) until the GROUP executes. Blocks outside the GROUP using this variable may produce unexpected results.

3

FOR_EACH loop variables (item and index) only carry valid values inside the loop body. Outside the loop they are outside local scope and should not be used.

4

TRY_CATCH error variable is only valid within the catch block. If the try block succeeds, the catch branch is not entered and the error variable remains undefined.

5

TIP: Before using a variable inside a GROUP, assign a default value with SET_VARIABLE outside the GROUP. This way the variable won't be nil even if the GROUP has not run.

Inline Expressions

You can embed variable values and calculations into text fields using {{ expression }} syntax. Expressions inside double curly braces are evaluated as Lua code and the result is inserted into the text.

Syntax
{{ expression }}
Examples
Skor: {{ score + 1 }} → "Skor: " .. tostring(score + 1)
{{ name }} kazandı! → tostring(name) .. " kazandı!"
X:{{ x }} Y:{{ y }} → "X:" .. tostring(x) .. " Y:" .. tostring(y)
Supported Blocks
SET_VARIABLELOGCOMPARECLIPBOARD_WRITENOTIFY_TOASTKV_SET
Security Note

Expressions are checked by the sandbox policy. Security-sensitive calls like loadstring, require, debug are automatically blocked.

General Tips

1

Keep scan regions as small as possible — improves speed, reduces false matches.

2

Always add an exit condition when using infinite loops (BREAK, timeout, or conditional exit).

3

Use network operations and error-prone steps inside TRY_CATCH.

4

If you need global error handling, use the Error Handler (ERROR_HANDLER) block as a singleton in the project.

5

Small coordinate offsets (CLICK/SWIPE) improve tap accuracy across different DPI and screen scales.

6

Customize macros with Dialog block — different parameters each run.

7

Define repeating steps once with GROUP_CALL, call from many places.

Cross-macro local library

Local Shared Macro Area

The Local Shared Macro Area moves blocks, variables, dialog fields, gallery assets, and imported media dependencies between macros on the same device. It is device-local, not cloud sync, not Firebase sharing, and not a replacement for public macro sharing.

Professional usage model: put a reusable login flow, common scan region, shared dialog form, variable group, template image, color profile, replay recording, or imported PLAY_SOUND media file into the shared area from one macro, then import it from the relevant + menu in another macro.

VISUAL_BLOCKSVARIABLESDIALOG_FIELDSTEMPLATE_IMAGECOLOR_SWATCHREPLAY_RECORDMEDIA_FILE
1

Send to the shared area

When one item or a multi-selection is active, the shared-area button can copy the selected part from the workspace, group, true/false action branch, dialog, and variables surfaces into the device-local library.

2

Import into another macro

The shared-area entry under the + menu imports the selected item into the surface that opened it. Main workspace, group, action branch, dialog, and variables each receive the compatible item type.

3

Share gallery assets

Gallery items include template images, color swatches, replay records, and imported audio/media files. They can move between macros on the same device so repeated templates, colors, recordings, and PLAY_SOUND media assets do not need to be captured again.

4

Keep it clean

The shared area is not a permanent dumping ground. Delete stale shared items from the shared-library panel; imports create a copy in the target macro and do not rewrite the source macro flow.

Checkpoint: after importing, review block names, linked template/image/color/record/media assets, and variable names in the target macro. The shared area creates a copy; delete stale shared items from the shared-library panel to keep the library clean.

AI assistant

Build a block chain with MH AI in natural language

Tell MH AI what you want in plain language; it proposes the right block sequence and lands it in the workspace after you approve. In the current release it works with cloud providers such as Gemini, Claude, and OpenAI; on-device local models are on the roadmap.

Learn more →