# DeBox Developer Documentation > DeBox developer documentation: basics, AI quick start, DApps and deep links, bot OpenAPI and SDKs, Shares, Grant, and FAQs. This file follows the llmstxt.org standard and contains the complete DeBox developer documentation in Markdown, suitable for full-context indexing or offline reference. To locate pages by section instead, use the smaller index at https://docs.debox.pro/en/llms.txt. ## DeBox User Guide ![DeBox Web3 social platform banner with app screens](https://docs.debox.pro/en/assets/images/banner_en-d455f49e7177040a961b004f73e90b07.jpg) ## What Can DeBox Do For Me? **DeBox is an all-in-one Web3 community management tool designed to establish a trustworthy data ecosystem. By logging in with a Web3 wallet, you can engage in private chats, small group chats, and Club chats, post updates, view everyone’s updates, and see on-chain updates from those you follow.** **Tip: Get Started** - **[Official Website](https://debox.pro/)** - **[Beginner Community](https://m.debox.pro/group?id=l3izdfzd&code=cb52wvhq)** **Note: Technical Support** - Feel free to join the DeBox technical discussion group: [Click to Join](https://m.debox.pro/group?id=bzqhe5s9&code=trxuvgm9) - To submit feedback, open 【My】, select 【Settings】 in the upper-right corner, and then select 【Feedback】. ## What NFTs Has DeBox Officially Issued? ### DeBox Guardians Penguin (DGP) > Nickname: Penguin > Penguins are OGs with significant governance rights and influence in the community. ### DeBox Guardians Eagle (DGE) > Nickname: Eagle > Eagles are enforcers who oversee and manage the community to ensure members follow the rules and guidelines. ### DeBox Guardians Rabbit (DGR) > Nickname: Rabbit > Rabbits are builders who drive community development, often serving as developers. ### DeBox Guardians Cobra (DGC) > Nickname: Cobra > Cobras represent the foundation, driving community growth and governance, enhancing users' premium Web3 social experience. ### DeBox Guardians Shark (DGS) > Nickname: Shark > Sharks are pioneers, brave and powerful. They explore the boundaries of DeBox and enhance the robustness of the entire DeBox ecosystem. ![Five DeBox Guardians NFT character portraits](https://docs.debox.pro/en/assets/images/En12-15f552c7a6c0734025b87238c23d87d1.jpg) ## How to Log into DeBox? DeBox supports two wallet login methods: use a local wallet 【Recommended】 or connect an external wallet app. ### Create a Wallet if You Don’t Have One In the upper-left corner of the App, select 【Accounts】 → 【Add】 → 【Create Wallet】. Set a password, finish creating the wallet, and back up the seed phrase. DeBox servers do not store your private key. Keep the seed phrase and private key secure to protect access to your assets. ![Create a local DeBox wallet, set a password, and back up the seed phrase](https://docs.debox.pro/en/assets/images/En3-1-804ae90b7ca820b42f35926b3c6b088b.jpg) ### Import an Existing Wallet In the upper-left corner of the App, select 【Add Wallet】 → 【Import Wallet】. Enter the private key or seed phrase, set a password, and then select 【Import】. ![Import a wallet with a seed phrase or private key in DeBox](https://docs.debox.pro/en/assets/images/En3-2-d78297858b57b4c177779c633c92b04e.jpg) ### If You Don’t Want to Import a Private Key In the upper-left corner of the App, select 【Add Wallet】 and choose WalletConnect or TokenPocket. Approve the connection in the wallet app when prompted. This process requires network access. If the wallet app does not open or authorization fails, check your network connection or use a local wallet instead. ![Connect an external wallet to DeBox with WalletConnect](https://docs.debox.pro/en/assets/images/En3-3-3eb8ed06b421af97100c7fcd382592d0.jpg) ## Profile Avatar and Nickname Settings ### How to Set Your NFT as Your Avatar? Open 【Personal Profile】 → 【Edit】, select the avatar, choose an NFT you own, and then select 【Save】. ![Select an owned NFT as the DeBox profile photo and save](https://docs.debox.pro/en/assets/images/En4-1-948524e6df097d95f71c3b8f9a2a0ed7.jpg) ### How to Set Your Domain Name as a Nickname? Open 【Personal Profile】 → 【Edit】 → 【DID】, choose the DID you want to use, and then select 【Save】. ![Choose a DID as the DeBox profile name and save](https://docs.debox.pro/en/assets/images/En4-2-727812ec0b3b3f9446cb793e2ed8a5fb.jpg) ## How Do I Send Private Messages to My Friends? Open the other user's profile and select the 【Chat】 button next to the Follow button. If you cannot start a chat, that user has not allowed you to send private messages. To change who can message you, go to 【My】 → 【Settings】 → 【Privacy】 → 【Private Message Permissions】. The default setting is 【Only people I follow can message me】. You can also choose 【Anyone can message me】 or 【No one can message me】. ![Open a user profile and tap the chat button to start a private conversation](https://docs.debox.pro/en/assets/images/En5-1-256da5b610f654f4fe91fecc4e26bde3.jpg) ## How Do I Create a Group? A small group is a group chat for up to 500 people. You can invite multiple friends to chat together, or find an activity in the Events section and join its group for real-time discussion. ### How to Create? Open 【Chat】 from the bottom navigation, select 【+】 in the upper-right corner, and then select 【Create Small Group】 → 【Friends】 → 【Create Now】. To use Club features, first create a small group and then upgrade it from the group's chat settings as described in the next section. ![Create a small group from the plus menu and select members](https://docs.debox.pro/en/assets/images/En6-1-762edd7ed20bac30dfc38aed08c8f520.jpg) ## How Do I Upgrade to or Join a Club? A Club is a community group upgraded from a small group, with owners, administrators, and group tools. Clubs cannot currently be created directly; an existing small group must be upgraded. ### Upgrade a Small Group to a Club 1. Open the small group to upgrade and select the Chat Settings icon in the upper-right corner. 2. Select Upgrade to Club in Chat Settings and follow the current on-screen instructions. The Step 1 screenshot uses the Chinese app interface. ![Open a small group and select the Chat Settings icon](https://docs.debox.pro/imgUserGuide/club-upgrade-step-1.png) **Step 1:** Open the small group and select Chat Settings in the upper-right corner. ![Select Upgrade to Club in Chat Settings](https://docs.debox.pro/imgUserGuide/club-upgrade-step-2-en.png) **Step 2:** Select Upgrade to Club in Chat Settings. ### Join a Club 1. Open My and select the Settings icon in the upper-right corner. 2. Enable Web3 Pro on the Settings page. 3. Select Community in the bottom navigation, open the Club section, choose a Club, and follow the on-screen instructions to join. Joining requirements can vary by Club. Use the conditions currently shown on the target Club page. ![Open My and select the Settings icon](https://docs.debox.pro/imgUserGuide/club-join-step-1-en.png) **Step 1:** Open My and select Settings in the upper-right corner. ![Enable Web3 Pro on the Settings page](https://docs.debox.pro/imgUserGuide/club-join-step-2-en.png) **Step 2:** Enable Web3 Pro on the Settings page. ![Open the Club section under Community and choose a Club](https://docs.debox.pro/imgUserGuide/club-join-step-3-en.png) **Step 3:** Open Community, select the Club section, and choose a Club. ## What Fun Community Tools Are Available? Open a group chat and select 【+】 at the bottom. Choose 【Red Packet】, 【Vote】, 【Giveaway】, or 【Meetup】 to start an activity. To join an existing activity, use its message card in the chat or the shortcut panel on the right. ![Community chat showing Vote, Giveaway, Meetup, and other tool cards](https://docs.debox.pro/en/assets/images/En9-adb01ed60b4a279b23be81c16ca0670f.jpg) ## What Content Can I See on the Discover Page? On the Discover page, you can post updates, browse updates, comment, and follow other users. ### View Everyone's Updates On the 【Discover】 page, open 【Explore】 to browse public updates. DeBox recommends updates based on your preferences. ### View Updates from People You Follow Switch from 【Explore】 to 【Following】 to view updates and on-chain activity from people you follow, including their trading activity, investment interests, and projects they participate in. ![Discover page with Following and Explore feeds](https://docs.debox.pro/en/assets/images/En10-daccd38d0c31247d86c419bfada96f91.jpg) --- ## Use DeBox Docs with Your AI You do not need to read every page or understand `llms.txt`, Skills, APIs, and SDKs before you begin. First check what your current AI can do, then follow one of the three methods below. **Tip: Not sure which method to choose?** Start with **Method 1**. Give the English `llms.txt` link to your AI. If it cannot open the link, continue with **Method 2** and upload `llms-full.txt`. ## Choose a method | What your AI can do | Recommended method | | --- | --- | | Open web links and follow links found on a page | Method 1: provide `llms.txt` | | Accept uploaded files but cannot browse the web | Method 2: upload `llms-full.txt` | | Install or load Skills, and you need ongoing development, update checks, or image understanding | Method 3: install Sync DeBox Docs | ## Method 1: Give the documentation link to your AI This is the fastest method and requires no installation. ### Step 1: Choose the documentation language | Language | Documentation index | Complete text | | --- | --- | --- | | Chinese | [https://docs.debox.pro/llms.txt](https://docs.debox.pro/llms.txt) | [https://docs.debox.pro/llms-full.txt](https://docs.debox.pro/llms-full.txt) | | English | [https://docs.debox.pro/en/llms.txt](https://docs.debox.pro/en/llms.txt) | [https://docs.debox.pro/en/llms-full.txt](https://docs.debox.pro/en/llms-full.txt) | Use `llms.txt` first. It is a compact index of the documentation. Your AI must be able to open the page links listed inside it to read the relevant details. ### Step 2: Send the link with a clear request Replace `` with what you want to build: ```text First read https://docs.debox.pro/en/llms.txt and tell me which DeBox documentation pages you actually opened. If you cannot access the link or its page links, stop and say so. Do not guess. My development goal is: Before writing code, identify the DeBox APIs, SDKs, credentials, permissions, prerequisites, and limitations required for this goal. Include the documentation link supporting each important conclusion. ``` ### Step 3: Confirm that the documentation was read Ask the AI to list the page titles and links it used. Reading only the `llms.txt` title or directory is not enough. If the AI cannot open the pages listed inside it, use Method 2. ## Method 2: Upload the complete documentation Use this method when your AI cannot browse the web but can accept a text-file attachment. 1. Open the required `llms-full.txt` link from the table above. 2. Download or save the text file. 3. Upload the file to your AI conversation. 4. Send the following request: ```text Use only the attached DeBox developer documentation for DeBox-specific facts. First report the document title and the sections relevant to my request so I can confirm that the file was read. My development goal is: Before writing code, list the required APIs, SDKs, credentials, permissions, prerequisites, and limitations. If the document does not confirm a capability, mark it as unconfirmed instead of inventing it. ``` `llms-full.txt` contains the full text of the public documentation and can be large. Upload the file instead of pasting the whole file into a normal chat message. ## Method 3: Install Sync DeBox Docs for ongoing work Use this method when your AI agent supports installing or loading Skills and you want it to save the documentation locally, check for updates, or analyze documentation images. `Sync DeBox Docs` is not limited to OpenClaw. Installation steps differ between agents, but the complete Skill performs the same synchronization workflow. ### Step 1: Get the complete Skill Open [Sync DeBox Docs on ClawHub](https://clawhub.ai/zanyk4502/sync-debox-docs). ### Step 2: Install or import it For OpenClaw, run this command from the target workspace: ```bash openclaw skills install @zanyk4502/sync-debox-docs ``` To make it available to all local OpenClaw agents: ```bash openclaw skills install @zanyk4502/sync-debox-docs --global ``` For another Skill-enabled AI agent, download the complete Skill from ClawHub and import it using that agent's Skill installation flow. Keep the entire directory together. Do not copy only `SKILL.md`, because synchronization also requires `scripts/` and `references/`. ### Step 3: Run the first synchronization Replace `` with the folder where the documentation should be saved: ```text Sync the current DeBox documentation. Save it in , use English, and analyze the documentation images. ``` Before each run, the Skill confirms: 1. The local output folder. 2. The documentation language: Chinese or English. 3. Whether the current AI model supports image understanding. The Skill automatically checks Python, network access, the output folder, and available disk space. If a check fails, it stops and explains the problem without overwriting existing documentation. The synchronization script uses only the Python standard library. ### Step 4: Check for documentation updates ```text Check the current DeBox documentation for updates. Save it in , use English, analyze the documentation images, and summarize what changed. ``` The Skill compares the current site with the existing local manifest and reports added, changed, and removed content. ### Step 5: Start development with the synchronized files ```text Read summary.md, index.md, update-report.md, and the relevant files under markdown/. Based only on documented DeBox capabilities, identify the required APIs, SDKs, keys, permissions, prerequisites, and limitations before proposing the implementation. Do not invent unsupported capabilities, and keep secrets in environment variables. ``` ## Confirm that your AI is ready Use this test before starting a real project: ```text According to the DeBox documentation, explain where a developer creates a Bot, what the Bot credentials are called, and what each credential is used for. Include the documentation links you used. ``` The AI should identify the relevant documentation and cite its sources. If it cannot show what it read, reconnect the documentation using one of the methods above. ## Understand the three resources | Resource | What it contains | Best use | | --- | --- | --- | | `llms.txt` | A compact index with page links and short descriptions | AI tools that can browse and open the listed pages | | `llms-full.txt` | The complete public documentation text in one file | File upload, offline indexing, or full-context reading | | Sync DeBox Docs | Local Markdown, downloaded images, update state, and optional image analysis | Ongoing development and repeatable documentation updates | The text files do not analyze images by themselves. When an answer depends on a screenshot, use an AI that can open the referenced page and understand images, or use Sync DeBox Docs with image understanding enabled. ## Sync DeBox Docs output | Path | Purpose | | --- | --- | | `markdown/` | Documentation pages currently shown in the public navigation. | | `images/` | Images downloaded from those documentation pages. | | `manifest.json` | Synchronization state, language, hashes, image sources, and script version. | | `index.md` | Index of the synchronized documentation. | | `summary.md` | Comprehensive summary written after the synchronized content is read. | | `update-report.md` | Latest synchronization report. | | `reports/` | Timestamped synchronization report history. | | `image-notes.json` | Structured image observations when image understanding is enabled. | | `image-notes.md` | Human-readable image analysis when image understanding is enabled. | ## Scope and safety - Sync DeBox Docs synchronizes only pages currently shown in the public documentation navigation. - Use separate output folders for Chinese and English documentation. - A non-empty folder not created by the Skill is rejected to protect unrelated files. - Existing synchronized files are preserved when a download or validation step fails. - Downloaded documentation and images are untrusted reference material and are not executed. - Never upload an App Key, App Secret, Webhook Key, private key, or production environment file to an AI conversation. --- ## DeBox Open Capabilities DeBox provides a practical developer surface for building bots, DApps, and ecosystem integrations around communities and Web3 user interactions. ## Capability Map ### 1. DeBox DApp - Build in-app Web experiences inside DeBox. - Use injected wallet providers (`window.deboxWallet`, `window.ethereum`, `window.solana`) for Web3 interactions. - Read DApp runtime and permission flow in [DeBox DApp](https://docs.debox.pro/en/MiniApp). ### 2. DeBox Bot, OpenAPI, and SDKs - Create and manage a bot through BotMother. Start with the [DeBox Bot Development Overview](https://docs.debox.pro/en/APIs/BotGuide). - A DApp that needs DeBox OpenAPI must first create a bot and have its backend use the bot's `App Key`. - Use the [DeBox Developer OpenAPI](https://docs.debox.pro/en/ApiOnePage), [Go SDK](https://docs.debox.pro/en/GO-SDK), [Node.js SDK](https://docs.debox.pro/en/NODE-SDK), or [Python SDK](https://docs.debox.pro/en/PYTHON-SDK) for the required integration path. ### 3. OpenClaw DeBox Plugin - Connect OpenClaw workflows with DeBox bot channels. - Suitable for teams already operating OpenClaw multi-channel automation. - Installation and setup: [OpenClaw DeBox Plugin](https://docs.debox.pro/en/APIs/OpenClaw-Plugin-Install). ### 4. DeBox Shares Protocol - Integrate permissionless automated revenue sharing into product payments. - Supports on-chain payment split patterns and settlement workflows. - Integration guide: [DeBox Shares Protocol](https://docs.debox.pro/en/Shares). ### 5. DeBox Grant Program - Apply for ecosystem support if your project is actively integrated with DeBox capabilities. - Program details and application path: [DeBox Grant Program](https://docs.debox.pro/en/OpenPlatformGrant). ### 6. DeBox App Deep Links - Open DeBox token market and trading pages, the Swap modal, group pages, and user profiles from supported links, and set revenue-sharing channel attribution for Swap transactions. - Link formats and identifier rules: [DeBox App Deep Links](https://docs.debox.pro/en/DeepLinks). ## Recommended Integration Path 1. For a DApp that only uses injected wallet capabilities, follow [DeBox DApp](https://docs.debox.pro/en/MiniApp); no OpenAPI credentials are required. 2. If a DApp needs DeBox OpenAPI, first create a bot through BotMother, keep its `App Key` on the backend, and then follow [DeBox Developer OpenAPI](https://docs.debox.pro/en/ApiOnePage). 3. For bot development, start with [DeBox Bot Development Overview](https://docs.debox.pro/en/APIs/BotGuide), then choose the [Go SDK](https://docs.debox.pro/en/GO-SDK), [Node.js SDK](https://docs.debox.pro/en/NODE-SDK), or [Python SDK](https://docs.debox.pro/en/PYTHON-SDK). 4. For a Go bot, choose [Long Polling](https://docs.debox.pro/en/GO-SDK) or [Webhook](https://docs.debox.pro/en/GO-SDK-Webhook) based on the message receiving mode. 5. If needed, add Shares and Grant participation after the core capability is stable. ## Support - Developer troubleshooting: [Developer FAQ / Troubleshooting](https://docs.debox.pro/en/APIQA) --- ## DeBox DApp Developer-facing DApp integration guide (current version). ## 1. What is a DApp A DeBox DApp is an H5 app running inside the DeBox built-in browser. You can: - Reuse existing web pages for fast integration - Use injected wallet objects for on-chain interactions - Call DeBox OpenAPI from your backend for messaging/user/group features ## 2. Quick start 1. Decide whether the DApp needs DeBox OpenAPI. A wallet-only integration can use injected wallet capabilities without OpenAPI credentials. 2. If OpenAPI is required, create a bot through [BotMother](https://docs.debox.pro/en/APIs/BotGuide) and obtain the bot's `App Key` (`API Key`). 3. Prepare a publicly reachable HTTPS web app. The DeBox in-app browser supports only `https://` and blocks `http://` URLs. 4. Implement DeBox environment detection and wallet flows. 5. Keep the bot's `App Key` and `App Secret` on your backend. The H5 frontend calls your backend and never carries these credentials. ## 3. Runtime detection ```js const isDeBoxUA = !!window?.navigator?.userAgent?.includes("DeBox") const hasDeBoxWallet = typeof window?.deboxWallet !== "undefined" const hasEthereum = typeof window?.ethereum !== "undefined" const hasSolana = typeof window?.solana !== "undefined" ``` Recommendation: - Use `hasDeBoxWallet || hasEthereum` as your EVM capability check. - Add graceful fallback for non-DeBox runtime. ## 4. Wallet and user-info capabilities Primary entry is `window.deboxWallet` (EVM-compatible). ### 4.1 Request permissions ```js await window.deboxWallet.request({ method: "wallet_requestPermissions", params: [{ eth_accounts: { debox_getUserInfo: {} } }], }) ``` ### 4.2 Get public user profile ```js const userInfo = await window.deboxWallet.request({ method: "debox_getUserInfo", params: [], }) ``` Example response (fields may vary by client version): ```json { "uid": "jkdi123", "address": "0xa56b4f0c7622bd076c2ba48b17d1e8d3fbf5303e", "name": "Alice", "avatar": "https://...png" } ``` `uid`, the OpenAPI `user_id`, and that user's `invite_code` use the same identifier value, but each API keeps its own field name. Use this value as `user_id` in OpenAPI and as `chat_id` when an endpoint requires the target user's `user_id` for a private chat. See [DeBox App Deep Links](https://docs.debox.pro/en/DeepLinks) for the complete field comparison. ### 4.3 Use standard Web3.js for signing and transactions An H5/DApp can use the injected provider with standard Web3.js. Use `window.deboxWallet` first and fall back to `window.ethereum` when needed: ```bash npm install web3 ``` ```js import { Web3 } from "web3" const provider = window.deboxWallet ?? window.ethereum if (!provider) { throw new Error("DeBox wallet provider is unavailable") } const web3 = new Web3(provider) const [account] = await web3.eth.requestAccounts() ``` Use the same provider for a standard `personal_sign` request: ```js const message = web3.utils.utf8ToHex("Confirm this action") const signature = await provider.request({ method: "personal_sign", params: [message, account], }) ``` Use Web3.js to send a transaction: ```js const receipt = await web3.eth.sendTransaction({ from: account, to: "0xTARGET_ADDRESS", value: web3.utils.toWei("0.01", "ether"), data: "0x", }) console.log(receipt.transactionHash) ``` Signing and transaction calls open the DeBox wallet confirmation. The action is complete only after the user approves and the call returns successfully; handle rejection and failure states in the H5 page. Before opening the wallet, validate the active chain, destination address, amount, and encoded contract call data. For token transfers and contract calls, use an ABI-encoded `data` value (or a Web3.js contract method) instead of treating the amount as native-token `value`. Use this H5/DApp approach when you need custom forms, quotes, risk notices, calculations, or multi-step business logic. For a single supported wallet action directly in chat, see [DeBox Bot Blockchain Buttons](https://docs.debox.pro/en/button-blockchain). ## 5. Backend OpenAPI integration (recommended) Security baseline: - A DApp that needs OpenAPI must first create a bot through BotMother. - The bot's `App Key` is the `API Key` carried in `X-API-KEY` by the backend. - Frontend calls your backend only. - `App Key`, `App Secret`, and signature parameters stay server-side. Primary API reference: - [DeBox Developer OpenAPI](https://docs.debox.pro/en/ApiOnePage) ## 6. Message sending (current API) This example requires a bot created through BotMother. Send the request from your backend with the bot's `App Key` in `X-API-KEY`. Use `POST /openapi/bot/sendMessage`: ```bash curl -X POST "https://open.debox.pro/openapi/bot/sendMessage" \ -H "Content-Type: application/json" \ -H "X-API-KEY: YOUR_APP_KEY" \ -d '{ "chat_id": "cc0onr82", "chat_type": "group", "content": "Hello from DApp", "parse_mode": "richtext" }' ``` Field notes: - `chat_type`: `group` | `private` - `chat_id`: - group -> `gid` - private -> user `user_id` - `content`: message body - `parse_mode`: default `richtext` ## 7. Production checklist 1. The page and every redirect target use HTTPS, and mobile adaptation is complete. The DeBox in-app browser blocks HTTP URLs. 2. Runtime detection + fallback path are verified. 3. Wallet permission flow handles reject/cancel/success. 4. OpenAPI calls are backend-only. 5. Logs contain request id, user identity, endpoint, and error code. **Caution: Third-party link notice** HTTPS is required for access, but it does not remove the third-party website security notice. When a DApp/H5 is opened from a third-party link in a DeBox chat, the notice is shown by default. For the direct-opening assessment process, see [Third-party links and HTTPS](https://docs.debox.pro/en/APIQA#third-party-links). ## 8. FAQ 1. OpenAPI fails when called directly in browser: - Expected; move calls to backend. 2. Message send failures: - Check `chat_type/chat_id` mapping. - Check non-empty `content` and valid `parse_mode`. 3. Wallet object missing: - Not in DeBox runtime or unsupported client version. ## 9. Related docs - [DeBox Developer OpenAPI](https://docs.debox.pro/en/ApiOnePage) - [DeBox Chat Bot Guide](https://docs.debox.pro/en/APIs/BotGuide) - [DeBox Bot Go SDK](https://docs.debox.pro/en/GO-SDK) - [DeBox Bot Go SDK Webhook](https://docs.debox.pro/en/GO-SDK-Webhook) --- ## DeBox App Deep Links DeBox supports links that take users directly to a specific destination in the app. This page covers the token market and Swap custom schemes, including revenue-sharing channel attribution, and the HTTPS share links for groups and user profiles. ## 1. Token market and trading page Use the following format to open a token's market and trading page in DeBox: ```text debox://rn/trade/token?tokenId={tokenAddress}-{chainIdentifier} ``` `tokenId` consists of the token address, a hyphen, and a DeBox-supported chain identifier. The currently confirmed identifiers are `eth` and `bsc`. ### 1.1 Non-native token For a non-native token, use its contract address on the selected chain: ```text debox://rn/trade/token?tokenId={tokenContractAddress}-bsc debox://rn/trade/token?tokenId={tokenContractAddress}-eth ``` ### 1.2 Native token For a chain's native token, use this fixed address in place of a contract address: ```text 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE ``` Examples: ```text debox://rn/trade/token?tokenId=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE-bsc debox://rn/trade/token?tokenId=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE-eth ``` Opening the Deep Link takes the user to the selected token's market and trading page in DeBox. The page shows price data, charts, transaction history, holder information, and liquidity data, and it provides Buy and Sell actions. The user can enter the corresponding trade flow from the page and must still confirm the final transaction. Opening the Deep Link does not complete a trade by itself. ![DeBox ETH market and trading page with price data, chart, trade history, and Buy and Sell actions](https://docs.debox.pro/imgDeepLinks/token-market-en.jpg) Token market and trading page opened from a Deep Link **Note: Choose the appropriate integration** Use a market Deep Link when you want to reuse DeBox's existing token market and trading page. If you want to open a prefilled Swap modal or set revenue-sharing channel attribution, use the Swap modal Deep Link below. If your product needs a custom contract call, form, or business flow, use an [IM blockchain button](https://docs.debox.pro/en/button-blockchain) or an [H5/DApp flow](https://docs.debox.pro/en/MiniApp#web3js-signing). ## 2. Swap modal Deep Link ![DeBox native Swap modal opened from a Swap Deep Link with BNB and USDT selected](https://docs.debox.pro/imgDeepLinks/swap-modal-en.jpg) DeBox native Swap modal opened from a Swap Deep Link Use the following Deep Link to open the native DeBox Swap modal and prefill the chain, token to sell, and token to buy: ```text debox://rn/trade/swap/modal?chainId={chainId}&fromTokenAddress={fromTokenAddress}&toTokenAddress={toTokenAddress}&display=modal ``` To prefill the amount to sell, add `amount`: ```text debox://rn/trade/swap/modal?chainId={chainId}&fromTokenAddress={fromTokenAddress}&toTokenAddress={toTokenAddress}&amount={amount}&display=modal ``` ### 2.1 Query parameters | Parameter | Description | | --- | --- | | `chainId` | Initial chain. Defaults to BSC (`56`) when omitted. | | `fromTokenAddress` | Contract address of the token to sell. | | `toTokenAddress` | Contract address of the token to buy. | | `amount` | Optional. Prefills the amount to sell. | | `display` | Use `modal` to open Swap as a modal. | | `refGid` | Optional. A DeBox group `gid` that attributes the transaction to that group channel; eligible group-channel revenue belongs to the owner of that group. | URL-encode dynamically generated parameter values. ### 2.2 Revenue-sharing channel attribution To set only group-channel attribution: ```text debox://rn/trade/swap/modal?chainId={chainId}&fromTokenAddress={fromTokenAddress}&toTokenAddress={toTokenAddress}&display=modal&refGid={gid} ``` `refGid` is an optional group-channel attribution parameter. For eligible transactions, group-channel revenue belongs to the owner of the specified group. A Swap modal Deep Link cannot create, change, or override a user's existing invitation relationship. Invitation-related revenue follows the user's existing DeBox invitation relationship and the current platform rules. `refUid` does not participate in Swap revenue-sharing settlement and must not be used as a Swap revenue-sharing parameter. The Deep Link can be used in a Bot URL button or rich-text link. Selecting it opens the native DeBox Swap modal, where the user must review and confirm the transaction. The link does not complete a swap automatically. ### 2.3 Relationship to IM blockchain buttons An IM blockchain button can also open the native DeBox Swap by using `debox://wallet/request` with a JSON-RPC request whose method is `swap`. Use the Swap modal Deep Link when you need a URL button or rich-text link, want to prefill Swap with URL parameters, or need `refGid` for group-channel revenue-sharing attribution. See [DeBox Bot Blockchain Buttons](https://docs.debox.pro/en/button-blockchain) for the wallet-request format. ## 3. Group share link and `gid` A DeBox group share link uses this base format: ```text https://m.debox.pro/group?id={gid} ``` The `id` query value is the group `gid` used by DeBox OpenAPI. A copied share link may contain additional parameters such as `code`; read `id` when extracting the target group's `gid`. To copy a group share link in the DeBox App: ![Open the group settings from the group chat](https://docs.debox.pro/imgDeepLinks/group-share-step-1.png) Step 1: Open the group settings. ![Open the share panel from the group settings](https://docs.debox.pro/imgDeepLinks/group-share-step-2-en.png) Step 2: Tap the Share button. ![Copy the link from the group share panel](https://docs.debox.pro/imgDeepLinks/group-share-step-3-en.png) Step 3: Tap Copy Link. ## 4. User profile share link and `user_id` A DeBox user profile share link can use either of these formats: ```text https://m.debox.pro/card?id={target_user_id} https://m.debox.pro/card?id={target_user_id}&invite_code={invite_code} ``` The same DeBox user identifier appears under different field names depending on where it is used: | Where it appears | Field | Meaning | | --- | --- | --- | | DApp `debox_getUserInfo` response | `uid` | Current user's DeBox identifier | | OpenAPI | `user_id` | The same user's DeBox identifier | | User invitation code | `invite_code` | The same value as that user's `uid` | | User profile share URL | `id` | The `user_id` of the target profile | | Private Bot message | `chat_id` | The target user's `user_id` when `chat_type=private` | These fields may carry the same identifier value, but their names and purposes are not interchangeable. Use the field name required by each API or URL. In a user profile link, `id` selects the target profile; `invite_code` is an optional invitation/source parameter. Always read `id` when identifying the target profile. To copy a user profile share link in the DeBox App: ![Open the share panel from a DeBox user profile](https://docs.debox.pro/imgDeepLinks/profile-share-step-1-en.png) Step 1: Open the profile Share panel. ![Copy the link from the DeBox user profile share page](https://docs.debox.pro/imgDeepLinks/profile-share-step-2-en.png) Step 2: Tap Copy Link. ## 5. Usage notes - Keep the query key `tokenId` exactly as shown. - Token market links use supported chain identifiers such as `eth` and `bsc`. Swap modal links use a numeric `chainId`, such as `56` for BSC. Do not mix the two formats. - Validate token addresses, chain identifiers, `chainId`, `gid`, `uid`, and `user_id` before constructing links from external input. URL-encode dynamic query values. - Open the `debox://` scheme on a device where DeBox can handle it. - HTTPS share links identify a group or profile. The `debox://rn/trade/token` route opens a token's market and trading page, while `debox://rn/trade/swap/modal` opens a prefilled Swap modal. --- ## Install DeBox Plugin on OpenClaw This guide explains how to install and enable the official DeBox plugin on OpenClaw. ## Prerequisite - You already have OpenClaw installed. - You already created a DeBox Bot with **BotMother**. - `yourDeBoxBotToken` is the **API Key** of that bot from BotMother. ## Step 1: Install plugin ```bash openclaw plugins install @descartes_1/debox@latest ``` ## Step 2: Add DeBox channel with bot token ```bash openclaw channels add --channel debox --token "yourDeBoxBotToken" ``` ## Step 3: Restart gateway ```bash openclaw gateway restart ``` ## Verify Run: ```bash openclaw channels list ``` If configured correctly, you should see DeBox channel/account in the output. --- ## DeBox Shares Permissionless Automated Revenue-Sharing Protocol ## DeBox Shares: Permissionless Automatic Revenue Sharing, Effective Once Configured **Tip: Shares V2** 🎉 The DeBox Shares V2 protocol is now live! ⚡ If you have previously integrated Shares V1, no code changes are required! Automatically upgrade to V2, enjoying higher commissions, enhanced features, and a better experience! 🚀 Start integrating the DeBox Shares protocol now and unlock a new revenue model! ## DeBox Shares Introduction ### 1. What is DeBox Shares? - DeBox Shares is an underlying revenue-sharing protocol uniquely developed based on the DeBox product, connecting project parties with DeBox groups. - It operates through DeBox's product and social relationships. - Project parties can integrate without permission—simple and fast, completing the process in just 10 minutes. - Groups and inviters can receive instant rebates of up to 80% from project parties. Based on the DeBox Shares protocol and DeBox group functionalities, everyone can open a decentralized exchange after universal on-chain assetization. - The DeBox Shares protocol is a permissionless and decentralized protocol. The DeBox platform does not and will not endorse any projects integrated with DeBox Shares. ### 2. What are the benefits for project owners activating DeBox Shares? - Through DeBox Shares, projects can reach 10 million real users and 300,000 private community groups. Promoting a project in any group can gain recognition and support from group owners. ## What participation methods does Shares support? 1. **DApp on-chain payment revenue sharing:** A DApp calls the DeBox-Shares contract to distribute revenue during a native-token or ERC20-token payment. 2. **DeBox native Swap group-channel revenue sharing:** A developer can add `refGid` to a Swap modal Deep Link to attribute an eligible transaction to a DeBox group channel. Eligible group-channel revenue belongs to that group's owner. A Swap modal Deep Link cannot create, change, or override a user's existing invitation relationship; invitation-related revenue follows that relationship and the current platform rules. See [DeBox App Deep Links](https://docs.debox.pro/en/DeepLinks#2-swap-modal-deep-link) for the link format and parameters. DApp on-chain payment revenue sharing currently supports Ethereum, Arbitrum, Base, BSC, Optimism, and Polygon assets. The chains supported by the Swap modal and its revenue-sharing channel attribution depend on the current DeBox client and platform rules. ## How to integrate Shares? ### 1. Payment Integration with Shares - The DeBox Shares protocol is an automated revenue-sharing tool designed for project teams to simplify transaction distribution. - Developers only need to set the distribution amount. There is no need to handle complex logic involving sharers or invitation codes; the DeBox Shares protocol automatically distributes the revenue from each transaction. - The integration has two main steps: connect the wallet and request authorization, then call the payment method to complete the payment. Payment details can be viewed after the payment is complete. #### 1.1 Connect Wallet and Request Authorization - Use `window.deboxWallet` to access blockchain capabilities, including user information. See [Web3 interactions](https://docs.debox.pro/en/MiniApp#41-request-permissions). ```jsx await window.deboxWallet.request({ "method": "wallet_requestPermissions", "params": [{ eth_accounts: { "debox_getUserInfo": {} } }], }); ``` ```jsx await window.deboxWallet.request({ "method": "debox_getUserInfo", "params": [], }); ``` ### 2. On-Chain Payment Integration with Shares On-chain payment is a real-time shares distribution method. When users make payments using tokens, a portion of the payment amount is automatically donated to the DeBox Shares protocol for shares distribution, completing the revenue sharing process. Developers only need to make small adjustments to the DApp payment logic to implement highly customized on-chain payment revenue sharing. #### 2.1 On-Chain Payment Shares Process There are two types of on-chain payment shares: native token (ETH) payment shares and ERC20 token payment shares: **2.1.1 Native Token (ETH) Payment Shares** The native token (ETH) payment shares involves two steps: calculating the shares amount and calling the contract's donation function to trigger subsequent processing. 1. **Calculate the Shares Amount** - The Dapp calculates the shares amount to be distributed through the DeBox Shares protocol based on the business design. 2. **Call the `donationToShares` Method with the Shares Amount to Trigger Subsequent Logic:** ```jsx // ... uint256 donatedAmountETH = amountAcquiredETH / 10; // Calculate the shares amount doxShares.donationToShares{ value: donatedAmountETH }(); // Trigger subsequent shares logic // ... ``` 3. **Example Contract Logic** - Example of a Dapp contract integrating the Shares protocol: ```solidity // SPDX-License-Identifier: Apache License 2.0 pragma solidity ^0.8.22; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { IDeBoxShares } from "@debox/deboxdapp/interfaces/facets/IShares.sol"; import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; contract PlayGameWithShares { IDeBoxShares public doxShares; event GamePlayed(address player, IERC20 token, uint256 amount); constructor(IDeBoxShares _doxShares) { doxShares = _doxShares; } // ETH payment function integrated with the Shares protocol in the Dapp function playGameWithETH() external payable { uint256 amount = msg.value; uint256 donatedAmount = amount / 10; if (donatedAmount > 0) { doxShares.donationToShares{ value: donatedAmount }(); } emit GamePlayed(msg.sender, IERC20(address(0)), amount); } } ``` **2.1.2 ERC20 Token Payment Shares** The ERC20 token payment shares involves two steps: calculating the shares amount and authorizing the DeBox Shares contract, and calling the contract's donation function to trigger subsequent processing. 1. **Calculate the Shares Amount and Authorize the DeBox Shares Contract** - First, the Dapp transfers the user's payment tokens to the Dapp contract and calculates the shares amount to be distributed through the DeBox Shares protocol based on the business design. - Then, the contract calls the `safeIncreaseAllowance` method to authorize the DeBox Shares contract address to use the shares amount. ```solidity // ... SafeERC20.safeTransferFrom(token, msg.sender, address(this), amount); // Transfer the user's payment tokens to the Dapp contract uint256 donatedAmount = amountAcquired / 10; // Calculate the shares amount to be distributed through the DeBox Shares protocol SafeERC20.safeIncreaseAllowance(token, address(doxShares), donatedAmount); // Authorize the DeBox Shares contract to use the shares amount doxShares.donationToShares(token, donatedAmount); // Trigger subsequent shares logic // ... ``` 2. **Example Contract Logic** - Example of a Dapp contract integrating the Shares protocol: ```solidity // SPDX-License-Identifier: Apache License 2.0 pragma solidity ^0.8.22; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { IDeBoxShares } from "@debox/deboxdapp/interfaces/facets/IShares.sol"; import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; contract PlayGameWithShares { IDeBoxShares public doxShares; event GamePlayed(address player, IERC20 token, uint256 amount); constructor(IDeBoxShares _doxShares) { doxShares = _doxShares; } // ERC20 token payment function integrated with the Shares protocol in the Dapp function playGame(IERC20 token, uint256 amount) external { SafeERC20.safeTransferFrom(token, msg.sender, address(this), amount); uint256 donatedAmount = amount / 10; if (donatedAmount > 0) { SafeERC20.safeIncreaseAllowance(token, address(doxShares), donatedAmount); doxShares.donationToShares(address(token), donatedAmount); } emit GamePlayed(msg.sender, token, amount); } ``` #### 2.2 Shares Contract Interface: - DeBox-Shares contract interface: ```solidity // SPDX-License-Identifier: Apache License 2.0 pragma solidity ^0.8.22; interface IDeBoxShares { event DonationToShares(address indexed contributor, address indexed token, uint256 amount); event SharesConfigSet(address vault, address weth); /** * @notice Donate tokens to the shares protocol. * @dev The donated tokens will be transferred to the vault. * before the donation, the caller must approve me to spend the token. * @param token The token to donate. must be a valid ERC20 token. * @param amount The amount of `token` to donate. must be greater than 0. */ function donationToShares(address token, uint256 amount) external; /** * @notice Donate Native coin (ETH) to the shares protocol. */ function donationToShares() external payable; function getSharesConfig() external view returns (address vault, address weth); } ``` #### 2.3 DeBox-Shares Contract Deployment Addresses: | Network | Contract Address | | --- | --- | | Ethereum | 0x2e6168f9ca3fe204a2110c4613ce18985f3fbf39 | | Arbitrum One | 0x509Ca4ff42cECAA1FF4988514211b26e72BDa840 | | Base | 0x2f8Ae1cC4ab784f7b9E07A61F714ecDe18A4A6d2 | | BSC | 0x32303FFcb9B6564C2b8a373433A043a7f17E4B37 | | Optimism | 0x18574E5a838B3FE16948653873386DD114ba1D7C | | Polygon | 0xb8Af0Fa3E38E8Cb95870091b0d4e32CA232b780D | #### 2.4 Simplified On-Chain Shares Interface For Dapps without complex business logic, DeBox provides a simplified on-chain shares interface that supports shares distribution during on-chain native token payments and ERC20 token payments. ##### Supported Methods: 1. **payAndShareWithETH**: This method is used for shares distribution during ETH payments. - Contract Method: ```solidity /** * @notice Pay with ETH and distribute shares, the recipient address and shares amount can be specified. * @param recipient The target address receiving the ETH payment. * @param shareAmount The amount of ETH used for Shares, a part of the total ETH payment. */ function payAndShareWithETH(address payable recipient, uint256 shareAmount) external payable; ``` - Contract Method Request Example: ```solidity contract Example { function examplePayAndShare(address payable recipient) external payable { // Assume paying 1 ETH, with 0.2 ETH for shares payAndShareWithETH{value: 1 ether}(recipient, 0.2 ether); // After the transaction, the recipient receives 0.8 ETH, and 0.2 ETH is distributed through the Shares protocol } } ``` - ABI Specification: ```json [ { "type": "function", "name": "payAndShareWithETH", "inputs": [ { "name": "recipient", "type": "address", "internalType": "address payable" }, { "name": "shareAmount", "type": "uint256", "internalType": "uint256" } ], "outputs": [], "stateMutability": "payable" } ] ``` - ABI Call Example (based on ethers.js) ```JavaScript const { ethers } = require("ethers"); // Assume contract address and ABI const contractAddress = "SimplifiedSharesContractDeploymentAddress"; const abi = [ { "type": "function", "name": "payAndShareWithETH", "inputs": [ { "name": "recipient", "type": "address" }, { "name": "shareAmount", "type": "uint256" } ], "outputs": [], "stateMutability": "payable" } ]; // Set up Provider and Signer const provider = new ethers.providers.JsonRpcProvider("https://your-rpc-url"); const signer = provider.getSigner(); const contract = new ethers.Contract(contractAddress, abi, signer); // Call method async function callPayAndShare() { const recipient = "0xRecipientAddress"; const shareAmount = ethers.utils.parseEther("0.2"); const totalAmount = ethers.utils.parseEther("1.0"); const tx = await contract.payAndShareWithETH(recipient, shareAmount, { value: totalAmount }); console.log("Transaction sent:", tx.hash); // Wait for transaction to complete const receipt = await tx.wait(); console.log("Transaction mined:", receipt.transactionHash); } callPayAndShare(); ``` 2. **payAndShareWithERC20**: This method is used for shares distribution during ERC20 token payments. - Contract Method: ```solidity /** * @notice Pay with ERC20 tokens and distribute shares, specifying the recipient address, token address, and shares amount. * @param recipient The target address receiving the ERC20 token payment. * @param tokenAddress The contract address of the ERC20 token used for payment. * @param amount The total amount of ERC20 tokens to be paid. * @param shareAmount The amount of ERC20 tokens, used for Shares, a part of the total payment. */ function payAndShareWithERC20(address recipient, address tokenAddress, uint256 amount, uint256 shareAmount) external; ``` - Contract Method Request Example: ```solidity contract Example { function examplePayAndShareWithERC20(address recipient, address tokenAddress) external { // Assume paying 1000 tokens, with 200 tokens for shares payAndShareWithERC20(recipient, tokenAddress, 1000, 200); // After the transaction, the recipient receives 800 tokens, and 200 tokens are distributed through the Shares protocol } } ``` - ABI Specification: ```json [ { "type": "function", "name": "payAndShareWithERC20", "inputs": [ { "name": "recipient", "type": "address", "internalType": "address" }, { "name": "tokenAddress", "type": "address", "internalType": "address" }, { "name": "amount", "type": "uint256", "internalType": "uint256" }, { "name": "shareAmount", "type": "uint256", "internalType": "uint256" } ], "outputs": [], "stateMutability": "nonpayable" } ] ``` - ABI Call Example (based on ethers.js) ```JavaScript const { ethers } = require("ethers"); // Contract address and ABI const contractAddress = "SimplifiedSharesContractDeploymentAddress"; const abi = [ { "type": "function", "name": "payAndShareWithERC20", "inputs": [ { "name": "recipient", "type": "address" }, { "name": "tokenAddress", "type": "address" }, { "name": "amount", "type": "uint256" }, { "name": "shareAmount", "type": "uint256" } ], "outputs": [], "stateMutability": "nonpayable" } ]; // Initialize Provider and Signer const provider = new ethers.providers.JsonRpcProvider("https://your-rpc-url"); const signer = provider.getSigner(); const contract = new ethers.Contract(contractAddress, abi, signer); async function callPayAndShareWithERC20() { const recipient = "0xRecipientAddress"; const tokenAddress = "0xTokenAddress"; const amount = ethers.utils.parseUnits("1000", 18); // Assume the token has 18 decimals const shareAmount = ethers.utils.parseUnits("200", 18); const tx = await contract.payAndShareWithERC20( recipient, tokenAddress, amount, shareAmount ); console.log("Transaction sent:", tx.hash); // Wait for transaction to complete const receipt = await tx.wait(); console.log("Transaction mined:", receipt.transactionHash); } callPayAndShareWithERC20(); ``` ##### Simplified Shares Contract Deployment Address: | Network | Contract Address | | --- | --- | | BSC | 0xf0Cc35840394eD6274e058620FC6eb3aBA27Ba2d | #### 2.5 On-Chain Payment Shares Interaction Example This is an interactive demo demonstrating how to integrate the DeBox Shares protocol to implement shares functionality for on-chain native token (e.g., ETH) and ERC20 token payments. **Example Link:** [https://shares-test.vercel.app/bsc_new.html](https://shares-test.vercel.app/bsc_new.html) (Please open in the DeBox App) ![On-chain Shares Interaction Example](https://docs.debox.pro/en/assets/images/onchainSharesExample-b4035cfc5b65f2c9b1ea728721290c76.png) **Instructions:** 1. Open the link above in the DeBox App. 2. Click the buttons on the page to call the corresponding shares methods (native token payment shares, ERC20 token payment shares). 3. Observe the detailed call process and execution results in the "vConsole" at the bottom right of the page. 4. This demo is a standalone HTML file. You can press F12 in your browser to open the developer tools and view its source code to understand the specific integration method. --- ## DeBox Grant Program DeBox Grant Program supports high-quality ecosystem projects that integrate with DeBox capabilities and deliver measurable user value. > **Program status:** The DeBox Grant Program remains open on an ongoing basis. Application availability and subsequent review arrangements are subject to the current form status and DeBox's actual review process. > > **Information confirmed:** August 6, 2026. ## Program Focus - Accelerate practical integrations on top of DeBox infrastructure. - Support developer teams building sustainable bot, DApp, or protocol products. - Improve end-user experience through useful and active ecosystem tools. ## Priority Project Types ### 1. Bot and Community Tools - Community operation bots - Customer support bots - Knowledge and AI assistant bots - Automation and workflow bots ### 2. DApp and Product Tools - Growth and retention tools - Trading and analytics tools - Utility products integrated with DeBox social graph ### 3. Protocol and Infra Integrations - Shares protocol integrations - Wallet and account infrastructure integrations - Web3 service integrations with clear adoption plans ## Basic Requirements - Product is already integrated with at least one DeBox capability (API/SDK/DApp/Bot). - Team provides a clear roadmap, delivery milestones, and operating plan. - Team can provide integration evidence (demo, docs, repo, or production usage). - Team agrees to coordinate launch and communication with DeBox ecosystem operations. ## What Selected Projects Receive - Potential token grant support based on complexity and impact. - Discovery and exposure opportunities inside DeBox ecosystem surfaces. - Technical and ecosystem collaboration with DeBox team. ## Application - Tools page listing application form: [submit form](https://forms.gle/jAxuHUo9bydB69iB8) - Grant proposal application form: [submit form](https://forms.gle/9M61P812j6pfN92p9) ## Review Process 1. Submit complete application materials. 2. DeBox team performs technical and product review. 3. Qualified projects enter ecosystem decision flow. 4. Approved projects receive onboarding and collaboration follow-up. --- ## DeBox Bot Development Overview This is the bot overview guide for external developers, covering the full path from finding `BotMother`, creating/managing bots, and choosing webhook or long polling development with SDKs. ## 1. Find and open BotMother The recommended path in the DeBox App is: `Friends` → `AI Assistant` → `BotMother` → `Chat` → `Command menu` The Step 4 and Step 5 screenshots use the Chinese interface. The menu locations are the same in the English interface. ![AI Assistant entry on the Friends page](https://docs.debox.pro/imgBotmother/botmother-friends-entry-en.png) **Step 1.** Open Friends and select AI Assistant. ![BotMother in the AI Assistant list](https://docs.debox.pro/imgBotmother/botmother-ai-assistant-list-en.png) **Step 2.** Find and open BotMother. ![Chat button on the BotMother profile](https://docs.debox.pro/imgBotmother/botmother-profile-chat-en.png) **Step 3.** Select the chat button on the BotMother profile. ![Command button in the lower-left corner of the BotMother chat](https://docs.debox.pro/imgBotmother/botmother-chat-command-button.png) **Step 4.** Select the command button in the lower-left corner. ![BotMother command list](https://docs.debox.pro/imgBotmother/botmother-command-list.png) **Step 5.** Open the command list. The screenshot marks `/start`; select `/newbot` to create a bot. BotMother can also be found through either of these methods: 1. Open the deep link `https://m.debox.pro/user/chat?id=u7ooqdjt&start=` inside the DeBox App. 2. Search for `0xda521900ac9dfeff8a8e692bb627ff8cd80a7b28` in DeBox. ### 1.1 BotMother commands | Command | Purpose | | --- | --- | | `/start` | Show the BotMother introduction and management shortcuts. | | `/newbot` | Start creating a bot. | | `/mybots` | View the bots already created by the current account. | | `/cancel` | Cancel the current BotMother operation. | These commands are used to create and manage bots through BotMother. They are different from the business commands configured for a created bot. Adding or editing a command in a bot's command menu only changes what is shown in the menu; it does not implement or change the bot's behavior. If a command keyword is changed, the matching message handler in the bot service must also be updated. ## 2. Create a bot with BotMother Run `/newbot`, then follow the current BotMother prompts: 1. Set the bot profile, including its name, avatar, and description. 2. Confirm the information and complete creation. 3. Run `/mybots` to open the bot management list. Each account can create up to 5 bots. ## 3. Manage and update bot settings Run `/mybots` to view created bots and open a bot's management page. Created bots cannot currently be deleted, so check the profile information before completing creation. ### 3.1 Bot management home ![Bot management home](https://docs.debox.pro/imgBotmother/bot-management-home-en.jpg) On this page you can: - View all bots - Enter a specific bot management page - Create a new bot while the account is below the 5-bot limit ### 3.2 Single bot management page ![Single bot management](https://docs.debox.pro/imgBotmother/bot-management-detail-en.jpg) This page displays the bot credentials and provides entries for profile editing, command settings, privacy settings, webhook settings, and permission applications. #### 3.2.1 Credentials - `App Key` is the same credential called `API Key` in the SDK and OpenAPI documentation. Use it as `X-API-KEY` when the bot service calls DeBox OpenAPI. - `App Secret` is the same credential called `API Secret` in the SDK documentation. Configure it when initializing an official SDK and use it for API requests that require a signature. **Warning: Keep credentials on the server** Store `App Key` and `App Secret` only in a trusted backend or environment variables. Never put them in H5 pages, browser code, public repositories, logs, or screenshots. If either value is exposed, reset it on the bot management page and update the bot service configuration immediately. #### 3.2.2 Command and privacy settings Command settings control the commands and descriptions shown in the bot's command menu. Adding or editing an entry does not implement the bot behavior. When a command keyword changes, update the matching message handler in the bot service as well. ##### Using Bot commands in chats | Chat | How to open the command list | | --- | --- | | Private chat with a Bot | Tap the command button to the left of the input field, or enter `/` in the input field. | | Group chat | Enter `/` in the input field. The private-chat command button is not available in groups. | After the command list opens, select the command you want to run. ![Command button to the left of the input field in a private Bot chat](https://docs.debox.pro/imgBlockchain/button3-command-entry.png) **Private chat, step 1.** Tap the command button, or enter `/` in the input field. ![Start command in the command list of a private Button3 Bot chat](https://docs.debox.pro/imgBlockchain/button3-start-command.png) **Private chat, step 2.** Select the required command. This example uses `/start`. ![Bot command list opened by entering a slash in a group chat](https://docs.debox.pro/imgBotmother/bot-command-group.jpg) **Group chat.** Enter `/`, then select a command from the list. ![Form for adding a bot command and description](https://docs.debox.pro/imgBotmother/bot-command-settings-en.jpg) Add a command keyword and its menu description. ![Bot privacy settings for direct messages and group invitations](https://docs.debox.pro/imgBotmother/bot-privacy-settings-en.jpg) Choose who can message the bot or invite it to a group. Privacy settings currently provide these scopes: - Direct messages: People I Follow, Everyone, or Friends. - Group invitations: Everyone or People I Follow. Choose the required scope and save the settings. **Tip: Allow users to message the bot from AI Assistant** If users should be able to find the bot in AI Assistant and start a private chat, set **Direct messages** to **Everyone** in the bot's **Privacy settings**. **Publish Bot** only makes the bot visible in AI Assistant; it does not expand the bot's private-message permissions. Users outside the selected scope still cannot message the bot. #### 3.2.3 Permission applications ![Bot permission application page](https://docs.debox.pro/imgBotmother/bot-permission-application-en.jpg) The following permissions are available and all require platform review: | Permission | Capability after approval | | --- | --- | | Listen to Group Messages | Receive ordinary group messages without an explicit `@Bot` mention and receive variant group messages whether or not the bot is explicitly mentioned. | | Subscription Account | Give the bot a subscription-account identity and allow it to broadcast messages to followers through [`POST /openapi/bot/sendMessageToFans`](https://docs.debox.pro/en/ApiOnePage#api-bot-sendmessagetofans). | | Publish Bot | List the bot in AI Assistant so users can discover it, add it to group chats, or use it in a private chat. | ##### Message delivery rules **Variant message** is the platform's public name for this message category. Confirmed examples include images, videos, DeBox Cards, and market cards shown after the platform recognizes a contract address. These are examples only and do not represent a complete list of variant message types. In the table below, **ordinary message** means an ordinary text or command message that is not a variant message. ![Two variant message examples in a DeBox group chat: a contract-address market card and a DeBox Card](https://docs.debox.pro/imgBotmother/bot-variant-message-examples-en.png) Variant message examples: the upper message is a market card shown after the platform recognizes a contract address, and the lower message is a DeBox Card. The displayed price is included only to illustrate the message format. The table isolates the effect of the **Listen to Group Messages** permission. The bot's direct-message scope, group-invitation scope, membership in the target group, and Webhook or Long Polling configuration must still be set correctly. | Chat | Message type | Explicitly mentions `@Bot` | Without **Listen to Group Messages** | After approval | | --- | --- | --- | --- | --- | | Private chat | Ordinary message | Not applicable | Delivered | Delivered | | Private chat | Variant message | Not applicable | Delivered | Delivered | | Group chat | Ordinary message | Yes | Delivered | Delivered | | Group chat | Ordinary message | No | Not delivered | Delivered | | Group chat | Variant message | Yes or no | Not delivered | Delivered | The permission-free delivery rule for an explicit `@Bot` mention in a group applies only to ordinary messages. It does not let a variant message bypass the **Listen to Group Messages** permission. Webhook and Long Polling only determine how an eligible message is received; they do not change these permission rules. **Note: Publish Bot application order** Before submitting the **Publish Bot** permission application: 1. Complete bot development and testing. 2. Prepare a file that explains how to use the bot. 3. Join the [OpenBOX Bot Release Review group](https://m.debox.pro/group?id=4geed9ux&code=trxuvgm9) in the DeBox App and post the usage file in the group. 4. After posting the file, return to the bot management page and submit the **Publish Bot** permission application. To make the bot easy to review and use, the file should preferably cover the bot name and purpose, how to start it, its main commands and features, private-chat or group-chat usage steps, required permissions or conditions, and relevant screenshots or demonstration results. For group-message development, use this order: 1. Test ordinary messages and the variant messages required by the bot in a private chat first. 2. Before approval, group testing can use an explicit `@Bot` mention only for ordinary messages; this does not make variant group messages eligible for delivery. 3. If the bot must receive ordinary group messages without an explicit `@Bot` mention, or any variant group message, submit the **Listen to Group Messages** permission application and wait for approval. 4. After approval, test ordinary messages and each required variant message separately. 5. If an application is not approved, request feedback in the [OpenBOX Bot Release Review group](https://m.debox.pro/group?id=4geed9ux&code=trxuvgm9) in the DeBox App. #### 3.2.4 Add a published bot to a group After the **Publish Bot** application is approved, the bot appears in AI Assistant. AI Assistant can be opened from the Friends page, as described earlier, or from a group's chat settings. To add a published bot from a group: 1. Open the target group, enter **Chat Settings**, and select **AI Assistant**. 2. Find the bot in AI Assistant and select **Add**. A bot already in the group shows **Remove**. ![AI Assistant entry in group chat settings](https://docs.debox.pro/imgBotmother/group-ai-assistant-entry-en.png) **Step 1.** Open Chat Settings and select AI Assistant. ![Add and Remove actions in the group AI Assistant list](https://docs.debox.pro/imgBotmother/group-ai-assistant-add-bot-en.png) **Step 2.** Select Add for the bot. Bots already in the group show Remove. **Warning: Publication does not override group-invitation privacy** Publish Bot approval controls whether the bot is listed in AI Assistant. It does not bypass the bot's privacy settings. To let any user add the bot through a group's AI Assistant, set **Group invitations** to **Everyone** in the bot privacy settings. If a more restrictive scope is selected, the same privacy check used for an ordinary group invitation still applies and the bot may not be added. ### 3.3 Bot level and image sending DeBox accounts must normally be Level 2 or above to send images. This account-level rule applies to both ordinary user accounts and bots, and to both private and group chats. Bots have one group-chat exception: | Destination | Image-sending requirement | | --- | --- | | Private chat | The bot must be Level 2 or above. | | A group where the bot is not an administrator | The bot must be Level 2 or above. | | A group where the bot is an administrator | The image-sending level requirement does not apply in that group. | The administrator exception only removes the image-sending level requirement in that specific group. It does not remove any other API, permission, privacy, or platform restriction. A bot still needs Level 2 to send images in private chats and in every group where it is not an administrator. Ordinary user accounts can earn energy through the methods currently listed in the Energy Center and use it to level up. The available tasks and energy values may change, so follow the current in-app information. To level up a bot, first run `/mybots` in BotMother, open the bot management page, and copy the bot's EVM address shown below its name. Then use a DeBox account at Level 5 or above: 1. Open `Profile` → `Level Energy`. 2. In the Energy Center, select `Direct Level Up`. 3. Select `Level Up Others`, enter the bot's EVM address, choose an available payment method, and confirm the current price shown in the App. The following screenshots show the bot upgrade flow. Refer to the DeBox App for current upgrade prices and available payment methods. ![Level Energy entry on the DeBox profile page](https://docs.debox.pro/imgBotLevel/bot-level-entry-en.png) **Step 1.** Open `Level Energy` from the profile page. ![Direct Level Up button in the DeBox Energy Center](https://docs.debox.pro/imgBotLevel/bot-level-direct-upgrade-en.png) **Step 2.** Select `Direct Level Up`. ![Level Up Others form with an EVM address field](https://docs.debox.pro/imgBotLevel/bot-level-upgrade-other-en.png) **Step 3.** Select `Level Up Others` and enter the bot's EVM address. The [`getMe` endpoint](https://docs.debox.pro/en/ApiOnePage#api-bot-getme) returns the bot's current `level` and can be used to confirm whether the bot meets the image-sending requirement. ## 4. Choose one receiving mode (required) DeBox Bot supports two receive modes: - Webhook mode (DeBox pushes to your service) - Long polling mode (`getUpdates` pull) They are strictly mutually exclusive: - Once a Webhook URL is configured in BotMother, Webhook is the only effective receiving path. - `getUpdates`, `GetUpdates`, and `GetUpdatesChan` are not valid receiving paths while that Webhook URL remains configured. - To switch back to long polling, clear the Webhook settings in BotMother first. ## 5. Webhook mode The BotMother Webhook settings page contains only `Webhook URL` and `Webhook Key`. ![Webhook URL and Webhook Key settings](https://docs.debox.pro/imgBotmother/bot-webhook-settings-en.jpg) Minimal setup steps: 1. Prepare a stable, publicly accessible HTTPS callback endpoint. 2. In BotMother, enter the endpoint as `Webhook URL`, configure `Webhook Key`, and save. 3. Implement the callback and verify that the incoming `X-API-KEY` value exactly matches the configured `Webhook Key`. 4. Handle the callback payload and send replies with OpenAPI. The same header name is used in two different directions: incoming webhook callbacks carry `Webhook Key` in `X-API-KEY`, while requests from the bot service to DeBox OpenAPI carry `App Key` (`API Key`) in `X-API-KEY`. `Webhook Key` is not `App Secret` (`API Secret`). Store `Webhook Key` only in a trusted backend or environment variables. Do not put it in H5 pages, browser code, public repositories, or logs. References: - [DeBox Developer OpenAPI](https://docs.debox.pro/en/ApiOnePage) ## 6. Long polling mode Minimal setup steps: 1. Ensure no webhook is configured in BotMother. 2. Initialize the bot through the SDK with `App Key` (`API Key`) and `App Secret` (`API Secret`). 3. Enable listener and process updates from `GetUpdates/GetUpdatesChan`. 4. Send replies using SDK/OpenAPI. ## 7. SDK options (3 official SDKs) 1. Go SDK: - Doc: [DeBox Bot Go SDK](https://docs.debox.pro/en/GO-SDK) - Best for high-concurrency backend services. 2. Nodejs SDK: - Doc: [DeBox Bot Nodejs SDK](https://docs.debox.pro/en/NODE-SDK) - Best for JS/TS stacks and rapid iteration. 3. Python SDK: - Doc: [DeBox Bot Python SDK](https://docs.debox.pro/en/PYTHON-SDK) - Best for AI workflows, scripts, and data workflows. ## 8. API reference boundary SDK docs focus on usage patterns, while OpenAPI is the source of truth for field constraints and response contracts. Use together: - [DeBox Developer OpenAPI](https://docs.debox.pro/en/ApiOnePage) - [Developer FAQ / Troubleshooting](https://docs.debox.pro/en/APIQA) ## 9. Recommended implementation path 1. Create bot in BotMother and complete baseline settings. 2. Start with webhook for small-scale integration testing. 3. Select Go/Nodejs/Python SDK by team stack. 4. Validate all request/response details against OpenAPI. **Caution: External links sent by a bot** External web pages sent by a bot must use `https://`; the DeBox in-app browser blocks `http://` URLs. By default, a third-party HTTPS link shows a website security notice whether it is sent as plain text, a button, or another message format. Changing the message format does not remove the notice. See [Third-party links and HTTPS](https://docs.debox.pro/en/APIQA#third-party-links) for the complete rule and review contact. --- ## DeBox Developer OpenAPI ## Endpoint Index (Ordered) 1. [`POST /openapi/bot/sendMessage`](#api-bot-sendmessage) 2. [`POST /openapi/v2/bot/sendMessage`](#api-bot-sendmessage-v2) 3. [`POST /openapi/bot/sendMessageToFans`](#api-bot-sendmessagetofans) 4. [`POST /openapi/bot/batchSendMessageToGroups`](#api-bot-batchsendmessagetogroups) 5. [`POST /openapi/bot/editMessage`](#api-bot-editmessage) 6. [`POST /openapi/bot/getMe`](#api-bot-getme) 7. [`GET /openapi/bot/energy`](#api-bot-energy) 8. [`POST /openapi/bot/getUpdates`](#api-bot-getupdates) 9. [`GET /openapi/group/info`](#api-group-info) 10. [`GET /openapi/group/is_join`](#api-group-is-join) 11. [`POST /openapi/group/admin/dao_member`](#api-group-admin-dao-member) 12. [`POST /openapi/group/admin/kick_member`](#api-group-admin-kick-member) 13. [`POST /openapi/group/admin/message/recall`](#api-group-admin-message-recall) 14. [`POST /openapi/group/admin/message/delete`](#api-group-admin-message-delete) 15. [`GET /openapi/user/info`](#api-user-info) 16. [`GET /openapi/token/info`](#api-token-info) 17. [`GET /openapi/box/info`](#api-box-info) ## Capability Overview | Capability | Endpoints and uses | | --- | --- | | Bot and messaging | Get the current bot, send or edit messages, broadcast to followers or joined groups, and receive messages and interaction events. | | Groups and moderation | Query groups and membership, list members, remove members, and recall or delete group messages. | | Users | Query public user information. | | Web3 data | Query token metadata and overall BOX information. | ## OpenAPI request address (Base URL) `https://open.debox.pro` ## Authentication A DApp that needs authenticated DeBox OpenAPI endpoints must first create a bot through BotMother. The bot's `App Key` is the `API Key` used in `X-API-KEY`. Keep it on the backend and never expose it in H5 or browser code. All endpoints except `GET /openapi/box/info` require: ```http X-API-KEY: ``` [Paid sending v2](#api-bot-sendmessage-v2) and [energy queries](#api-bot-energy) also require the signed headers `nonce`, `timestamp` and `signature`. Authentication for the free send endpoint is unchanged. All signed endpoints require a **13-digit Unix timestamp in milliseconds**. Replace `CURRENT_UNIX_TIMESTAMP_MS` below with the current millisecond timestamp. Use exactly the same value when signing and in the request header. Generate it with: ```bash timestamp="$(python3 -c 'import time; print(time.time_ns() // 1_000_000)')" ``` ## Response Envelopes ### Standard envelope The wrapped group, user, and token endpoints return `code: 1` on success. `GET /openapi/box/info` uses `code: 200` as shown in its example below. ```json { "code": 1, "success": true, "data": {} } ``` ### Bot envelope ```json { "ok": true, "success": true, "result": {} } ``` --- ## Request rate limits Each endpoint below lists its request rate and bucket dimensions. The unauthenticated `GET /openapi/box/info` uses source IP + endpoint path. All other listed endpoints use API Key + endpoint path. Requests to the same path with the same API Key share a quota across source IPs; different API Keys and different paths have separate quotas. - Pace requests evenly and avoid bursts. - Exceeding an endpoint request limit returns **HTTP 429**. The body may be plain text rather than the JSON envelopes above. - `X-Rate-Limit-Limit` reports the per-second request quota; `X-Rate-Limit-Duration` is `1` (second). - On 429, reduce the request rate and retry with backoff. If `Retry-After` is present, wait the specified number of seconds. The `sendMessage` minute quota uses a business error response; see [that endpoint](#api-bot-sendmessage). ## Global Parameter Ranges - `chat_type`: `group` | `private` - `chat_id`: - when `chat_type=group`: group `gid` - when `chat_type=private`: target user's `user_id`; this value is the same as that user's `uid` and `invite_code`, but the request field remains `chat_id` - `content` is the primary field - max length for text-like modes (`text`/`richtext`/`Markdown`/`MarkdownV2`/`HTML`): 5000 chars - default `parse_mode`: `richtext` - `parse_mode` enum: - `richtext` (default) - `text` - `Markdown` - `MarkdownV2` - `HTML` - `image` - `video` - `file` ### How to fill `content` (critical) - `parse_mode=richtext`: normal text/rich text string (default), e.g. `Hello, welcome to DeBox Bot`. - `parse_mode=text`: plain text only (no Markdown/HTML parsing), e.g. `plain text only`. - `parse_mode=Markdown`: Markdown content, e.g. `**bold**`. - `parse_mode=MarkdownV2`: MarkdownV2 content (escape special chars as required), e.g. `\\*bold\\*`. - `parse_mode=HTML`: HTML fragment (e.g. `Hello`). - `parse_mode=image`: set `content` to a public image URL (e.g. `https://cdn.example.com/a.png`). - `parse_mode=video`: set `content` to a public video URL (e.g. `https://cdn.example.com/a.mp4`). - `parse_mode=file`: set `content` to a public file URL (e.g. `https://cdn.example.com/a.pdf`). **Warning: Image-sending level requirement** Image sending is subject to bot-level and target-group administrator rules. See [Bot level and image sending](https://docs.debox.pro/en/APIs/BotGuide#bot-image-level) for the complete requirements, administrator exception, level check, and upgrade steps. ### Minimal `reply_markup` / `user_action_markup` sample ```json { "inline_keyboard": [ [ { "text": "View detail", "url": "https://docs.debox.pro/en/ApiOnePage" }, { "text": "Callback button", "callback_data": "detail" } ] ] } ``` ### `mention_type` / `mention_ids` practical guidance - Recommended mainly when `parse_mode=text`. - For rich text modes (`richtext/Markdown/MarkdownV2/HTML`), prefer writing `@` directly in `content` and avoid `mention_*`. - If no mention behavior is needed, omit both fields. --- ## 1. POST `/openapi/bot/sendMessage` **Request rate limit:** 10 requests/second per API Key + endpoint path; see [rate-limit handling](#rate-limits). **At a glance** - **Requires:** an App Key, `chat_id`, `chat_type`, and message `content`. - **Useful for:** replying to a user or sending a notification to a specified private chat or group. - **Limits:** each request sends to one specified private chat or group; it is not a fan broadcast. ### Message quota per minute In addition to the per-second request limit, this endpoint shares a rolling 60-second message quota per **bot account**. Messages to different private chats and groups share this quota; changing API Keys does not reset it. | Account type | Message quota per rolling 60 seconds | | --- | --- | | Ordinary account | 5 | | Iron account | 10 | | Green-badge account | 10 | | Gold account | 10 | Account-tier quotas do not stack. When the minute quota is exceeded, the endpoint returns HTTP 200 with `ok: false`, `success: false`, and `message: "The system is busy, please try again later!"`. The `Retry-After` header specifies how many seconds to wait. A full send queue returns the same error with `Retry-After: 10`. Check both the HTTP status and business response, and wait before retrying. ### Curl Example ```bash curl -X POST "https://open.debox.pro/openapi/bot/sendMessage" \ -H "Content-Type: application/json" \ -H "X-API-KEY: YOUR_APP_KEY" \ -d '{"chat_id":"cc0onr82","chat_type":"group","content":"hello","parse_mode":"richtext"}' ``` ### Request params (Body, JSON) - `chat_id` string, required - `chat_type` string, required, enum: `group` | `private` - `content` string, required - `parse_mode` string, optional, default `richtext` - `message_id` string, optional - `mention_type` int, optional - `mention_ids` string[], optional - `reply_markup` object, optional - `user_action_markup` object, optional ### Success response example ```json { "ok": true, "success": true, "result": { "message_id": "01JYXXXX", "text": "Hello from DeBox", "parse_mode": "richtext" } } ``` ### Error response example ```json { "ok": false, "success": false, "message": "message can't be empty" } ``` For a higher quota, use [paid sending v2](#api-bot-sendmessage-v2). A bot outside the group or a nonexistent group returns `ok=false`, `success=false` and an explanatory `message`; HTTP 200 alone does not mean success. --- ## 2. POST `/openapi/v2/bot/sendMessage` **Request rate limit:** 10 requests/second per API Key + endpoint path, plus 100 admissions per bot per rolling 60 seconds. Send a paid message to a specified private chat or group. Each confirmed successful message costs **0.12 energy**. The signed headers `X-API-KEY`, `nonce`, `timestamp` and `signature` are required. The `pay_energy`, payer and amount parameters are not required. ### Signed authentication | Header | Required | Description | | --- | --- | --- | | `X-API-KEY` | Yes | The bot's App Key. | | `nonce` | Yes | A fresh random string for every request; do not reuse it across signed endpoints with the same key. | | `timestamp` | Yes | A 13-digit Unix timestamp in milliseconds, within 5 minutes of server time, without leading zeros or a plus sign. | | `signature` | Yes | Lowercase hexadecimal `SHA1(AppSecret + nonce + timestamp)`, concatenated without separators. | Store the App Secret and sign requests only on your backend. Authentication failures are rejected before balance lookup or admission: no message is sent, no energy is charged and no minute message quota is consumed. Generate a fresh nonce, timestamp and signature for every retry; a send after an energy query also requires a new nonce. ### Request parameters and example Use the same fields, message types and formats as [sendMessage](#api-bot-sendmessage) and the [global parameter ranges](#message-fields). Required: `chat_id`, `chat_type`, `content`. Optional: `parse_mode`, `reply_markup`, etc. For group messages, the bot must have joined the group and have permission to send. ```bash # Set DEBOX_API_KEY and DEBOX_APP_SECRET securely on your backend. nonce="$(openssl rand -hex 16)" timestamp="$(python3 -c 'import time; print(time.time_ns() // 1_000_000)')" signature="$(printf '%s' "${DEBOX_APP_SECRET}${nonce}${timestamp}" | openssl dgst -sha1 | awk '{print $NF}')" curl -X POST "https://open.debox.pro/openapi/v2/bot/sendMessage" \ -H "Content-Type: application/json" \ -H "X-API-KEY: ${DEBOX_API_KEY}" \ -H "nonce: ${nonce}" \ -H "timestamp: ${timestamp}" \ -H "signature: ${signature}" \ -d '{"chat_id":"cc0onr82","chat_type":"group","content":"hello","parse_mode":"text"}' ``` ### Billing, quotas and retries - The bot bound to the API Key pays. Balance is checked before admission and again before sending; a balance below 0.12 rejects the send. - Only confirmed successful sends with a valid receipt matching the target are charged. Failed or unknown outcomes are not charged. An accepted message may still be sent and charged after the client disconnects. - Every bot has 100 admissions per rolling 60 seconds, shared across its API Keys and service instances and counted separately from the free endpoint. Failed sends do not refund admitted quota. - Up to 300 messages can wait per bot. Messages for the same bot are processed serially. Actual throughput depends on sending time; 100 admissions do not guarantee 100 completions per minute. - Minute quota exhaustion returns HTTP 200, `ok=false` and a busy message, with a wait time in `Retry-After`. A full queue returns `Retry-After: 10`. Per-second request limits return HTTP 429; see [rate limits](#rate-limits). - Balance is not reserved. If charging fails after a successful send, the actual send result is retained; the service does not automatically resend or retry the charge. - Requests are not deduplicated. A timeout or missing message ID does not prove failure; blindly resubmitting may duplicate messages and charges. Queued messages are not guaranteed to survive a service restart, and ordering across instances is not guaranteed. ### Success response example ```json { "message": "success", "ok": true, "success": true, "result": { "message_id": "01JYXXXX", "chat": null, "text": "hello", "parse_mode": "text" } } ``` ### Error response example HTTP 200 with a business failure: ```json { "message": "Insufficient energy: sending a message requires 0.12 energy", "ok": false, "result": null, "success": false } ``` | Common error `message` | Action | | --- | --- | | `Missing required authentication headers: ...` | Supply the API Key, nonce, millisecond timestamp and signature. | | `Invalid request signature. ...` | Check the App Secret and signing inputs, then sign again. | | `Request timestamp is outside the allowed 5-minute window. ...` | Synchronize your clock and generate a new signature. | | `Request rejected: nonce already used. ...` | Retry with a fresh nonce, timestamp and signature. | | `Insufficient energy: sending a message requires 0.12 energy` | Top up the bot's energy before retrying. | | `Energy account is not ready` | The energy account is not ready; retry later. | | `Failed to retrieve energy balance` | Balance lookup failed; retry later. | | `The send user is not in the group` | Add the bot to the target group first. | | `param group Id is error` | Check the target group `gid`. | | `The bot account is banned` | The bot is banned. | | `The system is busy, please try again later!` | Wait as specified by `Retry-After`. | --- ## 3. POST `/openapi/bot/sendMessageToFans` **Request rate limit:** 2 requests/second per API Key + endpoint path; see [rate-limit handling](#rate-limits). **At a glance** - **Requires:** an App Key, approved subscription-account permission, and the message fields listed below. - **Useful for:** broadcasting product updates, service notices, or announcements to the bot's followers. - **Limits:** content is limited to 2000 bytes; follower scope and delivery rules follow the bot's current platform permissions. ### Curl Example ```bash curl -X POST "https://open.debox.pro/openapi/bot/sendMessageToFans" \ -H "Content-Type: application/json" \ -H "X-API-KEY: YOUR_APP_KEY" \ -d '{"chat_id":"cc0onr82","chat_type":"group","content":"broadcast","parse_mode":"richtext"}' ``` ### Request params (Body, JSON) - `chat_id` string, required - `chat_type` string, required, enum: `group` | `private` - `content` string, required - `parse_mode` string, optional, default `richtext` Constraint: `content` max 2000 bytes. ### Success response example ```json { "ok": true, "success": true, "result": true } ``` ### Error response example ```json { "ok": false, "success": false, "message": "message must be less than 2000 bytes" } ``` --- ## 4. POST `/openapi/bot/batchSendMessageToGroups` **Request rate limit:** 2 requests/second per API Key + endpoint path; see [rate-limit handling](#rate-limits). **At a glance** - **Requires:** a valid bot App Key, message `content`, and sufficient bot energy. Banned bots cannot call this endpoint. - **Useful for:** broadcasting the same announcement to all groups the bot has joined and has not left. - **Targets:** selected by the server. No `chat_id` or `chat_type` is required, and a custom group list is not supported. Use [`sendMessage`](#api-bot-sendmessage) to target a specific group. - **Limits:** `content` must not exceed 2000 UTF-8 bytes (not 2000 characters). ### Curl Example ```bash curl -X POST "https://open.debox.pro/openapi/bot/batchSendMessageToGroups" \ -H "Content-Type: application/json" \ -H "X-API-KEY: YOUR_APP_KEY" \ -d '{"content":"Announcement: join our event this week","parse_mode":"richtext"}' ``` ### Request params (Body, JSON) | Parameter | Type | Required | Description | | --- | --- | --- | --- | | `content` | string | Yes | Non-empty message content, at most 2000 UTF-8 bytes. Use this field for the message body. | | `parse_mode` | string | No | Defaults to `richtext`. See [global field ranges](#message-fields) for values and content formats; the 2000-byte limit still applies here. | | `title` | string | No | Message push title. | | `reply_markup` | object | No | Inline buttons; see [global field ranges](#message-fields) for the structure. | `chat_id` and `chat_type` do not filter target groups. `mention_type`, `mention_ids`, and `user_action_markup` are not forwarded to this endpoint's batch delivery flow. ### Energy and delivery rules - Each target group costs **0.1 energy**. Before sending, the server checks that the balance covers `target group count × 0.1`; for example, 10 groups require at least 1 energy. - Insufficient energy, an unavailable energy account, or a query failure rejects the entire request before any group delivery. - The precheck does not reserve or deduct energy. Each successful group send with a message receipt deducts 0.1 energy. A deduction failure stops delivery to subsequent groups. - With no target groups, the request succeeds with zero count, cost and duration. This endpoint sends only to joined groups, not the public channel. If the balance cannot be retrieved or the energy account is missing in this zero-target case, `current_energy_balance` is `null`. - Delivery is asynchronous. Success means the request passed prechecks and delivery was started; it does not guarantee receipt by every group. No task ID, per-group results, or message IDs are returned. - Do not resubmit simply because a message has not appeared yet; repeated requests may cause duplicate delivery and energy charges. ### Estimate result fields | Field | Type | Description | | --- | --- | --- | | `total_messages` | integer | Number of joined groups selected; one message is planned per group. | | `estimated_energy_cost` | string | Estimated total energy at 0.1 per message. | | `current_energy_balance` | string / null | Balance snapshot at submission; null if unavailable with no target groups. | | `estimated_duration_minutes` | integer | Estimated minutes, rounded up; 0 for no messages. Actual duration may be longer. | | `summary` | string | User-facing estimate text, currently returned in Chinese. | The result is an estimate, not a charge receipt or completion notification. Actual energy is charged for successful sends only. The message limit is 200 messages per minute. ### Success response example ```json { "message": "success", "ok": true, "result": { "total_messages": 16, "estimated_energy_cost": "1.6", "current_energy_balance": "1000", "estimated_duration_minutes": 1, "summary": "本任务预计发送 16 条群消息,预计消耗 1.6 能量,当前能量余额 1000 能量,预计耗时约 1 分钟。实际能量按成功发送条数结算,失败不扣。" }, "success": true } ``` ### Error response example ```json { "ok": false, "success": false, "message": "Insufficient energy: sending to 9 groups requires 0.9 energy; current balance is 0.8. No messages were sent.", "result": null } ``` Business errors may also return HTTP 200. Check `ok` / `success`, not just the HTTP status. | Common error `message` | Meaning and action | | --- | --- | | `message can't be empty` | Provide non-empty `content`. | | `message must be less than 2000 bytes` | Content exceeds 2000 bytes. Shorten it before retrying. | | `The bot account is banned` | The bot account is banned. | | `Sender must be a bot.` | The sender bound to the App Key is not a bot. | | `Insufficient energy: ... No messages were sent.` | Insufficient energy. The error includes the group count, required energy, and current balance. Top up before resubmitting. | | `Energy account is not ready. No messages were sent. Please try again later.` | The energy account is not ready. Retry later. | | `Failed to retrieve target groups. No messages were sent.` | Target group lookup failed. Retry later. | | `Failed to retrieve energy balance. No messages were sent.` | Energy balance lookup failed. Retry later. | --- ## 5. POST `/openapi/bot/editMessage` **Request rate limit:** 10 requests/second per API Key + endpoint path; see [rate-limit handling](#rate-limits). **At a glance** - **Requires:** an App Key, the target chat, the exact `message_id`, and the replacement content. - **Useful for:** correcting or updating a message previously sent by the bot. - **Limits:** it does not allow the bot to edit arbitrary messages sent by other users. ### Curl Example ```bash curl -X POST "https://open.debox.pro/openapi/bot/editMessage" \ -H "Content-Type: application/json" \ -H "X-API-KEY: YOUR_APP_KEY" \ -d '{"chat_id":"cc0onr82","chat_type":"group","message_id":"01JYXXXX","content":"edited","parse_mode":"richtext"}' ``` ### Request params (Body, JSON) - `chat_id` string, required - `chat_type` string, required, enum: `group` | `private` - `message_id` string, required - `content` string, required - `parse_mode` string, optional, default `richtext` ### Success response example ```json { "ok": true, "success": true, "result": true } ``` ### Error response example ```json { "ok": false, "success": false, "message": "EditMessageText param Group Id is error" } ``` --- ## 6. POST `/openapi/bot/getMe` **Request rate limit:** 2 requests/second per API Key + endpoint path; see [rate-limit handling](#rate-limits). **At a glance** - **Requires:** an App Key; no request body is required. - **Useful for:** checking the current bot's ID, profile, address, and level. - **Limits:** it returns the bot bound to the current App Key, not an ordinary user's profile. ### Curl Example ```bash curl -X POST "https://open.debox.pro/openapi/bot/getMe" \ -H "X-API-KEY: YOUR_APP_KEY" ``` ### Request params None. ### Success response example ```json { "ok": true, "success": true, "result": { "name": "DeBox Bot", "address": "0x...", "pic": "https://...", "user_id": "u1", "level": 3, "level_icon": "https://.../icon/level/v3.png" } } ``` ### Error response example ```json { "ok": false, "success": false, "message": "invalid param" } ``` --- ## 7. GET `/openapi/bot/energy` **Request rate limit:** 2 requests/second per API Key + endpoint path. Query the energy balance of the account bound to the API Key. No query parameters are needed; parameters such as `user_id` cannot select another account. ### Signed authentication | Header | Required | Description | | --- | --- | --- | | `X-API-KEY` | Yes | The bot's App Key. | | `nonce` | Yes | A fresh random string for every request; do not reuse it across signed endpoints with the same key. | | `timestamp` | Yes | 13-digit Unix timestamp in milliseconds, within 5 minutes of server time, without leading zeros or a plus sign. | | `signature` | Yes | Lowercase hexadecimal `SHA1(AppSecret + nonce + timestamp)`, concatenated without separators. | `AppSecret` is the App Secret / API Secret, not the API Key or Webhook Key. Store secrets and sign requests only on your backend. Generate a new nonce, timestamp and signature for each retry. ### Curl example ```bash # Run only on your backend. Set DEBOX_API_KEY and DEBOX_APP_SECRET securely. nonce="$(openssl rand -hex 16)" timestamp="$(python3 -c 'import time; print(time.time_ns() // 1_000_000)')" signature="$(printf '%s' "${DEBOX_APP_SECRET}${nonce}${timestamp}" | openssl dgst -sha1 | awk '{print $NF}')" curl "https://open.debox.pro/openapi/bot/energy" \ -H "X-API-KEY: ${DEBOX_API_KEY}" \ -H "nonce: ${nonce}" \ -H "timestamp: ${timestamp}" \ -H "signature: ${signature}" ``` ### Success response example ```json { "message": "success", "ok": true, "result": { "energy_balance": "996.8" }, "success": true } ``` `energy_balance` is a decimal string without fixed decimal places. Zero balance or a missing energy account returns `"0"`; a missing bound user or balance lookup failure returns an error. Queries do not consume energy. ### Error response example ```json { "message": "Missing required authentication headers: nonce, timestamp, signature.", "ok": false, "result": null, "success": false } ``` Missing or invalid signatures, timestamps outside the 5-minute window, and reused nonces are rejected. Business errors may return HTTP 200; inspect `ok` / `success`. Per-second throttling returns HTTP 429. --- ## 8. POST `/openapi/bot/getUpdates` **Request rate limit:** 2 requests/second per API Key + endpoint path; see [rate-limit handling](#rate-limits). **At a glance** - **Requires:** an App Key and Long Polling as the active receiving mode. - **Useful for:** receiving new messages and interaction events sent to the bot. - **Limits:** Webhook and Long Polling are mutually exclusive, and this endpoint is not a general chat-history query. ### Curl Example ```bash curl -X POST "https://open.debox.pro/openapi/bot/getUpdates" \ -H "Content-Type: application/json" \ -H "X-API-KEY: YOUR_APP_KEY" \ -d '{"timeout":30}' ``` ### Request params (Body, JSON) - `timeout` int, optional, range `1~60`, default `30` If a Webhook URL is configured in BotMother, Webhook is the only effective receiving path and this endpoint cannot be used to receive messages. Clear the Webhook settings before using `getUpdates` for Long Polling. ### Success response example (with updates) ```json { "ok": true, "success": true, "result": [ { "id": 123, "message": { "message_id": "01JYXXXX", "from": { "user_id": "u1", "name": "Alice", "address": "0x..." }, "chat": { "id": "cc0onr82", "type": "group" }, "text": "Ping", "parse_mode": "richtext" } } ] } ``` ### Success response example (timeout, no updates) ```json { "ok": true, "success": true, "result": [] } ``` ### Error response example ```json { "ok": false, "success": false, "message": "Invalid timeout value" } ``` ### Button interaction events Button clicks use the selected receiving mode: direct Webhook delivery when configured, otherwise `getUpdates`. Non-empty callback data appears in `callback_query.data`; `from` identifies the clicking user and `message` contains the original message ID, text, `parse_mode`, and chat. For groups, `chat.id` is the group `gid`; for private chats it is the clicking user’s code. Empty callback data produces a `message` instead. Both modes use the same event contents, but Webhook omits the polling record `id` and the `result` envelope. See [Webhook button events](https://docs.debox.pro/en/GO-SDK-Webhook#button-events) for payloads and failure/discard behavior. --- ## 9. GET `/openapi/group/info` **Request rate limit:** 1 request/second per API Key + endpoint path; see [rate-limit handling](#rate-limits). **At a glance** - **Requires:** an App Key and the group `gid`. - **Useful for:** validating a group ID and displaying basic group information before sending notifications or performing group operations. - **Limits:** it returns group metadata, not the complete member list; use `dao_member` when a member list is required. ### Curl Example ```bash curl "https://open.debox.pro/openapi/group/info?gid=cc0onr82" \ -H "X-API-KEY: YOUR_APP_KEY" ``` ### Query params - `gid` string, required ### Success response example ```json { "code": 1, "success": true, "data": { "is_charge": false, "subchannel_number": 2, "group_name": "DeBox Dev", "gid": "cc0onr82", "group_number": 345, "group_pic": "https://...", "create_time": "2026-05-14 14:00:00", "maximum": "Unlimited", "mod": ["Alice", "Bob"], "mod_info": [ { "name": "Alice", "address": "0x...", "pic": "https://...", "user_id": "u1" } ] } } ``` ### Error response example ```json { "code": -3001, "success": false, "message": "No such group" } ``` --- ## 10. GET `/openapi/group/is_join` **Request rate limit:** 1 request/second per API Key + endpoint path; see [rate-limit handling](#rate-limits). **At a glance** - **Requires:** an App Key bound to a bot and the eight-character group `gid`. - **Useful for:** checking whether the bot bound to the current API key is in the target group. - **Limits:** `data.joined` is `false` for a bot that has never joined or has left the group. This endpoint does not join a user or return the member list. ### Curl Example ```bash curl "https://open.debox.pro/openapi/group/is_join?gid=cc0onr82" \ -H "X-API-KEY: YOUR_APP_KEY" ``` ### Query params - `gid` string, required, eight characters; surrounding whitespace is trimmed. - `user_id` is no longer required and is ignored if supplied; it cannot select another user. - The API key must be bound to a valid, existing bot; missing or invalid bindings return an error. ### Success response example ```json { "code": 1, "success": true, "message": "success", "data": {"joined": true} } ``` ### Error response example ```json { "code": -2004, "success": false, "message": "API key bound bot is invalid", "data": null } ``` --- ## 11. POST `/openapi/group/admin/dao_member` **Request rate limit:** 1 request/second per API Key + endpoint path; see [rate-limit handling](#rate-limits). **At a glance** - **Requires:** an App Key, signed request headers, the group `gid`, and the required management permission in that group. - **Useful for:** reading the current member list and public member profiles page by page. - **Limits:** each page contains at most 50 members; the endpoint does not return historical chat messages or private conversations. ### Curl Example ```bash curl -X POST "https://open.debox.pro/openapi/group/admin/dao_member" \ -H "Content-Type: application/json" \ -H "X-API-KEY: YOUR_APP_KEY" \ -H "nonce: RANDOM_NONCE" \ -H "timestamp: CURRENT_UNIX_TIMESTAMP_MS" \ -H "signature: SHA1(app_secret+nonce+timestamp)" \ -d '{"gid":"cc0onr82","page":1,"size":20}' ``` ### Extra headers (required) - `nonce` string - `timestamp` string, a 13-digit Unix timestamp in milliseconds - `signature` string Signature algorithm: `sha1(app_secret + nonce + timestamp)`. ### Request params (Body, JSON) - `gid` string, required, length `1~8` - `page` int, optional, if `<=0` then treated as `1` - `size` int, optional, default `50`, max `50` ### Success response example ```json { "code": 1, "success": true, "data": [ { "user_id": "u1", "name": "Alice", "pic": "https://...", "address": "0x...", "signature": "builder" } ] } ``` ### Error response example ```json { "code": -4017, "success": false, "message": "permission denied" } ``` --- ## 12. POST `/openapi/group/admin/kick_member` **Request rate limit:** 1 request/second per API Key + endpoint path; see [rate-limit handling](#rate-limits). **At a glance** - **Requires:** an App Key, signed request headers, the target `gid`, member `user_id` values, and moderator or builder permission. - **Useful for:** removing specified members from the target group under its moderation rules, such as in cases of spam, policy violations, or failure to meet the group's admission criteria. - **Limits:** this operation changes group state and accepts at most 20 users per request; verify it with test accounts first. ### Purpose Remove one or more members from a DeBox group. The bot account bound to the current `X-API-KEY` must already be in the target group and must have moderator or builder permission in that group. ### Curl Example ```bash curl -X POST "https://open.debox.pro/openapi/group/admin/kick_member" \ -H "Content-Type: application/json" \ -H "X-API-KEY: YOUR_APP_KEY" \ -H "nonce: RANDOM_NONCE" \ -H "timestamp: CURRENT_UNIX_TIMESTAMP_MS" \ -H "signature: SHA1(app_secret+nonce+timestamp)" \ -d '{ "gid":"cc0onr82", "user_ids":["u1","u2"] }' ``` ### Extra headers (required) - `nonce` string - `timestamp` string, a 13-digit Unix timestamp in milliseconds - `signature` string Signature algorithm: `sha1(app_secret + nonce + timestamp)`. ### Permission requirements - `X-API-KEY` must be valid. - The API key must be bound to an existing DeBox bot account. - The bound bot must be a moderator or builder of the target group. ### Request params (Body, JSON) - `gid` string, required, target group ID, length `1~8` - `user_ids` string array, required, list of DeBox `user_id` values to remove - `user_ids` maximum size: `20` per request ### Validation and execution rules - Empty `user_ids` is rejected. - Empty string items inside `user_ids` are rejected. - Duplicate `user_id` values are de-duplicated before execution. - If any provided `user_id` cannot be resolved to a valid user, the request fails. ### Success response example ```json { "code": 1, "success": true, "message": "success", "data": true } ``` ### Error response examples ```json { "code": -2004, "success": false, "message": "uid size must be less than or equal to 20", "data": null } ``` ```json { "code": -4017, "success": false, "message": "permission denied", "data": null } ``` --- ## 13. POST `/openapi/group/admin/message/recall` **Request rate limit:** 1 request/second per API Key + endpoint path; see [rate-limit handling](#rate-limits). **At a glance** - **Requires:** an App Key, signed request headers, moderator or builder permission, the group `gid`, the original sender's `user_id`, and the exact `message_id`. - **Useful for:** recalling a specified message in the target group under its moderation rules, for example to address spam, policy-violating content, or a message sent by mistake. - **Limits:** the message and sender must match the target group; this is not a general history search or arbitrary message deletion API. ### Purpose Recall a group message through an administrator action. After a successful recall, the group displays a system notification similar to: `MOD {operator_name} recalled {sender_name}'s message.` The exact wording follows the language selected in the DeBox App. ### Curl Example ```bash curl -X POST "https://open.debox.pro/openapi/group/admin/message/recall" \ -H "Content-Type: application/json" \ -H "X-API-KEY: YOUR_APP_KEY" \ -H "nonce: RANDOM_NONCE" \ -H "timestamp: CURRENT_UNIX_TIMESTAMP_MS" \ -H "signature: SHA1(app_secret+nonce+timestamp)" \ -d '{ "gid":"cc0onr82", "user_id":"u1", "message_id":"01HXYZABCDEF1234567890" }' ``` ### Extra headers (required) - `nonce` string - `timestamp` string, a 13-digit Unix timestamp in milliseconds - `signature` string Signature algorithm: `sha1(app_secret + nonce + timestamp)`. ### Permission requirements - `X-API-KEY` must be valid. - The API key must be bound to an existing DeBox bot account. - The bound bot must be a moderator or builder of the target group. ### Request params (Body, JSON) - `gid` string, required, target group ID, length `1~8` - `user_id` string, required, DeBox `user_id` of the original sender - `message_id` string, required, message ID to recall ### Important notes - `user_id` must resolve to an existing DeBox user. - `message_id` must identify a message in the target group that can be modified by the platform. - The operator name in the recall notice prefers the bot display name and falls back to the bot `user_id`. - The original sender name follows the same fallback rule. ### Success response example ```json { "code": 1, "success": true, "message": "success", "data": true } ``` ### Error response examples ```json { "code": -2004, "success": false, "message": "message_id is required", "data": null } ``` ```json { "code": -2000, "success": false, "message": "recall message failed", "data": null } ``` --- ## 14. POST `/openapi/group/admin/message/delete` **Request rate limit:** 1 request/second per API Key + endpoint path; see [rate-limit handling](#rate-limits). Delete a specific group message for all perspectives through IM. This does not replace the message with a recall notice. ### Permissions and parameters - Requires a valid `X-API-KEY` and signed headers `nonce`, `timestamp`, and `signature`. Algorithm: `sha1(app_secret + nonce + timestamp)`. - The API key must be bound to an existing bot. Active moderators or builders of the target group can delete other users’ messages. - A non-moderator bot can only delete its own messages in that group. The server verifies sender, group, group conversation type, and non-deleted status against the message record. - `gid`: required, eight-character group invite code. - `user_id`: required, original sender’s eight-character DeBox user code. Numeric-only values are also treated as user codes, not internal numeric IDs. - `message_id`: required, message ID to delete. Surrounding whitespace is trimmed from all three fields. ### Curl example ```bash curl -X POST "https://open.debox.pro/openapi/group/admin/message/delete" \ -H "Content-Type: application/json" \ -H "X-API-KEY: YOUR_APP_KEY" \ -H "nonce: RANDOM_NONCE" \ -H "timestamp: CURRENT_UNIX_TIMESTAMP_MS" \ -H "signature: SHA1(app_secret+nonce+timestamp)" \ -d '{"gid":"cc0onr82","user_id":"uvg2p6ho","message_id":"01HXYZABCDEF1234567890"}' ``` ### Success response ```json { "code": 1, "success": true, "message": "success", "data": true } ``` ### Errors | code | message | | --- | --- | | 400 | Your signature is not available | | -2004 | gid is invalid / user_id is invalid / message_id is required / group not found / user not found | | -2006 | Bot not exist | | -4017 | permission denied | | -2000 | query group failed / query user failed / query bot failed / query permission failed / query message failed / delete message failed | --- ## 15. GET `/openapi/user/info` **Request rate limit:** 10 requests/second per API Key + endpoint path; see [rate-limit handling](#rate-limits). **At a glance** - **Requires:** an App Key and either a DeBox `user_id` or an EVM wallet address. - **Useful for:** displaying a user's public name and avatar or matching a wallet address to a DeBox profile. - **Limits:** it returns public profile fields, not private chats, message history, or private keys. ### Curl Example ```bash curl "https://open.debox.pro/openapi/user/info?user_id=uvg2p6ho" \ -H "X-API-KEY: YOUR_APP_KEY" ``` ### Query params - `user_id` string, optional; an eight-character DeBox invite code - `address` string, optional (EVM address) - at least one is required; an eight-character `user_id` takes precedence over `address` ### Success response example ```json { "code": 1, "success": true, "data": { "user_id": "uvg2p6ho", "name": "Alice", "address": "0x...", "pic": "https://...", "signature": "gm builder" } } ``` ### Error response example ```json { "code": -2004, "success": false, "message": "invalid param" } ``` --- ## 16. GET `/openapi/token/info` **Request rate limit:** 5 requests/second per API Key + endpoint path; see [rate-limit handling](#rate-limits). **At a glance** - **Requires:** an App Key and `contract_address`; `chain_id` is optional and is treated as `0` when omitted or negative. - **Useful for:** displaying a token's name, symbol, decimals, and logo after a contract address is entered. - **Limits:** it returns token metadata, not market price or the token balance of a wallet. ### Curl Example ```bash curl "https://open.debox.pro/openapi/token/info?contract_address=0x55d398326f99059fF775485246999027B3197955&chain_id=56" \ -H "X-API-KEY: YOUR_APP_KEY" ``` ### Query params - `contract_address` string, required - `chain_id` int, optional; missing/negative is treated as `0` ### Success response example ```json { "code": 1, "success": true, "data": { "chain_id": 56, "token": "0x55d398326f99059fF775485246999027B3197955", "decimal": 18, "name": "Tether USD", "symbol": "USDT", "logo_url": "https://..." } } ``` ### Error response example ```json { "code": -2004, "success": false, "message": "contract_address must be a valid contract address" } ``` --- ## 17. GET `/openapi/box/info` **Request rate limit:** 5 requests/second per source IP + endpoint path; see [rate-limit handling](#rate-limits). **At a glance** - **Requires:** no parameters and no App Key. - **Useful for:** retrieving global BOX data, such as its maximum supply, current supply, burned amount, and locked amount. - **Limits:** it returns overall BOX data, not the BOX balance held by a specific user. ### Curl Example ```bash curl "https://open.debox.pro/openapi/box/info" ``` Public endpoint, no API key required. ### Query params None. ### Success response example ```json { "code": 1, "success": true, "data": { "max_supply": "1000000000", "burned": "...", "supply": "...", "locked": "...", "address": "0x...", "symbol": "BOX", "chainId": 1, "icon": "https://...", "stake": "..." } } ``` --- ## DeBox Bot Go SDK Guide Source repository: - [debox-pro/debox-chat-go-sdk](https://github.com/debox-pro/debox-chat-go-sdk) ## 1. SDK capabilities The SDK provides: - Bot init: `NewBotAPI(apiKey, apiSecret)` - Message sending: `bot.Send(...)` - Long polling updates: `GetUpdates` / `GetUpdatesChan` - Inline keyboard callbacks: `InlineKeyboardMarkup` + `CallbackQuery` - Message editing: `NewEditMessageText` + `bot.Send(...)` Webhook is split into a standalone guide: - [DeBox Bot Go SDK Webhook](https://docs.debox.pro/en/GO-SDK-Webhook) ## 2. Receiving mode notes This guide uses Long Polling. Before running it, clear any Webhook URL configured in BotMother; otherwise Long Polling is not a valid receiving path. For mode selection and switching, see the [DeBox Bot Development Overview](https://docs.debox.pro/en/APIs/BotGuide). For Webhook implementation, see [DeBox Bot Go SDK Webhook](https://docs.debox.pro/en/GO-SDK-Webhook). --- ## 3. Long polling usage (detailed SDK workflow) ### 3.1 Install ```bash go get github.com/debox-pro/debox-chat-go-sdk ``` ### 3.2 Credentials The Bot details page in BotMother displays `App Key` and `App Secret`. Map them to the SDK parameters as follows: - `App Key` -> `API_KEY` (required) - `App Secret` -> `API_SECRET` (recommended) See [Credentials in the DeBox Bot Development Overview](https://docs.debox.pro/en/APIs/BotGuide) for the complete mapping and storage rules. ### 3.3 Init + first message ```go package main import ( "log" boxbotapi "github.com/debox-pro/debox-chat-go-sdk/boxbotapi" ) func main() { bot, err := boxbotapi.NewBotAPI("YOUR_APP_KEY", "YOUR_API_SECRET") if err != nil { log.Fatalf("init bot failed: %v", err) } msg := boxbotapi.NewMessage("cc0onr82", "group", "Hello from Go SDK") msg.ParseMode = boxbotapi.ModeRichText sent, err := bot.Send(msg) if err != nil { log.Fatalf("send failed: %v", err) } log.Printf("sent message_id=%s", sent.MessageID) } ``` ### 3.4 Long polling via `GetUpdatesChan` (recommended) ```go package main import ( "context" "log" boxbotapi "github.com/debox-pro/debox-chat-go-sdk/boxbotapi" ) func main() { bot, err := boxbotapi.NewBotAPI("YOUR_APP_KEY", "YOUR_API_SECRET") if err != nil { log.Fatal(err) } boxbotapi.MessageListener = true cfg := boxbotapi.NewUpdate(0) cfg.Timeout = 30 ctx := context.Background() updates := bot.GetUpdatesChan(cfg) for { select { case <-ctx.Done(): bot.StopReceivingUpdates() return case upd := <-updates: if upd.Message != nil { log.Printf("from=%s chat=%s text=%s", upd.Message.From.UserId, upd.Message.Chat.ID, upd.Message.Text) } if upd.CallbackQuery != nil { log.Printf("callback=%s", upd.CallbackQuery.Data) } } } } ``` ### 3.5 Manual polling via `GetUpdates` ```go cfg := boxbotapi.NewUpdate(0) cfg.Timeout = 30 updates, err := bot.GetUpdates(cfg) if err != nil { log.Printf("get updates failed: %v", err) return } for _, upd := range updates { if upd.Message != nil { log.Println(upd.Message.Text) } } ``` ### 3.6 Send multiple message types ```go m1 := boxbotapi.NewMessage(chatID, chatType, "*bold* _italic_") m1.ParseMode = boxbotapi.ModeMarkdownV2 _, _ = bot.Send(m1) m2 := boxbotapi.NewMessage(chatID, chatType, "Hello docs") m2.ParseMode = boxbotapi.ModeHTML _, _ = bot.Send(m2) m3 := boxbotapi.NewMessage(chatID, chatType, "https://example.com/a.png") m3.ParseMode = boxbotapi.ModeImage _, _ = bot.Send(m3) ``` Available parse modes: - `boxbotapi.ModeRichText` - `boxbotapi.ModeText` - `boxbotapi.ModeMarkdown` - `boxbotapi.ModeMarkdownV2` - `boxbotapi.ModeHTML` - `boxbotapi.ModeImage` - `boxbotapi.ModeVideo` - `boxbotapi.ModeFile` For `chat_id`, `chat_type`, `parse_mode`, `content`, media URL, and length rules, see the [OpenAPI message fields](https://docs.debox.pro/en/ApiOnePage#message-fields). ### 3.7 Inline keyboard + callback ```go markup := boxbotapi.NewInlineKeyboardMarkup( boxbotapi.NewInlineKeyboardRow( boxbotapi.NewInlineKeyboardButtonData("Details", "detail"), boxbotapi.NewInlineKeyboardButtonURL("Open site", "https://debox.pro"), ), ) msg := boxbotapi.NewMessage("cc0onr82", "group", "Pick one") msg.ParseMode = boxbotapi.ModeRichText msg.ReplyMarkup = markup _, _ = bot.Send(msg) ``` Callback handler: ```go if upd.CallbackQuery != nil { data := upd.CallbackQuery.Data _ = data } ``` ### 3.8 Edit message ```go edit := boxbotapi.NewEditMessageText("cc0onr82", "group", "MESSAGE_ID", "edited text") edit.ParseMode = boxbotapi.ModeRichText _, err := bot.Send(edit) if err != nil { log.Printf("edit failed: %v", err) } ``` --- ## DeBox Bot Nodejs SDK Guide Source repository: - [debox-pro/debox-chat-nodejs-sdk](https://github.com/debox-pro/debox-chat-nodejs-sdk) ## 1. SDK capabilities `debox-chat-nodejs-sdk` provides: - Bot initialization: `NewBotAPI(apiKey, apiSecret)` - Send message: `bot.Send(...)` - Long polling updates: `GetUpdates` / `GetUpdatesChan` - Inline keyboard and callback handling - Edit message: `NewEditMessageText(...)` / `NewEditMessageTextAndMarkup(...)` ## 2. Receiving mode notes This guide uses Long Polling. Before running it, clear any Webhook URL configured in BotMother; otherwise Long Polling is not a valid receiving path. For mode selection and switching, see the [DeBox Bot Development Overview](https://docs.debox.pro/en/APIs/BotGuide). For Webhook implementation, see [DeBox Bot Go SDK Webhook](https://docs.debox.pro/en/GO-SDK-Webhook). ## 3. Install and init ### 3.1 Install ```bash npm install github:debox-pro/debox-chat-nodejs-sdk ``` Or clone and install locally: ```bash git clone https://github.com/debox-pro/debox-chat-nodejs-sdk.git cd debox-chat-nodejs-sdk npm install ``` ### 3.2 Credentials The Bot details page in BotMother displays `App Key` and `App Secret`. Map them to the SDK parameters as follows: - `App Key` -> `API_KEY` (required) - `App Secret` -> `API_SECRET` (recommended) See [Credentials in the DeBox Bot Development Overview](https://docs.debox.pro/en/APIs/BotGuide) for the complete mapping and storage rules. Set environment variables: ```bash export DEBOX_BOT_API_KEY="YOUR_APP_KEY" export DEBOX_BOT_API_SECRET="YOUR_API_SECRET" ``` ### 3.3 First message ```js const boxbotapi = require("./boxbotapi"); async function main() { const bot = await boxbotapi.NewBotAPI( process.env.DEBOX_BOT_API_KEY, process.env.DEBOX_BOT_API_SECRET || "", ); const msg = boxbotapi.NewMessage("cc0onr82", "group", "Hello from Nodejs SDK"); msg.ParseMode = boxbotapi.ModeRichText; const sent = await bot.Send(msg); console.log("sent message_id=", sent.MessageID); } main().catch(console.error); ``` ## 4. Receive messages with Long Polling ```js const boxbotapi = require("./boxbotapi"); async function run() { boxbotapi.Debug = false; boxbotapi.MessageListener = true; const bot = await boxbotapi.NewBotAPI( process.env.DEBOX_BOT_API_KEY, process.env.DEBOX_BOT_API_SECRET || "", ); const u = boxbotapi.NewUpdate(0); u.Timeout = 60; for await (const update of bot.GetUpdatesChan(u)) { if (update.Message) { const text = update.Message.Text || ""; console.log("message:", text); const reply = boxbotapi.NewMessage( update.Message.Chat.ID, update.Message.Chat.Type, `Received: ${text}`, ); reply.ParseMode = boxbotapi.ModeRichText; await bot.Send(reply); } if (update.CallbackQuery) { console.log("callback:", update.CallbackQuery.Data); } } } run().catch(console.error); ``` ## 5. Parse mode constants SDK constants: - `boxbotapi.ModeRichText` - `boxbotapi.ModeMarkdown` - `boxbotapi.ModeMarkdownV2` - `boxbotapi.ModeHTML` - `boxbotapi.ModeImage` - `boxbotapi.ModeVideo` - `boxbotapi.ModeFile` For `parse_mode`, `content`, media URL, and length rules, see the [OpenAPI message fields](https://docs.debox.pro/en/ApiOnePage#message-fields). ## 6. Inline keyboard + callback ```js const markup = boxbotapi.NewInlineKeyboardMarkup( boxbotapi.NewInlineKeyboardRow( boxbotapi.NewInlineKeyboardButtonData("Details", "detail"), boxbotapi.NewInlineKeyboardButtonURL("Open docs", "https://docs.debox.pro"), ), ); const msg = boxbotapi.NewMessage("cc0onr82", "group", "Choose one"); msg.ParseMode = boxbotapi.ModeRichText; msg.ReplyMarkup = markup; await bot.Send(msg); ``` Handle callback: ```js if (update.CallbackQuery) { const data = update.CallbackQuery.Data; const chat = update.CallbackQuery.Message.Chat; const messageId = update.CallbackQuery.Message.MessageID; const edit = boxbotapi.NewEditMessageText(chat.ID, chat.Type, messageId, `clicked: ${data}`); edit.ParseMode = boxbotapi.ModeRichText; await bot.Send(edit); } ``` ## 7. Chat routing fields Pass `chat_id` and `chat_type` to the SDK constructors according to the [OpenAPI routing rules](https://docs.debox.pro/en/ApiOnePage#message-fields). ## 8. Common issues 1. No updates received: - Check webhook status first (mutually exclusive with polling). - Ensure `boxbotapi.MessageListener = true`. 2. Request failed with auth error: - Check `API_KEY/API_SECRET` and signature-related headers. 3. Media send failed: - Follow the [media-send troubleshooting checklist](https://docs.debox.pro/en/APIQA#media-send-troubleshooting). --- ## DeBox Bot Python SDK Guide Source repository: - [debox-pro/debox-chat-python-sdk](https://github.com/debox-pro/debox-chat-python-sdk) ## 1. SDK capabilities `debox-chat-python-sdk` provides: - Bot initialization: `NewBotAPI(api_key, api_secret)` - Message sending: `bot.Send(...)` - Long polling updates: `GetUpdates` / `GetUpdatesChan` - Inline keyboard + callback handling - Message editing: `NewEditMessageText(...)` / `NewEditMessageTextAndMarkup(...)` ## 2. Receiving mode notes This guide uses Long Polling. Before running it, clear any Webhook URL configured in BotMother; otherwise Long Polling is not a valid receiving path. For mode selection and switching, see the [DeBox Bot Development Overview](https://docs.debox.pro/en/APIs/BotGuide). For Webhook implementation, see [DeBox Bot Go SDK Webhook](https://docs.debox.pro/en/GO-SDK-Webhook). ## 3. Install and init ### 3.1 Install ```bash pip install git+https://github.com/debox-pro/debox-chat-python-sdk.git ``` Or clone and install locally: ```bash git clone https://github.com/debox-pro/debox-chat-python-sdk.git cd debox-chat-python-sdk pip install -e . ``` ### 3.2 Credentials The Bot details page in BotMother displays `App Key` and `App Secret`. Map them to the SDK parameters as follows: - `App Key` -> `API_KEY` (required) - `App Secret` -> `API_SECRET` (recommended) See [Credentials in the DeBox Bot Development Overview](https://docs.debox.pro/en/APIs/BotGuide) for the complete mapping and storage rules. ```bash export DEBOX_BOT_API_KEY="YOUR_APP_KEY" export DEBOX_BOT_API_SECRET="YOUR_API_SECRET" ``` ### 3.3 First message ```python import os import boxbotapi bot = boxbotapi.NewBotAPI( os.getenv("DEBOX_BOT_API_KEY", ""), os.getenv("DEBOX_BOT_API_SECRET", ""), ) msg = boxbotapi.NewMessage("cc0onr82", "group", "Hello from Python SDK") msg.ParseMode = boxbotapi.ModeRichText sent = bot.Send(msg) print("sent message_id=", sent.MessageID) ``` ## 4. Receive messages with Long Polling ```python import os import boxbotapi from boxbotapi import configs as cfg cfg.Debug = False cfg.MessageListener = True bot = boxbotapi.NewBotAPI( os.getenv("DEBOX_BOT_API_KEY", ""), os.getenv("DEBOX_BOT_API_SECRET", ""), ) u = boxbotapi.NewUpdate(0) u.Timeout = 60 for update in bot.GetUpdatesChan(u): if update.Message is not None: text = update.Message.Text or "" print("message:", text) reply = boxbotapi.NewMessage( update.Message.Chat.ID, update.Message.Chat.Type, f"Received: {text}", ) reply.ParseMode = boxbotapi.ModeRichText bot.Send(reply) if update.CallbackQuery is not None: print("callback:", update.CallbackQuery.Data) ``` ## 5. Parse mode constants SDK constants: - `boxbotapi.ModeRichText` - `boxbotapi.ModeMarkdown` - `boxbotapi.ModeMarkdownV2` - `boxbotapi.ModeHTML` - `boxbotapi.ModeImage` - `boxbotapi.ModeVideo` - `boxbotapi.ModeFile` For `parse_mode`, `content`, media URL, and length rules, see the [OpenAPI message fields](https://docs.debox.pro/en/ApiOnePage#message-fields). ## 6. Inline keyboard + callback ```python markup = boxbotapi.NewInlineKeyboardMarkup( boxbotapi.NewInlineKeyboardRow( boxbotapi.NewInlineKeyboardButtonData("Details", "detail"), boxbotapi.NewInlineKeyboardButtonURL("Open docs", "https://docs.debox.pro"), ) ) msg = boxbotapi.NewMessage("cc0onr82", "group", "Choose one") msg.ParseMode = boxbotapi.ModeRichText msg.ReplyMarkup = markup bot.Send(msg) ``` Handle callback and edit message: ```python if update.CallbackQuery is not None: data = update.CallbackQuery.Data chat = update.CallbackQuery.Message.Chat message_id = update.CallbackQuery.Message.MessageID edit = boxbotapi.NewEditMessageText(chat.ID, chat.Type, message_id, f"clicked: {data}") edit.ParseMode = boxbotapi.ModeRichText bot.Send(edit) ``` ## 7. Chat routing fields Pass `chat_id` and `chat_type` to the SDK constructors according to the [OpenAPI routing rules](https://docs.debox.pro/en/ApiOnePage#message-fields). ## 8. Common issues 1. No updates received: - Check webhook status first (mutually exclusive with polling). - Ensure `cfg.MessageListener = True`. 2. Auth error: - Verify `API_KEY/API_SECRET` and header signature path. 3. Media send failed: - Follow the [media-send troubleshooting checklist](https://docs.debox.pro/en/APIQA#media-send-troubleshooting). --- ## DeBox Bot Go SDK Webhook Guide Source repository: - [debox-pro/debox-chat-go-sdk](https://github.com/debox-pro/debox-chat-go-sdk) This document covers DeBox bot Webhook integration for Go services. It is intended for backend developers who need a production-grade callback receiver, payload parser, and reply flow. ## 1. Webhook vs Long Polling (strictly mutually exclusive) This guide implements Webhook mode. While a Webhook URL is configured in BotMother, Webhook is the only effective receiving path and Long Polling cannot receive messages. To return to Long Polling, clear the Webhook settings first. For the complete mode-selection flow, see [DeBox Bot Development Overview](https://docs.debox.pro/en/APIs/BotGuide). For Long Polling implementation, see [DeBox Bot Go SDK](https://docs.debox.pro/en/GO-SDK). ## 2. When to use Webhook Use Webhook when: - Your service is publicly reachable over HTTP/HTTPS. - You need lower latency than polling. - You want a push-based event flow. - You need server-side handling for media messages or group join events. ## 3. BotMother Webhook configuration In the BotMother Webhook settings, configure `Webhook URL` and `Webhook Key`. Example `Webhook URL`: - `https://your-domain.com/bot/webhook` Also ensure: - `Webhook URL` is stable, publicly reachable, and uses HTTPS. - Your backend validates that `X-API-KEY` on each callback matches the configured `Webhook Key`. - If you change `Webhook Key`, update the value used by your backend validator at the same time. ## 4. Delivery contract ### 4.1 HTTP request DeBox sends: - Method: `POST` - Content-Type: `application/json` - Header: `X-API-KEY: ` Recommendations: - Reject requests with missing or invalid `X-API-KEY`. - Return `200 OK` only after your application has accepted the event. - Implement idempotency using your own event deduplication strategy if needed. ### 4.2 Top-level payload fields Ordinary messages and group join events use the flattened payload below. Button clicks use a separate nested structure; see [button events](#button-events). | Field | Type | Required | Description | | --- | --- | --- | --- | | `from_user_id` | `string` | Yes | The event sender's DeBox `user_id` value. It is the same as the sender's `uid` and `invite_code`. In private chat, this is the other user. In group chat, this is the speaking user. For current join-group events, this is the joined member. | | `to_user_id` | `string` | Yes | The target bot account's DeBox `user_id` value; the same value as that account's `uid` and `invite_code`. | | `name` | `string` | No | Display name of `from_user_id`. | | `pic` | `string` | No | Avatar URL of `from_user_id`. | | `address` | `string` | No | Wallet address of `from_user_id`. | | `language` | `string` | No | User language, if available. | | `group_id` | `string` | No | DeBox group ID or chatroom ID. Empty for private chat. | | `parse_mode` | `string` | Yes | Type of the current payload, such as `text`, `image`, `video`, `file`, `link`, `event:joinGroup`. | | `message` | `string` | Yes | Normalized message body. Meaning depends on `parse_mode`. | | `message_raw` | `string` | Yes | Original content after DeBox parsing. Meaning depends on `parse_mode`. | | `mention_users` | `array` | No | Mentioned users in group text messages. Present when the source message contains mentions. | `mention_users` item structure: | Field | Type | Description | | --- | --- | --- | | `user_id` | `string` | The mentioned user's DeBox `user_id` value; the same value as that user's `uid` and `invite_code` | | `name` | `string` | Display name | | `pic` | `string` | Avatar URL | | `address` | `string` | Wallet address | ### 4.3 `parse_mode` values | `parse_mode` | Meaning | `message` / `message_raw` | | --- | --- | --- | | `text` | Plain text or command-like text | Message text. Mentions are removed from `message` and preserved in `message_raw`. | | `image` | Image message | Image URL | | `video` | Video message | Video URL | | `file` | File message | File URL | | `link` | Shared link / dapp share | Shared link URL | | `event:joinGroup` | Group join event | Current joined member's `user_id` value | Important behavior notes: - For `image`, `video`, and `file`, the bot receives a URL string, not the binary file body. - For `text`, `message` is normalized text, while `message_raw` preserves the original text. - For `event:joinGroup`, current payload semantics are event-oriented rather than conversational: - `group_id` is the target group. - `from_user_id` is the joined member exposed by the current callback implementation. - `message` contains the same identifier value as the joined member's `user_id`. ### 4.4 Button click events Button events use a top-level `callback_query`, unlike ordinary flattened messages. Non-empty `response_data` takes precedence over legacy `callback_data` and is exposed as `callback_query.data`. If both are empty, the payload contains a top-level `message` object instead of `callback_query`. - Both `callback_query.from` and `callback_query.message.from` identify the clicking user. - `callback_query.message` preserves the original message ID, text, and `parse_mode`. - Group chats use `{"id":"group gid","type":"group"}`; private chats use `{"id":"clicking user code","type":"private"}`. - Webhook sends the object below directly, without a polling record `id`, `ok`, or `result` envelope. Polling exposes the same event contents. - Delivery has a 5-second timeout, does not follow redirects, and only accepts 2xx responses. Timeouts, connection failures, and non-2xx responses discard the event with a log entry: there is no retry or polling fallback. The App still receives success, which does not confirm that the bot received the event. ```json { "callback_query": { "from": { "user_id": "uvg2p6ho", "name": "Alice", "pic": "", "address": "", "signature": "" }, "message": { "message_id": "01HXYZABCDEF1234567890", "from": { "user_id": "uvg2p6ho", "name": "Alice", "pic": "", "address": "", "signature": "" }, "chat": { "id": "cc0onr82", "type": "group" }, "text": "Choose an action", "parse_mode": "HTML" }, "data": "detail" } } ``` Receivers must check top-level `callback_query` or an object-valued `message` before routing ordinary messages by `parse_mode`. The flattened structs and example in section 6 only handle ordinary messages and join events; add this branch when receiving button events. ## 5. Payload examples by message type ### 5.1 Text message ```json { "from_user_id": "u_alice", "to_user_id": "u_bot", "name": "Alice", "pic": "https://cdn.example.com/alice.png", "address": "0x1234", "language": "en", "group_id": "cc0onr82", "parse_mode": "text", "message": "hello bot", "message_raw": "@MyBot hello bot", "mention_users": [ { "user_id": "u_bot", "name": "MyBot", "pic": "https://cdn.example.com/bot.png", "address": "" } ] } ``` ### 5.2 Image message ```json { "from_user_id": "u_alice", "to_user_id": "u_bot", "name": "Alice", "language": "en", "group_id": "cc0onr82", "parse_mode": "image", "message": "https://cdn.example.com/image.png", "message_raw": "https://cdn.example.com/image.png" } ``` ### 5.3 Video message ```json { "from_user_id": "u_alice", "to_user_id": "u_bot", "name": "Alice", "language": "en", "group_id": "cc0onr82", "parse_mode": "video", "message": "https://cdn.example.com/video.mp4", "message_raw": "https://cdn.example.com/video.mp4" } ``` ### 5.4 File message ```json { "from_user_id": "u_alice", "to_user_id": "u_bot", "name": "Alice", "language": "en", "group_id": "cc0onr82", "parse_mode": "file", "message": "https://cdn.example.com/report.pdf", "message_raw": "https://cdn.example.com/report.pdf" } ``` ### 5.5 Group join event ```json { "from_user_id": "u_new_member", "to_user_id": "u_bot", "name": "New Member", "pic": "https://cdn.example.com/new-member.png", "address": "0xabcd", "language": "en", "group_id": "cc0onr82", "parse_mode": "event:joinGroup", "message": "u_new_member", "message_raw": "u_new_member" } ``` Use this event when your bot needs to: - Send onboarding messages to new members. - Trigger group welcome workflows. - Record membership events in your own backend. ## 6. Go receiver design Recommended server flow: 1. Verify `X-API-KEY`. 2. Parse JSON into a typed struct. 3. Route logic by `parse_mode`. 4. Infer chat context from `group_id`. 5. Use Go SDK to send reply messages. ### 6.1 Suggested payload structs ```go type WebhookUser struct { UserID string `json:"user_id"` Name string `json:"name"` Pic string `json:"pic"` Address string `json:"address"` } type WebhookPayload struct { FromUserID string `json:"from_user_id"` ToUserID string `json:"to_user_id"` Name string `json:"name"` Pic string `json:"pic"` Address string `json:"address"` Language string `json:"language"` GroupID string `json:"group_id"` ParseMode string `json:"parse_mode"` Message string `json:"message"` MessageRaw string `json:"message_raw"` MentionUsers []WebhookUser `json:"mention_users"` } ``` ### 6.2 Full sample (Gin + Go SDK) ```go package main import ( "fmt" "net/http" "os" "github.com/gin-gonic/gin" boxbotapi "github.com/debox-pro/debox-chat-go-sdk/boxbotapi" ) type WebhookUser struct { UserID string `json:"user_id"` Name string `json:"name"` Pic string `json:"pic"` Address string `json:"address"` } type WebhookPayload struct { FromUserID string `json:"from_user_id"` ToUserID string `json:"to_user_id"` Name string `json:"name"` Pic string `json:"pic"` Address string `json:"address"` Language string `json:"language"` GroupID string `json:"group_id"` ParseMode string `json:"parse_mode"` Message string `json:"message"` MessageRaw string `json:"message_raw"` MentionUsers []WebhookUser `json:"mention_users"` } func main() { webhookKey := os.Getenv("DEBOX_WEBHOOK_KEY") apiKey := os.Getenv("DEBOX_BOT_API_KEY") apiSecret := os.Getenv("DEBOX_BOT_API_SECRET") if webhookKey == "" || apiKey == "" || apiSecret == "" { panic("missing required env: DEBOX_WEBHOOK_KEY / DEBOX_BOT_API_KEY / DEBOX_BOT_API_SECRET") } bot, err := boxbotapi.NewBotAPI(apiKey, apiSecret) if err != nil { panic(err) } r := gin.Default() r.POST("/bot/webhook", func(c *gin.Context) { if c.GetHeader("X-API-KEY") != webhookKey { c.JSON(http.StatusUnauthorized, gin.H{"error": "invalid webhook key"}) return } var payload WebhookPayload if err := c.ShouldBindJSON(&payload); err != nil { c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) return } chatType := "private" chatID := payload.FromUserID if payload.GroupID != "" { chatType = "group" chatID = payload.GroupID } switch payload.ParseMode { case "text": reply := boxbotapi.NewMessage(chatID, chatType, "Received: "+payload.Message) reply.ParseMode = boxbotapi.ModeText _, err = bot.Send(reply) case "image": reply := boxbotapi.NewMessage(chatID, chatType, "Image received: "+payload.Message) reply.ParseMode = boxbotapi.ModeText _, err = bot.Send(reply) case "video": reply := boxbotapi.NewMessage(chatID, chatType, "Video received: "+payload.Message) reply.ParseMode = boxbotapi.ModeText _, err = bot.Send(reply) case "file": reply := boxbotapi.NewMessage(chatID, chatType, "File received: "+payload.Message) reply.ParseMode = boxbotapi.ModeText _, err = bot.Send(reply) case "event:joinGroup": welcome := fmt.Sprintf("Welcome %s to the group.", payload.FromUserID) reply := boxbotapi.NewMessage(chatID, chatType, welcome) reply.ParseMode = boxbotapi.ModeText _, err = bot.Send(reply) default: reply := boxbotapi.NewMessage(chatID, chatType, "Unsupported payload type: "+payload.ParseMode) reply.ParseMode = boxbotapi.ModeText _, err = bot.Send(reply) } if err != nil { c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) return } c.JSON(http.StatusOK, gin.H{"ok": true}) }) _ = r.Run(":8080") } ``` ## 7. Sending media replies with Go SDK The complete outbound message contract is in the [OpenAPI message fields](https://docs.debox.pro/en/ApiOnePage#message-fields). The following example only shows how to send media with the Go SDK. ```go image := boxbotapi.NewMessage("cc0onr82", "group", "https://cdn.example.com/welcome.png") image.ParseMode = boxbotapi.ModeImage _, _ = bot.Send(image) video := boxbotapi.NewMessage("cc0onr82", "group", "https://cdn.example.com/intro.mp4") video.ParseMode = boxbotapi.ModeVideo _, _ = bot.Send(video) file := boxbotapi.NewMessage("cc0onr82", "group", "https://cdn.example.com/guide.pdf") file.ParseMode = boxbotapi.ModeFile _, _ = bot.Send(file) ``` ## 8. Production recommendations - Put webhook authentication and JSON parsing in middleware or a shared adapter. - Log `parse_mode`, `from_user_id`, `to_user_id`, and `group_id` for traceability. - Do not trust media URLs indefinitely; download or process them according to your retention policy. - For group bots, branch business logic by `group_id` instead of assuming one bot serves one group only. - Keep reply generation asynchronous if your downstream processing is slow. ## 9. Common pitfalls - Webhook configured but no updates received: - Check endpoint reachability, TLS, server logs, and `X-API-KEY` verification. - Webhook and Long Polling both enabled: - Only one receive mode is valid. With Webhook enabled, polling is not a valid receive path. - Treating media payloads as binary uploads: - Webhook delivers media URLs, not file streams. - Ignoring `parse_mode`: - Always branch on `parse_mode`, not only on the existence of `message`. - Local development without a public domain: - Use a tunnel to expose your local endpoint temporarily. ## 10. Related docs - Long Polling guide: [DeBox Bot Go SDK](https://docs.debox.pro/en/GO-SDK) --- ## DeBox Bot Blockchain Buttons (button3) DeBox supports two ways to start wallet signing and on-chain transactions: an IM blockchain button inside a chat, or a custom H5/DApp page. This page explains how to choose between them, defines the responsibility boundary of an IM blockchain button, and preserves the source-aligned `button3` parameters and complete `main.go` example. **Tip: Official button3 demo** Open the [button3 Bot profile](https://m.debox.pro/card?id=ligvfcem) in the DeBox App to try the IM blockchain-button flow. ### Start the demo 1. Open the button3 Bot profile in the DeBox App and enter the chat. 2. Tap the command button to the left of the input field, or enter `/` in the input field, to open the command list. 3. Select `/start` from the command list. 4. The Bot sends the available demo buttons. Select the signing or transaction action you want to try. ![Command button to the left of the input field in the button3 Bot chat](https://docs.debox.pro/imgBlockchain/button3-command-entry.png) **Step 1.** Tap the command button. Entering `/` in the input field opens the same list. ![Start command in the button3 Bot command list](https://docs.debox.pro/imgBlockchain/button3-start-command.png) **Step 2.** Select `/start` to display the demo buttons. ## 1. Choose an on-chain interaction method | Method | Best for | Development model | | --- | --- | --- | | IM blockchain button | A single signing, authorization, payment, or contract action directly in chat | DeBox provides the supported button and native wallet-confirmation flow; the developer supplies the request parameters. | | H5 / DApp | Forms, quotes, risk notices, calculations, multi-step actions, and order-management interfaces | The developer builds the page and business logic, then uses standard Web3.js with the injected wallet provider. | Use an IM blockchain button when one click can be represented by a supported wallet request. Use an [H5/DApp](https://docs.debox.pro/en/MiniApp) when the user needs to review or enter more information before signing or paying. ### 1.1 Two ways to open DeBox Swap DeBox supports two ways to open the native Swap flow: 1. **IM blockchain button:** use the general `debox://wallet/request` route with a JSON-RPC wallet request. In addition to signing, transfers, and contract calls, a request with `method: "swap"` can open the native DeBox Swap. 2. **Swap modal Deep Link:** use the dedicated `debox://rn/trade/swap/modal` route with URL query parameters to prefill the chain, token to sell, token to buy, and amount. The link can be sent as a Bot URL button or rich-text link and supports `refGid` for group-channel revenue-sharing attribution. | Method | Request format | Best for | | --- | --- | --- | | `wallet/request` + `method: "swap"` | JSON-RPC request | IM blockchain buttons and Swap requests built in the wallet-request format | | `trade/swap/modal` | URL query parameters | URL buttons, rich-text links, prefilled Swap, and revenue-sharing channel attribution | Both methods open DeBox Swap, but their request formats and use cases differ. `refGid` is the group-channel attribution parameter for the Swap modal Deep Link. Do not add it directly to the `wallet/request` JSON-RPC request unless the platform explicitly supports that format. See [DeBox App Deep Links](https://docs.debox.pro/en/DeepLinks#2-swap-modal-deep-link) for the complete Swap modal link and parameter reference. ## 2. How an IM blockchain button works The button uses the supported `debox://wallet/request` route and carries a JSON-RPC wallet request in its callback data. | Responsibility | What it includes | | --- | --- | | DeBox client | Render the supported button format, handle the click, open the native DeBox wallet confirmation, and ask the wallet to sign or broadcast after the user approves. | | Bot / developer | Choose the button text and supported presentation options; build and validate the JSON-RPC method, chain ID, addresses, `value`, and ABI-encoded `data`; resolve any placeholders before sending the button. | The runtime flow is: ```text Bot sends an IM blockchain button → User selects the button → DeBox opens the native wallet confirmation → User approves or rejects the request → The wallet signs the message or broadcasts the transaction ``` A simplified transaction request looks like this: ```json { "jsonrpc": "2.0", "id": 104, "method": "eth_sendTransaction", "params": [ { "chainId": "0x38", "from": "0xUSER_ADDRESS", "to": "0xTARGET_OR_CONTRACT_ADDRESS", "data": "0xABI_ENCODED_CALLDATA", "value": "0x0" } ] } ``` For a native-token payment, put the amount in `value`. For a token transfer or contract call, encode the method and amount in `data` and normally keep `value` at `0x0`. In the bundled `button3` sample, `selfAddress` is a temporary placeholder. The Bot code replaces it with `user.Address` through `escapeAllStr` before sending the button. Do not rely on the DeBox client to perform that sample-specific replacement. ## 3. button3 parameters (source-aligned) These payload strings are defined in `main.go` and bound to button `CallbackData` on `/start`: - `eth_getBalanceStr` - `personal_signStr` - `eth_signTypedData_v4Str` - `eth_sendTransactionStrNative` - `eth_sendTransactionStrToken` - `eth_sendTransactionApproveStr` - `sendTransactionStrTransferFrom` - `sendTransactionStrMint` - `sendTransactionStrSwap` - `sendTransactionStrDeploy` Replacement rules (exact source behavior): - `selfAddress` -> current user wallet address - `botAddress` -> bot wallet address (some calldata uses `botAddress[2:]`) - removes spaces/newlines/tabs via `escapeAllStr` ## 4. main.go (verbatim) ```go package main import ( "context" "log" "strings" "github.com/debox-pro/debox-chat-go-sdk/boxbotapi" ) var ( // Button texts homeInfoContent = "home content" eth_getBalance = "查账户余额" // eth_gasPrice = "查gas费" personal_sign = "personal_sign" eth_signTypedData_v4 = "eth_signTypedData_v4" eth_sendTransaction_native = "原生币转账" eth_sendTransaction_token_approve = "Approve授权支付" eth_sendTransaction_token_TransferFrom = "第三方授权转账TransferFrom" eth_sendTransaction_Mint = "Mint" eth_sendTransaction_token = "合约币转账" eth_sendTransaction_swap = "swap" eth_sendTransaction_deploy = "合约部署" walletRequest = "debox://wallet/request" bot *boxbotapi.BotAPI // Keyboard layout for the second menu. Two buttons, one per row homeMenuMarkup = boxbotapi.NewInlineKeyboardMarkup( boxbotapi.NewInlineKeyboardRow( boxbotapi.NewInlineKeyboardButtonDataWithColor("", eth_getBalance, walletRequest, eth_getBalance, "#21C161"), ), // boxbotapi.NewInlineKeyboardRow( // boxbotapi.NewInlineKeyboardButtonDataWithColor("", eth_gasPrice, walletRequest, eth_gasPrice, "#21C161"), // ), boxbotapi.NewInlineKeyboardRow( boxbotapi.NewInlineKeyboardButtonDataWithColor("", personal_sign, walletRequest, personal_sign, "#21C161"), ), boxbotapi.NewInlineKeyboardRow( boxbotapi.NewInlineKeyboardButtonDataWithColor("", eth_signTypedData_v4, walletRequest, eth_signTypedData_v4, "#21C161"), ), boxbotapi.NewInlineKeyboardRow( boxbotapi.NewInlineKeyboardButtonDataWithColor("", eth_sendTransaction_native, walletRequest, eth_sendTransaction_native, "#21C161"), ), boxbotapi.NewInlineKeyboardRow( boxbotapi.NewInlineKeyboardButtonDataWithColor("", eth_sendTransaction_token, walletRequest, eth_sendTransaction_token, "#21C161"), ), boxbotapi.NewInlineKeyboardRow( boxbotapi.NewInlineKeyboardButtonDataWithColor("", eth_sendTransaction_swap, walletRequest, eth_sendTransaction_swap, "#21C161"), ), boxbotapi.NewInlineKeyboardRow( boxbotapi.NewInlineKeyboardButtonDataWithColor("", eth_sendTransaction_token_approve, walletRequest, eth_sendTransaction_token_approve, "#21C161"), ), boxbotapi.NewInlineKeyboardRow( boxbotapi.NewInlineKeyboardButtonDataWithColor("", eth_sendTransaction_token_TransferFrom, walletRequest, eth_sendTransaction_token_TransferFrom, "#21C161"), ), boxbotapi.NewInlineKeyboardRow( boxbotapi.NewInlineKeyboardButtonDataWithColor("", eth_sendTransaction_Mint, walletRequest, eth_sendTransaction_Mint, "#21C161"), ), // boxbotapi.NewInlineKeyboardRow( // boxbotapi.NewInlineKeyboardButtonDataWithColor("", eth_sendTransaction_token, walletRequest, eth_sendTransaction_token, "#21C161"), // ), // boxbotapi.NewInlineKeyboardRow( // boxbotapi.NewInlineKeyboardButtonDataWithColor("", eth_sendTransaction_swap, walletRequest, eth_sendTransaction_swap, "#21C161"), // ), boxbotapi.NewInlineKeyboardRow( boxbotapi.NewInlineKeyboardButtonDataWithColor("", eth_sendTransaction_deploy, walletRequest, eth_sendTransaction_deploy, "#21C161"), ), ) ) func main() { var err error boxbotapi.MessageListener = true boxbotapi.Debug = true bot, err = boxbotapi.NewBotAPI("", "") if err != nil { // Abort if something is wrong log.Panic(err) } // Set this to true to log all interactions with debox servers u := boxbotapi.NewUpdate(0) u.Timeout = 30 // Create a new cancellable background context. Calling `cancel()` leads to the cancellation of the context ctx := context.Background() // ctx, cancel := context.WithCancel(ctx) // `updates` is a golang channel which receives debox updates updates := bot.GetUpdatesChan(u) // Pass cancellable context to goroutine go receiveUpdates(ctx, updates) // Tell the user the bot is online log.Println("Start listening for updates. Press enter to stop") //new stop select {} } func receiveUpdates(ctx context.Context, updates boxbotapi.UpdatesChannel) { // `for {` means the loop is infinite until we manually stop it for { select { // stop looping if ctx is cancelled case <-ctx.Done(): return // receive update from channel and then handle it case update := <-updates: handleUpdate(update) } } } func handleUpdate(update boxbotapi.Update) { switch { // Handle messages case update.Message != nil: handleMessage(update.Message) break // Handle button clicks case update.CallbackQuery != nil: handleButton(update.CallbackQuery) break } } func handleMessage(message *boxbotapi.Message) { user := message.From text := message.Text botAddress := bot.Self.Address if user == nil { return } // Print to console log.Printf("%s wrote %s", user.Name, text) var err error if len(text) > 0 { msg := boxbotapi.NewMessage(message.Chat.ID, message.Chat.Type, message.Text) msg.ParseMode = boxbotapi.ModeHTML if text == "/start" { msg.Text = homeInfoContent msg.ReplyMarkup = homeMenuMarkup var eth_getBalanceStr = `{ "jsonrpc": "2.0", "id": 101, "method": "eth_getBalance", "params": [ { "chainId": "0x38" }, "selfAddress", "latest" ] }` //hexString := hex.EncodeToString(byteData) var personal_signStr = `{ "jsonrpc": "2.0", "id": 102, "method": "personal_sign", "params": [ { "chainId": "0x38" }, "0x506c65617365207369676e2074686973206d65737361676520746f20636f6e6669726d20796f7572206964656e746974792e", "selfAddress" ] }` //typedata_v4 // 使用 any 类型代替 interface{} var eth_signTypedData_v4Str = `{ "jsonrpc": "2.0", "id": 103, "method": "eth_signTypedData_v4", "params": [ "selfAddress", { "types": { "EIP712Domain": [ { "name": "name", "type": "string" }, { "name": "version", "type": "string" }, { "name": "chainId", "type": "uint256" }, { "name": "verifyingContract", "type": "address" } ], "Person": [ { "name": "name", "type": "string" }, { "name": "wallet", "type": "address" } ], "Mail": [ { "name": "from", "type": "Person" }, { "name": "to", "type": "Person" }, { "name": "contents", "type": "string" } ] }, "primaryType": "Mail", "domain": { "name": "Ether Mail", "version": "1", "chainId": 1, "verifyingContract": "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC" }, "message": { "from": { "name": "Cow", "wallet": "selfAddress" }, "to": { "name": "Bob", "wallet": "0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB" }, "contents": "Hello, Bob!" } } ] }` var eth_sendTransactionStrNative = `{ "jsonrpc": "2.0", "id": 104, "method": "eth_sendTransaction", "params": [ { "chainId": "0x38", "to": "botAddress", "from": "selfAddress", "gas": "0x76c0", "value": "0x38D7EA4C68000", "data": "0x", "gasPrice": "0x4a817c800" } ] }` var eth_sendTransactionStrToken = `{ "jsonrpc": "2.0", "id": 105, "method": "eth_sendTransaction", "params": [ { "chainId": "0x38", "from": "selfAddress", "to": "0x6386Adc4BC9c21984E34fD916BB349dD861742af", "value": "0x0", "data": "0xa9059cbb000000000000000000000000botAddress0000000000000000000000000000000000000000000000000de0b6b3a7640000", "gas": "0x76c0", "gasPrice": "0x4a817c800" } ] }` var eth_sendTransactionApproveStr = `{ "jsonrpc": "2.0", "id": 106, "method": "eth_sendTransaction", "params": [ { "chainId": "0x38", "from": "selfAddress", "to": "0x6386Adc4BC9c21984E34fD916BB349dD861742af", "gas": "0xb89b", "gasPrice": "0x5d27a277", "value": "0x0", "data": "0x095ea7b3000000000000000000000000botAddress0000000000000000000000000000000000000000000000000de0b6b3a7640000" } ] }` var sendTransactionStrTransferFrom = `{ "jsonrpc": "2.0", "id": 106, "method": "eth_sendTransaction", "params": [ { "from": "selfAddress", "chainId":"0x38", "data": "0x23b872dd000000000000000000000000cba3fce9d49ce5d7870443f324a8dd56a5788bfc0000000000000000000000006c663ff4b23ba3452e5ad1ad0c567e54b5ceee2e0000000000000000000000000000000000000000000000000de0b6b3a7640000", "gas": "0xad12", "gasPrice": "0x596c5e37", "to": "0x6386Adc4BC9c21984E34fD916BB349dD861742af", "value": "0x0" } ] }` var sendTransactionStrMint = `{ "jsonrpc": "2.0", "id": 106, "method": "eth_sendTransaction", "params": [ { "chainId":"0xa", "from": "selfAddress", "data": "0x3b4b1381000000000000000000000000000000000000000000000000000000000000000a", "gas": "0x5135c", "gasPrice": "0x18df9", "to": "0x98c56f0903d1cb0c7eaedb91fb9d58409bbb1fbe", "value": "0x0" } ] }` var sendTransactionStrSwap = `{ "jsonrpc": "2.0", "id": 106, "method": "swap", "params": [ { "fromAddress": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", "toAddress": "0x6386Adc4BC9c21984E34fD916BB349dD861742af", "fromChainId": "0x38", "toChainId": "0x38" } ] }` var sendTransactionStrDeploy = `{ "id": 4218609415, "jsonrpc": "2.0", "method": "eth_sendTransaction", "params": [ { "chainId":"0x38", "from": "selfAddress", "data":"0x60806040523480156200001157600080fd5b506040518060400160405280600c81526020017f54657374446170704e46547300000000000000000000000000000000000000008152506040518060400160405280600381526020017f54444e000000000000000000000000000000000000000000000000000000000081525081600090816200008f919062000324565b508060019081620000a1919062000324565b5050506200040b565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806200012c57607f821691505b602082108103620001425762000141620000e4565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b600060088302620001ac7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826200016d565b620001b886836200016d565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b600062000205620001ff620001f984620001d0565b620001da565b620001d0565b9050919050565b6000819050919050565b6200022183620001e4565b6200023962000230826200020c565b8484546200017a565b825550505050565b600090565b6200025062000241565b6200025d81848462000216565b505050565b5b8181101562000285576200027960008262000246565b60018101905062000263565b5050565b601f821115620002d4576200029e8162000148565b620002a9846200015d565b81016020851015620002b9578190505b620002d1620002c8856200015d565b83018262000262565b50505b505050565b600082821c905092915050565b6000620002f960001984600802620002d9565b1980831691505092915050565b6000620003148383620002e6565b9150826002028217905092915050565b6200032f82620000aa565b67ffffffffffffffff8111156200034b576200034a620000b5565b5b62000357825462000113565b6200036482828562000289565b600060209050601f8311600181146200039c576000841562000387578287015190505b62000393858262000306565b86555062000403565b601f198416620003ac8662000148565b60005b82811015620003d657848901518255600182019150602085019450602081019050620003af565b86831015620003f65784890151620003f2601f891682620002e6565b8355505b6001600288020188555050505b505050505050565b612be6806200041b6000396000f3fe608060405234801561001057600080fd5b50600436106100f45760003560e01c806342842e0e11610097578063a22cb46511610066578063a22cb46514610283578063b88d4fde1461029f578063c87b56dd146102bb578063e985e9c5146102eb576100f4565b806342842e0e146101e95780636352211e1461020557806370a082311461023557806395d89b4114610265576100f4565b8063081812fc116100d3578063081812fc14610165578063095ea7b31461019557806323b872dd146101b15780633b4b1381146101cd576100f4565b80629a9b7b146100f957806301ffc9a71461011757806306fdde0314610147575b600080fd5b61010161031b565b60405161010e91906119ac565b60405180910390f35b610131600480360381019061012c9190611a33565b61032c565b60405161013e9190611a7b565b60405180910390f35b61014f61040e565b60405161015c9190611b26565b60405180910390f35b61017f600480360381019061017a9190611b74565b6104a0565b60405161018c9190611be2565b60405180910390f35b6101af60048036038101906101aa9190611c29565b6104e6565b005b6101cb60048036038101906101c69190611c69565b6105fd565b005b6101e760048036038101906101e29190611b74565b61065d565b005b61020360048036038101906101fe9190611c69565b6106ac565b005b61021f600480360381019061021a9190611b74565b6106cc565b60405161022c9190611be2565b60405180910390f35b61024f600480360381019061024a9190611cbc565b610752565b60405161025c91906119ac565b60405180910390f35b61026d610809565b60405161027a9190611b26565b60405180910390f35b61029d60048036038101906102989190611d15565b61089b565b005b6102b960048036038101906102b49190611e8a565b6108b1565b005b6102d560048036038101906102d09190611b74565b610913565b6040516102e29190611b26565b60405180910390f35b61030560048036038101906103009190611f0d565b6109ac565b6040516103129190611a7b565b60405180910390f35b60006103276006610a40565b905090565b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806103f757507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80610407575061040682610a4e565b5b9050919050565b60606000805461041d90611f7c565b80601f016020809104026020016040519081016040528092919081815260200182805461044990611f7c565b80156104965780601f1061046b57610100808354040283529160200191610496565b820191906000526020600020905b81548152906001019060200180831161047957829003601f168201915b5050505050905090565b60006104ab82610ab8565b6004600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b60006104f1826106cc565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610561576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105589061201f565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16610580610b03565b73ffffffffffffffffffffffffffffffffffffffff1614806105af57506105ae816105a9610b03565b6109ac565b5b6105ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105e5906120b1565b60405180910390fd5b6105f88383610b0b565b505050565b61060e610608610b03565b82610bc4565b61064d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161064490612143565b60405180910390fd5b610658838383610c59565b505050565b6000600190505b8181116106a8576106756006610f52565b60006106816006610a40565b905061069461068e610b03565b82610f68565b5080806106a090612192565b915050610664565b5050565b6106c7838383604051806020016040528060008152506108b1565b505050565b6000806106d883610f86565b9050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610749576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161074090612226565b60405180910390fd5b80915050919050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036107c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107b9906122b8565b60405180910390fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60606001805461081890611f7c565b80601f016020809104026020016040519081016040528092919081815260200182805461084490611f7c565b80156108915780601f1061086657610100808354040283529160200191610891565b820191906000526020600020905b81548152906001019060200180831161087457829003601f168201915b5050505050905090565b6108ad6108a6610b03565b8383610fc3565b5050565b6108c26108bc610b03565b83610bc4565b610901576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108f890612143565b60405180910390fd5b61090d8484848461112f565b50505050565b6060600060405180610160016040528061013c8152602001612a7561013c9139905060006109408461118b565b61094983611259565b6109528661118b565b604051602001610964939291906124b6565b6040516020818303038152906040529050600061098082611259565b604051602001610990919061255f565b6040516020818303038152906040529050809350505050919050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b600081600001549050919050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b610ac1816113d1565b610b00576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610af790612226565b60405180910390fd5b50565b600033905090565b816004600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16610b7e836106cc565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600080610bd0836106cc565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480610c125750610c1181856109ac565b5b80610c5057508373ffffffffffffffffffffffffffffffffffffffff16610c38846104a0565b73ffffffffffffffffffffffffffffffffffffffff16145b91505092915050565b8273ffffffffffffffffffffffffffffffffffffffff16610c79826106cc565b73ffffffffffffffffffffffffffffffffffffffff1614610ccf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cc6906125f3565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610d3e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d3590612685565b60405180910390fd5b610d4b8383836001611412565b8273ffffffffffffffffffffffffffffffffffffffff16610d6b826106cc565b73ffffffffffffffffffffffffffffffffffffffff1614610dc1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610db8906125f3565b60405180910390fd5b6004600082815260200190815260200160002060006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556001600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055506001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4610f4d8383836001611418565b505050565b6001816000016000828254019250508190555050565b610f8282826040518060200160405280600081525061141e565b5050565b60006002600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611031576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611028906126f1565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516111229190611a7b565b60405180910390a3505050565b61113a848484610c59565b61114684848484611479565b611185576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161117c90612783565b60405180910390fd5b50505050565b60606000600161119a84611600565b01905060008167ffffffffffffffff8111156111b9576111b8611d5f565b5b6040519080825280601f01601f1916602001820160405280156111eb5781602001600182028036833780820191505090505b509050600082602001820190505b60011561124e578080600190039150507f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a8581611242576112416127a3565b5b049450600085036111f9575b819350505050919050565b6060600082510361127b576040518060200160405280600081525090506113cc565b6000604051806060016040528060408152602001612a3560409139905060006003600285516112aa91906127d2565b6112b49190612806565b60046112c09190612837565b905060006020826112d191906127d2565b67ffffffffffffffff8111156112ea576112e9611d5f565b5b6040519080825280601f01601f19166020018201604052801561131c5781602001600182028036833780820191505090505b509050818152600183018586518101602084015b8183101561138b576003830192508251603f8160121c168501518253600182019150603f81600c1c168501518253600182019150603f8160061c168501518253600182019150603f8116850151825360018201915050611330565b6003895106600181146113a557600281146113b5576113c0565b613d3d60f01b60028303526113c0565b603d60f81b60018303525b50505050508093505050505b919050565b60008073ffffffffffffffffffffffffffffffffffffffff166113f383610f86565b73ffffffffffffffffffffffffffffffffffffffff1614159050919050565b50505050565b50505050565b6114288383611753565b6114356000848484611479565b611474576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161146b90612783565b60405180910390fd5b505050565b600061149a8473ffffffffffffffffffffffffffffffffffffffff16611970565b156115f3578373ffffffffffffffffffffffffffffffffffffffff1663150b7a026114c3610b03565b8786866040518563ffffffff1660e01b81526004016114e594939291906128ce565b6020604051808303816000875af192505050801561152157506040513d601f19601f8201168201806040525081019061151e919061292f565b60015b6115a3573d8060008114611551576040519150601f19603f3d011682016040523d82523d6000602084013e611556565b606091505b50600081510361159b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161159290612783565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149150506115f8565b600190505b949350505050565b600080600090507a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000831061165e577a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008381611654576116536127a3565b5b0492506040810190505b6d04ee2d6d415b85acef8100000000831061169b576d04ee2d6d415b85acef81000000008381611691576116906127a3565b5b0492506020810190505b662386f26fc1000083106116ca57662386f26fc1000083816116c0576116bf6127a3565b5b0492506010810190505b6305f5e10083106116f3576305f5e10083816116e9576116e86127a3565b5b0492506008810190505b612710831061171857612710838161170e5761170d6127a3565b5b0492506004810190505b6064831061173b5760648381611731576117306127a3565b5b0492506002810190505b600a831061174a576001810190505b80915050919050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036117c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117b9906129a8565b60405180910390fd5b6117cb816113d1565b1561180b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161180290612a14565b60405180910390fd5b611819600083836001611412565b611822816113d1565b15611862576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161185990612a14565b60405180910390fd5b6001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a461196c600083836001611418565b5050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b6000819050919050565b6119a681611993565b82525050565b60006020820190506119c1600083018461199d565b92915050565b6000604051905090565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b611a10816119db565b8114611a1b57600080fd5b50565b600081359050611a2d81611a07565b92915050565b600060208284031215611a4957611a486119d1565b5b6000611a5784828501611a1e565b91505092915050565b60008115159050919050565b611a7581611a60565b82525050565b6000602082019050611a906000830184611a6c565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015611ad0578082015181840152602081019050611ab5565b60008484015250505050565b6000601f19601f8301169050919050565b6000611af882611a96565b611b028185611aa1565b9350611b12818560208601611ab2565b611b1b81611adc565b840191505092915050565b60006020820190508181036000830152611b408184611aed565b905092915050565b611b5181611993565b8114611b5c57600080fd5b50565b600081359050611b6e81611b48565b92915050565b600060208284031215611b8a57611b896119d1565b5b6000611b9884828501611b5f565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611bcc82611ba1565b9050919050565b611bdc81611bc1565b82525050565b6000602082019050611bf76000830184611bd3565b92915050565b611c0681611bc1565b8114611c1157600080fd5b50565b600081359050611c2381611bfd565b92915050565b60008060408385031215611c4057611c3f6119d1565b5b6000611c4e85828601611c14565b9250506020611c5f85828601611b5f565b9150509250929050565b600080600060608486031215611c8257611c816119d1565b5b6000611c9086828701611c14565b9350506020611ca186828701611c14565b9250506040611cb286828701611b5f565b9150509250925092565b600060208284031215611cd257611cd16119d1565b5b6000611ce084828501611c14565b91505092915050565b611cf281611a60565b8114611cfd57600080fd5b50565b600081359050611d0f81611ce9565b92915050565b60008060408385031215611d2c57611d2b6119d1565b5b6000611d3a85828601611c14565b9250506020611d4b85828601611d00565b9150509250929050565b600080fd5b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b611d9782611adc565b810181811067ffffffffffffffff82111715611db657611db5611d5f565b5b80604052505050565b6000611dc96119c7565b9050611dd58282611d8e565b919050565b600067ffffffffffffffff821115611df557611df4611d5f565b5b611dfe82611adc565b9050602081019050919050565b82818337600083830152505050565b6000611e2d611e2884611dda565b611dbf565b905082815260208101848484011115611e4957611e48611d5a565b5b611e54848285611e0b565b509392505050565b600082601f830112611e7157611e70611d55565b5b8135611e81848260208601611e1a565b91505092915050565b60008060008060808587031215611ea457611ea36119d1565b5b6000611eb287828801611c14565b9450506020611ec387828801611c14565b9350506040611ed487828801611b5f565b925050606085013567ffffffffffffffff811115611ef557611ef46119d6565b5b611f0187828801611e5c565b91505092959194509250565b60008060408385031215611f2457611f236119d1565b5b6000611f3285828601611c14565b9250506020611f4385828601611c14565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680611f9457607f821691505b602082108103611fa757611fa6611f4d565b5b50919050565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b6000612009602183611aa1565b915061201482611fad565b604082019050919050565b6000602082019050818103600083015261203881611ffc565b9050919050565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60008201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c000000602082015250565b600061209b603d83611aa1565b91506120a68261203f565b604082019050919050565b600060208201905081810360008301526120ca8161208e565b9050919050565b7f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560008201527f72206f7220617070726f76656400000000000000000000000000000000000000602082015250565b600061212d602d83611aa1565b9150612138826120d1565b604082019050919050565b6000602082019050818103600083015261215c81612120565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061219d82611993565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036121cf576121ce612163565b5b600182019050919050565b7f4552433732313a20696e76616c696420746f6b656e2049440000000000000000600082015250565b6000612210601883611aa1565b915061221b826121da565b602082019050919050565b6000602082019050818103600083015261223f81612203565b9050919050565b7f4552433732313a2061646472657373207a65726f206973206e6f74206120766160008201527f6c6964206f776e65720000000000000000000000000000000000000000000000602082015250565b60006122a2602983611aa1565b91506122ad82612246565b604082019050919050565b600060208201905081810360008301526122d181612295565b9050919050565b600081905092915050565b7f7b226e616d65223a2022546573742044617070204e4654732023000000000000600082015250565b6000612319601a836122d8565b9150612324826122e3565b601a82019050919050565b600061233a82611a96565b61234481856122d8565b9350612354818560208601611ab2565b80840191505092915050565b7f222c20226465736372697074696f6e223a2022546573742044617070204e465460008201527f7320666f722074657374696e672e222c2022696d616765223a2022646174613a60208201527f696d6167652f7376672b786d6c3b6261736536342c0000000000000000000000604082015250565b60006123e26055836122d8565b91506123ed82612360565b605582019050919050565b7f222c202261747472696275746573223a205b7b2274726169745f74797065223a60008201527f2022546f6b656e204964222c202276616c7565223a2022000000000000000000602082015250565b60006124546037836122d8565b915061245f826123f8565b603782019050919050565b7f227d5d7d00000000000000000000000000000000000000000000000000000000600082015250565b60006124a06004836122d8565b91506124ab8261246a565b600482019050919050565b60006124c18261230c565b91506124cd828661232f565b91506124d8826123d5565b91506124e4828561232f565b91506124ef82612447565b91506124fb828461232f565b915061250682612493565b9150819050949350505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c000000600082015250565b6000612549601d836122d8565b915061255482612513565b601d82019050919050565b600061256a8261253c565b9150612576828461232f565b915081905092915050565b7f4552433732313a207472616e736665722066726f6d20696e636f72726563742060008201527f6f776e6572000000000000000000000000000000000000000000000000000000602082015250565b60006125dd602583611aa1565b91506125e882612581565b604082019050919050565b6000602082019050818103600083015261260c816125d0565b9050919050565b7f4552433732313a207472616e7366657220746f20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b600061266f602483611aa1565b915061267a82612613565b604082019050919050565b6000602082019050818103600083015261269e81612662565b9050919050565b7f4552433732313a20617070726f766520746f2063616c6c657200000000000000600082015250565b60006126db601983611aa1565b91506126e6826126a5565b602082019050919050565b6000602082019050818103600083015261270a816126ce565b9050919050565b7f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560008201527f63656976657220696d706c656d656e7465720000000000000000000000000000602082015250565b600061276d603283611aa1565b915061277882612711565b604082019050919050565b6000602082019050818103600083015261279c81612760565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006127dd82611993565b91506127e883611993565b9250828201905080821115612800576127ff612163565b5b92915050565b600061281182611993565b915061281c83611993565b92508261282c5761282b6127a3565b5b828204905092915050565b600061284282611993565b915061284d83611993565b925082820261285b81611993565b9150828204841483151761287257612871612163565b5b5092915050565b600081519050919050565b600082825260208201905092915050565b60006128a082612879565b6128aa8185612884565b93506128ba818560208601611ab2565b6128c381611adc565b840191505092915050565b60006080820190506128e36000830187611bd3565b6128f06020830186611bd3565b6128fd604083018561199d565b818103606083015261290f8184612895565b905095945050505050565b60008151905061292981611a07565b92915050565b600060208284031215612945576129446119d1565b5b60006129538482850161291a565b91505092915050565b7f4552433732313a206d696e7420746f20746865207a65726f2061646472657373600082015250565b6000612992602083611aa1565b915061299d8261295c565b602082019050919050565b600060208201905081810360008301526129c181612985565b9050919050565b7f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000600082015250565b60006129fe601c83611aa1565b9150612a09826129c8565b602082019050919050565b60006020820190508181036000830152612a2d816129f1565b905091905056fe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2f3c737667206865696768743d22333530222077696474683d22333530222076696577426f783d2230203020313030203130302220786d6c6e733d22687474703a2f2f7777772e77332e6f72672f323030302f737667223e3c646566733e3c706174682069643d224d7950617468222066696c6c3d226e6f6e6522207374726f6b653d227265642220643d224d31302c3930205139302c39302039302c3435205139302c31302035302c3130205131302c31302031302c3430205131302c37302034352c3730205137302c37302037352c353022202f3e3c2f646566733e3c746578743e3c746578745061746820687265663d22234d7950617468223e517569636b2062726f776e20666f78206a756d7073206f76657220746865206c617a7920646f672e3c2f74657874506174683e3c2f746578743e3c2f7376673ea2646970667358221220922487cf7bfec55ad9cf0c646397333bb79204b1a8ef63134f78b23d697570ef64736f6c63430008120033", "gas": "0x26e8af", "gasPrice": "0x18e17", "value": "0x0" } ] }` // balanceParamsStr, _ := json.Marshal(balanceParams) eth_getBalanceStr = escapeAllStr(eth_getBalanceStr, "selfAddress", user.Address) personal_signStr = escapeAllStr(personal_signStr, "selfAddress", user.Address) eth_signTypedData_v4Str = escapeAllStr(eth_signTypedData_v4Str, "selfAddress", user.Address) eth_sendTransactionStrNative = escapeAllStr(eth_sendTransactionStrNative, "selfAddress", user.Address) eth_sendTransactionStrNative = escapeAllStr(eth_sendTransactionStrNative, "botAddress", botAddress) eth_sendTransactionStrToken = escapeAllStr(eth_sendTransactionStrToken, "selfAddress", user.Address) eth_sendTransactionStrToken = escapeAllStr(eth_sendTransactionStrToken, "botAddress", botAddress[2:]) sendTransactionStrSwap = escapeAllStr(sendTransactionStrSwap, "selfAddress", user.Address) eth_sendTransactionApproveStr = escapeAllStr(eth_sendTransactionApproveStr, "selfAddress", user.Address) eth_sendTransactionApproveStr = escapeAllStr(eth_sendTransactionApproveStr, "botAddress", botAddress[2:]) sendTransactionStrTransferFrom = escapeAllStr(sendTransactionStrTransferFrom, "selfAddress", user.Address) sendTransactionStrMint = escapeAllStr(sendTransactionStrMint, "selfAddress", user.Address) sendTransactionStrDeploy = escapeAllStr(sendTransactionStrDeploy, "selfAddress", user.Address) homeMenuMarkup.InlineKeyboard[0][0].CallbackData = ð_getBalanceStr homeMenuMarkup.InlineKeyboard[1][0].CallbackData = &personal_signStr homeMenuMarkup.InlineKeyboard[2][0].CallbackData = ð_signTypedData_v4Str homeMenuMarkup.InlineKeyboard[3][0].CallbackData = ð_sendTransactionStrNative //合约币转账 homeMenuMarkup.InlineKeyboard[4][0].CallbackData = ð_sendTransactionStrToken homeMenuMarkup.InlineKeyboard[5][0].CallbackData = &sendTransactionStrSwap homeMenuMarkup.InlineKeyboard[6][0].CallbackData = ð_sendTransactionApproveStr homeMenuMarkup.InlineKeyboard[7][0].CallbackData = &sendTransactionStrTransferFrom homeMenuMarkup.InlineKeyboard[8][0].CallbackData = &sendTransactionStrMint homeMenuMarkup.InlineKeyboard[9][0].CallbackData = &sendTransactionStrDeploy _, err = bot.Send(msg) } } if err != nil { log.Printf("An error occured: %s", err.Error()) } } func escapeAllStr(text, old, new string) string { text = strings.ReplaceAll(text, "\n", "") text = strings.ReplaceAll(text, "\t", "") text = strings.ReplaceAll(text, " ", "") text = strings.ReplaceAll(text, old, new) return text } func handleButton(query *boxbotapi.CallbackQuery) { message := query.Message var text = query.Data markup := boxbotapi.NewInlineKeyboardMarkup() markup = homeMenuMarkup // Replace menu text and keyboard msg := boxbotapi.NewEditMessageTextAndMarkup(message.Chat.ID, message.Chat.Type, message.MessageID, text, markup) msg.ParseMode = boxbotapi.ModeHTML bot.Send(msg) } ``` --- ## Developer FAQ / Troubleshooting This page covers high-frequency integration issues and practical diagnosis paths. For a new integration, start with the primary document that matches your path in FAQ 1. ## 1. Which document should I start with? Choose by integration path: - Creating and configuring a bot, credentials, privacy, permissions, and receiving modes: [Bot Development Overview](https://docs.debox.pro/en/APIs/BotGuide). - Field definitions, enums, success/error samples: [OpenAPI](https://docs.debox.pro/en/ApiOnePage). - Long polling with Go: [Go SDK](https://docs.debox.pro/en/GO-SDK). - Node.js development: [Node.js SDK](https://docs.debox.pro/en/NODE-SDK). - Python development: [Python SDK](https://docs.debox.pro/en/PYTHON-SDK). - Webhook development with Go: [Go SDK Webhook](https://docs.debox.pro/en/GO-SDK-Webhook). ## 2. Why does `getUpdates` return no messages? Most likely a webhook is already configured in BotMother. If BotMother still has a Webhook URL, `getUpdates` is not an active receiving path. If you intend to use Long Polling, clear the Webhook settings first. See the [receiving-mode setup](https://docs.debox.pro/en/APIs/BotGuide) for the complete rule and configuration flow. ## 3. Why does a message reach the wrong target or fail routing validation? If a message reaches the wrong target or routing validation fails, check that `chat_id` matches `chat_type`, then compare both values with the [OpenAPI routing rules](https://docs.debox.pro/en/ApiOnePage#message-fields). ## 4. Why does an image or other media message fail to send? The complete `parse_mode` and `content` contract is in the [OpenAPI message fields](https://docs.debox.pro/en/ApiOnePage#message-fields). If text messages work but an image does not send, check in this order: 1. `parse_mode` is exactly `image`. 2. `content` is a publicly accessible image URL. 3. Use [`getMe`](https://docs.debox.pro/en/ApiOnePage#api-bot-getme) to check `result.level`, then compare the destination with the requirements and administrator exception in [Bot level and image sending](https://docs.debox.pro/en/APIs/BotGuide#bot-image-level). 4. Check any remaining API, permission, privacy, or platform restrictions for the target chat. ## 5. Why does webhook authentication fail? Compare the incoming `X-API-KEY` with the bot's current `Webhook Key`. If the key was changed in BotMother, update the value used by the backend validator at the same time. See the [Webhook request and validation contract](https://docs.debox.pro/en/GO-SDK-Webhook) for the complete requirements. ## 6. How to diagnose send failures? The [OpenAPI message fields](https://docs.debox.pro/en/ApiOnePage#message-fields) define the allowed values and limits. Recommended check order: 1. `X-API-KEY` header exists and is valid. 2. `chat_type/chat_id` mapping is correct. 3. `content` is not empty and within limits. 4. `parse_mode` matches content format. 5. For signed endpoints (such as `dao_member`), verify `nonce/timestamp/signature`; `timestamp` must be a 13-digit Unix timestamp in milliseconds. ## 7. Common errors and fixes - `message can't be empty`: missing `content`. - `message must be less than 5000 characters`: text-mode payload too long. - `message must be less than 2000 bytes`: fan-broadcast payload too large. - `permission denied`: caller has no required group admin permission. - `Param error`: missing/invalid parameters (often malformed addresses). ## 8. Why can't I find the target group's `gid`? Open the target group in app and copy its share link. The `id` query value is `gid`. ## 9. Why does authentication fail after I copy the bot credentials? - When the bot service calls OpenAPI, `X-API-KEY` must use the bot's `App Key` (`API Key`). Signed endpoints also require the matching `App Secret` (`API Secret`) from the same bot. - When DeBox calls the bot service through Webhook, validate the incoming `X-API-KEY` with the separate `Webhook Key`. If authentication fails, first check the request direction and make sure these values were not mixed. Keep all three values in a trusted backend or environment variables. Do not put them in H5 pages, browser code, public repositories, logs, or screenshots. See [DeBox Bot Development Overview](https://docs.debox.pro/en/APIs/BotGuide) for the complete credential mapping and setup flow. ## 10. Why does a BotMother command appear in the menu but do nothing? BotMother command settings only control the command names and descriptions shown in the bot's command menu. The bot service must still implement the message handling and business behavior for each command. See [DeBox Bot Development Overview](https://docs.debox.pro/en/APIs/BotGuide) for the complete setup flow. ## 11. Why does the bot not receive private or group messages? Use the privacy and permission settings in [DeBox Bot Development Overview](https://docs.debox.pro/en/APIs/BotGuide) as the primary reference, then check these layers: 1. In the bot privacy settings, make sure the direct-message and group-invitation scopes include the account used for testing. 2. Test ordinary messages and the variant messages required by the bot in a private chat first. 3. Without **Listen to Group Messages**, only ordinary group messages that explicitly mention `@Bot` are delivered. Ordinary group messages without an explicit `@Bot` mention and variant group messages with or without a mention require this permission. See the [Bot message delivery rules](https://docs.debox.pro/en/APIs/BotGuide#message-delivery-permission) for the complete matrix. 4. If the bot must receive a group message covered by that permission, submit the **Listen to Group Messages** application and wait for platform approval. 5. If the application is not approved, request feedback in the [OpenBOX Bot Release Review group](https://m.debox.pro/group?id=4geed9ux&code=trxuvgm9) in the DeBox App. If an eligible private or group message still does not arrive, also check the [Webhook and Long Polling conflict](https://docs.debox.pro/en/GO-SDK-Webhook). ## 12. Why does DeBox show a third-party website warning, and why are HTTP links blocked? The DeBox in-app browser supports only `https://` URLs. It blocks `http://` URLs. | URL | Result in DeBox | | --- | --- | | `http://` URL | Blocked and cannot be opened in the in-app browser. | | Third-party `https://` URL | Can be opened, but shows a third-party website security notice by default. | The warning depends on the destination, not on who sent the link or how it appears in the chat. The same rule applies to links in bot text messages, bot buttons and other message formats, links sent by ordinary users, developer-built DApps/H5 pages, and other external websites. Changing a text link to a button does not remove the warning. To request an assessment for opening a specific website or domain without the warning, contact [DeBox official support](https://m.debox.pro/card?id=trxuvgm9&invite_code=trxuvgm9). Whether the warning can be removed is subject to platform review. ## 13. Support channels - Technical discussion group: [Join the DeBox technical discussion group](https://m.debox.pro/group?id=bzqhe5s9&code=trxuvgm9) --- ## DeBox FAQs ## 1. Where can I get support? - Official account: [DeBox Official](https://m.debox.pro/card?id=uu08en3w) - Beginner community: [Join the DeBox beginner community](https://m.debox.pro/group?id=l3izdfzd&code=cb52wvhq) - Technical discussion group: [Join the DeBox technical discussion group](https://m.debox.pro/group?id=bzqhe5s9&code=trxuvgm9) ## 2. How do I report a product issue? In DeBox, go to **My**, select **Settings** in the upper-right corner, and then select **Feedback** to submit the issue details. ## 3. Where can I obtain OpenAPI credentials? Create a bot through BotMother, then obtain its `App Key` and `App Secret` from the bot management page. `App Key` is the same credential called `API Key` in the OpenAPI documentation. See [DeBox Bot Development Overview](https://docs.debox.pro/en/APIs/BotGuide) for the complete path. ## 4. Which Chain IDs are used in developer integrations? The table below is a Chain ID reference for developer integrations. It does not guarantee that every DeBox capability supports every listed network. Check the relevant DApp, Deep Link, Shares, or blockchain-button documentation for capability-specific support. Documentation reviewed: August 6, 2026. | Chain ID | Chain Name | | --- | --- | | -200 | Solana | | 1 | Ethereum | | 10 | Optimism | | 56 | BNB | | 137 | Polygon | | 196 | X Layer | | 250 | Fantom | | 324 | ZkSync Era | | 4200 | Merlin | | 5000 | Mantle | | 8453 | Base | | 42161 | Arbitrum | | 43114 | Avalanche | | 59144 | Linea | | 81457 | Blast | | 200901 | Bitlayer | | 534352 | Scroll | ## 5. Where are developer integration docs? - OpenAPI: [DeBox Developer OpenAPI](https://docs.debox.pro/en/ApiOnePage) - Bot guide: [DeBox Bot Guide](https://docs.debox.pro/en/APIs/BotGuide) - Go SDK (long polling): [DeBox Bot Go SDK](https://docs.debox.pro/en/GO-SDK) - Go SDK (webhook): [DeBox Bot Go SDK Webhook](https://docs.debox.pro/en/GO-SDK-Webhook)