Mercury Bank + Slack Integration

This project integrates Mercury Bank's API with Slack, allowing you to:

  • Check account balances
  • View recent transactions
  • Get notifications for important account events
  • Search and filter transactions
  • Receive automatic notifications for new transactions

Project Structure

  • /backend/ - Server-side code for handling API requests
    • index.ts - Main HTTP entry point
    • mercury.ts - Mercury API client
    • slack.ts - Slack message formatting and command handling
    • notifications.ts - Transaction notification system
    • cron.ts - Scheduled job to check for new transactions
  • /shared/ - Shared types and utilities
    • types.ts - TypeScript interfaces for Mercury and Slack data

Setup Requirements

  1. Mercury API credentials (stored as environment variables)
  2. Slack App with slash commands configured
  3. Slack Incoming Webhook URL for transaction notifications
  4. Webhook URL from this Val pointing to your Slack app

Usage

Once configured, you can use the following slash commands in Slack:

  • /mercury balance - Check your account balances
  • /mercury transactions [count] - View recent transactions
  • /mercury search [query] - Search transactions

Transaction Notifications

The integration supports two methods for transaction notifications:

  1. Webhook Method (if Mercury supports webhooks):

    • Receives real-time notifications from Mercury when transactions occur
    • Posts formatted transaction details to your Slack channel immediately
  2. Polling Method (fallback option):

    • Regularly checks for new transactions via the Mercury API
    • Compares with previously seen transactions to identify new ones
    • Posts new transaction details to your Slack channel

Security Notes

  • All API credentials are stored as environment variables
  • No sensitive data is logged or stored