API Doc

Api Base Host

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

Channel

Query Channel

GET /notify/channels

Parameters

  • current_page int, Current query page, starting from 1

  • per_page int, Number of records 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, needed when subscribing to 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 is fixed as Wallet
        "name": "address bot",
        "tags": [
            "tag1"  // tags for statistical display
        ],
        "status": "Public",   // optional: Public/Private, only VIP users are allowed to create Private bot 
        "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 transfer
                "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 transfer
                "params": {
                    "direction": "both",  // optional values: both/out/in
                    "minimum_usd": 6
                }
            },
            {
                "func": "nft_transfer",   // monitor nft transfer
                "params": {
                    "direction": "both"
                }
            },
            {
                "func": "contract_deploy",  // monitor contract deployment
                "params": {}
            },
            {
                "func": "contract_call",  // monitor contract call
                "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
  "info": {
    "name": "address bot",   // subscription name
    "status": "Enabled",  // fixed as Enabled
    "actions": [
      {
        "type": "Notify",  // fixed as Notify
        "params": {
          "channel_ids": [
            2877    // channel id
          ]
        }
      }
    ],
    "notify": {
      "frequency": "5m", // push frequency, optional values: Always OnlyOnce 5m 10m 30m 1h 4h 12h 24h
      "template": ""
    }
  },
  "driver": {}  // deprecated, fixed as {}
}

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