Api Documentation

Api Base Host

https://api.chainbot.io/api/v1

Channel

Query Channel

GET /notify/channels

Parameters

  • current_page int, Current page number, starting from 1

  • per_page int, Number of results per page

Response

{
    "code": 0,
    "msg": "success",
    "data": {
        "data": [
            {
                "id": 1367,
                "user_id": 2137,
                "name": "Pushover",
                "platform": "Pushover",
                "token": "token",
                "channel": "channel",
                "channel_type": "",
                "is_default": 0,
                "priority": 1,
                "others": null
            },
            {
                "id": 1075,
                "user_id": 2137,
                "name": "Webhook",
                "platform": "Webhook",
                "token": "",
                "channel": "http://webhook.io/url",
                "channel_type": "",
                "is_default": 1,
                "priority": 0,
                "others": null
            }
        ],
        "current_page": 1,
        "per_page": "999",
        "total": 2
    }
}

Add Channel

POST /notify/channels

Parameters

{
    "name": "web",
    "platform": "Webhook",
    "token": "",
    "channel_type": "",
    "channel": "http://webhook.com/url",
    "priority": 0,
    "others": {
        "retryExpire": "0",
        "retryInterval": "0"
    }
}

Response

{
  "code": 0,
  "msg": "success",
  "data": {
    "id": 2879,   // channel id, used when subscribing to a bot
    "user_id": 2137,
    "name": "Webhook",
    "platform": "Webhook",
    "token": "",
    "channel": "http://sda.dfa",
    "channel_type": "",
    "is_default": 0,
    "priority": 0,
    "others": {}
  }
}

Delete Channel

DELETE /notify/channels/{channel_id}

Parameters

  • channel_id

Response

{
    "code": 0,
    "msg": "success",
    "data": {}
}

Bot

Create Bot

POST /bots

Parameters

Address Bot Example

{
    "info": {
        "type": "Wallet",  // address bot fixed as Wallet
        "name": "address bot",
        "tags": [
            "tag1"  // Tags for statistical display
        ],
        "status": "Public",   // Optional values: Public/Private, only VIP users can create Private bots 
        "notify_template": "[{$subscription.name}]\nFrom: {$tx.from}\nTo: {$tx.to}\nMethod: {$tx.method}\nStatus: {$tx.status}\nExplore: {$chain.explore}/tx/{$tx.hash}\nTime: {$block.time}",
        "description": "desc"
    },
    "driver": {
        "chains": [
            {
                "chain_id": "1",
                "type": "Ethereum"
            }
        ],
        "addresses": [
            "0x114910771af9ca656af840dff83e8264ecf986ca"
        ],
        "strategies": [
            {
                "func": "eth_transfer",  // Monitor ETH transfers
                "params": {
                    "direction": "out",  // Optional values: both/out/in
                    "minimum_amount": "100000000000000000000",  // ETH amount, unit wei
                    "minimum_usd": 1   // ETH converted to USD amount
                }
            },
            {
                "func": "token_transfer",  // Monitor ERC 20 transfers
                "params": {
                    "direction": "both",  // Optional values: both/out/in
                    "minimum_usd": 6
                }
            },
            {
                "func": "nft_transfer",   // Monitor NFT transfers
                "params": {
                    "direction": "both"
                }
            },
            {
                "func": "contract_deploy",  // Monitor contract deployment
                "params": {}
            },
            {
                "func": "contract_call", // Monitor contract calls
                "params": {}
            }
        ]
    }
}

Response

{
  "code": 0,
  "msg": "success",
  "data": {
    "id": "461170869663212058",  // bot id, used for subscription after creation
    "info": {
      "type": "Wallet",
      "name": "address bot",
      "tags": [
        "tag1"
      ],
      "description": "desc",
      "notify_template": "[{$subscription.name}]\nFrom: {$tx.from}\nTo: {$tx.to}\nMethod: {$tx.method}\nStatus: {$tx.status}\nExplore: {$chain.explore}/tx/{$tx.hash}\nTime: {$block.time}",
      "status": "Public"
    },
    "driver": {
      "addresses": [
        "0x114910771af9ca656af840dff83e8264ecf986ca"
      ],
      "chains": [
        {
          "chain_id": "1",
          "type": "Ethereum"
        }
      ],
      "strategies": [
        {
          "func": "eth_transfer",
          "params": {
            "direction": "both",
            "minimum_amount": "0",
            "minimum_usd": 0
          }
        },
        {
          "func": "token_transfer",
          "params": {
            "direction": "both",
            "minimum_usd": 0
          }
        }
      ]
    },
    "subscribe_num": 0,
    "fork_num": 0,
    "view_times": 0,
    "triggered_times": 0,
    "last_trigger_time": 0,
    "readme": "",
    "created_at": "2024-05-09T17:40:29.336Z",
    "user": {},
    "notifies": null,
    "forked_bot": null,
    "original_bot": null,
    "sub_users": null
  }
}

Delete bot

DELETE /bots/{bot_id}

Parameters

  • bot_id

Response

{
    "code": 0,
    "msg": "success",
    "data": {}
}

Update Bot

PUT /bots/{bot_id}

Parameters

Address Bot Example

{
    "info": {
        "type": "Wallet",
        "name": "test address",
        "tags": [],
        "status": "Private",
        "notify_template": "[{$subscription.name}]\nFrom: {$tx.from}\nTo: {$tx.to}\nMethod: {$tx.method}\nStatus: {$tx.status}\nExplore: {$chain.explore}/tx/{$tx.hash}\nTime: {$block.time}\nCreated By chainbot.io",
        "description": ""
    },
    "driver": {
        "chains": [
            {
                "chain_id": "1",
                "type": "Ethereum"
            }
        ],
        "addresses": [
            "0x114910771af9ca656af840dff83e8264ecf986ca"
        ],
        "strategies": [
            {
                "func": "eth_transfer",
                "params": {
                    "direction": "both",
                    "minimum_amount": "0",
                    "minimum_usd": 1
                }
            },
            {
                "func": "token_transfer",
                "params": {
                    "direction": "both",
                    "minimum_usd": 1
                }
            },
            {
                "func": "contract_deploy",
                "params": {}
            }
        ]
    }
}

Response

{
    "code": 0,
    "msg": "success",
    "data": {
        "id": "464062092614790430",
        "info": {
            "type": "Wallet",
            "name": "test address",
            "notify_template": "[{$subscription.name}]\nFrom: {$tx.from}\nTo: {$tx.to}\nMethod: {$tx.method}\nStatus: {$tx.status}\nExplore: {$chain.explore}/tx/{$tx.hash}\nTime: {$block.time}\nCreated By chainbot.io",
            "status": "Private"
        },
        "driver": {
            "addresses": [
                "0x114910771af9ca656af840dff83e8264ecf986ca"
            ],
            "chains": [
                {
                    "chain_id": "1",
                    "type": "Ethereum"
                }
            ],
            "strategies": [
                {
                    "func": "eth_transfer",
                    "params": {
                        "direction": "both",
                        "minimum_amount": "0",
                        "minimum_usd": 1
                    }
                },
                {
                    "func": "token_transfer",
                    "params": {
                        "direction": "both",
                        "minimum_usd": 1
                    }
                },
                {
                    "func": "contract_deploy",
                    "params": {}
                }
            ]
        },
        "subscribe_num": null,
        "fork_num": null,
        "view_times": 0,
        "triggered_times": 0,
        "last_trigger_time": 0,
        "readme": "",
        "created_at": null,
        "user": {},
        "notifies": null,
        "forked_bot": null,
        "original_bot": null,
        "sub_users": null
    }
}

Subscribe

Subscribe to Bot

POST /subscriptions

Parameters

{
  "bot_id": "461170869663212058",  // bot id to subscribe to
  "info": {
    "name": "address bot",   // Subscription name
    "status": "Enabled",  // Fixed value: Enabled
    "actions": [
      {
        "type": "Notify",  // Fixed value: Notify
        "params": {
          "channel_ids": [
            2877    // channel id
          ]
        }
      }
    ],
    "notify": {
      "frequency": "5m", // Push frequency, options: Always OnlyOnce 5m 10m 30m 1h 4h 12h 24h
      "template": ""
    }
  },
  "driver": {}  // Deprecated, always pass {} 
}

Response

{
    "code": 0,
    "msg": "success",
    "data": {
        "id": "464064078080863518",  //
        "info": {
            "name": "safa",
            "status": "Enabled",
            "actions": [],
            "notify": {
                "frequency": "Always",
                "template": "[{$subscription.name}]\nFrom: {$tx.from}\nTo: {$tx.to}\nMethod: {$tx.method}\nStatus: {$tx.status}\nExplore: {$chain.explore}/tx/{$tx.hash}\nTime: {$block.time}\nCreated By chainbot.io"
            }
        },
        "user_id": 2137,
        "bot_id": "464063535924735262",
        "trigger_times": 0,
        "last_trigger_time": 0,
        "trigger_last_update_at": 1716138672,
        "created_at": "2024-05-19T17:11:12.64Z"
    }
}

Unsubscribe from Bot

DELETE /subscriptions/{subscription_id}

Parameters

  • subscription_id

Response

{
    "code": 0,
    "msg": "success",
    "data": {}
}

Last updated