lightweight Abbot skill for Mercury’s banking API
About Abbot
Abbot is a programmable bot that turns your team chat into a shared command center. We handle all the boilerplate of building and running these conmmands so that you can focus on making tools that help you ship faster.
We built Abbot because we saw the power of this style of work (called ChatOps), when we worked at GitHub. ChatOps made it possible for GitHub to work productively without meetings, while globally distributed. We think it’s a pretty great way to work, so we made it easy to use in Slack, Discord, and Microsoft Teams.
You can read more about Abbot here, check out our blog, or take a look at some of the other cool packages available as a one-click install from Abbot’s Package Directory.
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)