lightweight Abbot skill for Mercury’s banking API
README
This skill requires the following secrets to be configured:
Mercury will ask for an IP address to whitelist, please use 20.42.147.250
.
You can schedule this skill to run in the room of your choosing by saying @abbot schedule mercury
and follow the link Abbot shares in your channel. The webpage will allow you to set any schedule you would like.
This will loop through any accounts you have on Mercury, and output something like this:

Code
url = “https://backend.mercury.com/api/v1/accounts”
apitoken = bot.secrets.read(“apitoken”)
headers = {
“Accept”: “application/json”,
“Content-Type”: “application/json”
}
r = requests.get(url, auth=(apitoken, ”), headers=headers)
r.raise_for_status
results = r.json()
if “errors” in results:
bot.reply(“There was an error trying to run this skill: ” + results[“errors”][“message”])
else:
output = “Bank balances as of ” + date.today().strftime(“%b %d, %Y”)
for account in results[“accounts”]:
output += “\n * {}: ${:,.2f}”.format(account[“name”], account[“availableBalance”])
bot.reply(output)