Bot - /bot
With our API, you can create, edit or delete your bots params ! Note: Only for Certified Bots by Watchbot.
https://api.watchbot.app
To get the authentication token, go to your bot section (https://watchbot.app) and you will find it in the settings page.
get
https://api.watchbot.app
/bot/:id
Bot
get
https://api.watchbot.app
/bot/:id/uptime
Uptime
post
https://api.watchbot.app
/bot/:id/announcement/edit
Announcement
delete
https://api.watchbot.app
/bot/:id/announcement
Announcement
get
https://api.watchbot.app
/bot/:id/incidents
Incidents / Status
post
https://api.watchbot.app
/bot/:id/incidents/create
Create an Incident
post
https://api.watchbot.app
/bot/:id/incident/:iid/edit
Edit an incident
delete
https://api.watchbot.app
/bot/:id/incidents/:iid
Delete an incident
post
https://api.watchbot.app
/bot/:id/incidents/:iid/status/create
Create a status
post
https://api.watchbot.app
/bot/:id/incidents/:iid/status/:sid/edit
Edit a status
delete
https://api.watchbot.app
/bot/:id/incidents/:iid/status/:sid
Delete a status
NodeJS
Python
PHP
const axios = require('axios')
const fetch = require('node-fetch')
const botid = ""
const apiToken = ""
// Method: GET
fetch(`https://api.watchbot.app/bot/${botID}/incidents`, {
headers: {
'AUTH-TOKEN': apiToken
}
}).then(response => response.json()).then(result => {
console.log(result)
})
// Method: POST
const data = {
title: "Title",
type: "Partial Outage",
date: "2021-01-01"
}
const content = JSON.stringify(data, null);
axios.post(`https://api.watchbot.app/bot/${botID}/incidents/create`, content, {
headers: {
'Content-Type': 'application/json',
'Content-Length': content.length,
'AUTH-TOKEN': apiToken
}
}).then((res) => {
console.log(res["data"])
})
// Method: DELETE
axios.delete(`https://api.watchbot.app/bot/${botID}/incidents/26/status/658`, {
headers: {
'AUTH-TOKEN': apiToken
}
}).then((res) => {
console.log(res["data"])
})
# Author : baptiste0928 (https://baptiste0928.net)
import aiohttp
import requests
from typing import Dict # Used for typing (optional)
import asyncio # Used for examples
def get_uptime(botID: str, *, auth_token: str) -> Dict[str, str]:
"""Simple function to interact with the Watchbot api using requests."""
headers = {"AUTH-TOKEN": auth_token}
r = requests.get("https://api.watchbot.app/bot/" + botID, headers=headers)
return r.json()
async def get_uptime_async(botID: str, *, auth_token: str) -> Dict[str, str]:
"""Simple async function to interact with the Watchbot api using aiohttp."""
async with aiohttp.ClientSession() as session:
headers = {"AUTH-TOKEN": auth_token}
async with session.get("https://api.watchbot.app/bot/" + botID, headers=headers) as r:
return await r.json()
# Usage example
botID = ""
auth_token = ""
print(get_uptime(botID, auth_token=auth_token))
print(asyncio.get_event_loop().run_until_complete(get_uptime_async(botID, auth_token=auth_token)))
<?php
// Author : Adrien Luitot (https://adrien.luitot.fr)
$apiToken = ""; // Here put your token
$botId = ""; // Here your bot id
$curl = curl_init('https://api.watchbot.app/bot/' . $botId);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_HTTPHEADER, ['AUTH-TOKEN: ' . $apiToken]);
$response = curl_exec($curl);
echo $response;
?>
Last modified 11mo ago