Fetch crypto tickers from Mercado Bitcoin's API and send them via Apple Messages (iMessage/SMS) on macOS.
This repository now includes a more robust CLI with flags, .env support, better formatting, and optional Apple Shortcuts integration.
Prerequisites
- Bash (macOS default is fine)
- jq:
brew install jq - AppleScript runtime (macOS built-in) for default delivery
- Optional: Shortcuts CLI for
--via shortcut(macOS 12+):shortcuts --help
Quick Start
./fetch_ticker_and_send_message.sh -s BTC-BRL,ETH-BRL -t 11999999999
All supported pairs: https://api.mercadobitcoin.net/api/v4/symbols (JSON)
Configuration (.env)
Copy .env.example to .env and customize defaults:
cp .env.example .env
Available variables:
MB_SYMBOLS(e.g.BTC-BRL,ETH-BRL)MB_TO(destination phone/contact)MB_DELIVERY(applescript|shortcut|print)MB_SHORTCUT_NAME(default:Send Crypto Tickers)MB_API_URL(default: Mercado Bitcoin tickers endpoint)
CLI Usage
Usage: fetch_ticker_and_send_message.sh -s SYMBOLS -t PHONE [options]
Required:
-s, --symbols Comma-separated pairs, e.g. BTC-BRL,ETH-BRL
-t, --to Phone number or contact (iMessage)
Options:
-v, --via applescript|shortcut|print (default: applescript)
--shortcut-name Name of Shortcut to run (default: Send Crypto Tickers)
-n, --dry-run Do not send; print message to stdout
-h, --help Show help and exit
--version Show version and exit
The script outputs a multi-line message with a timestamp header and one line per pair, e.g.:
Crypto Tickers (Mercado Bitcoin) — 2025-09-06 09:00
BTC-BRL High: 613596.00000000 Low: 596736.00000000 Buy: 603635.00000000 Sell: 604028.00000000 Last: 603625.00000000
ETH-BRL High: ... Low: ... Buy: ... Sell: ... Last: ...
Integration Options
- AppleScript (default): Uses
message.applescriptto send via Messages. If the number isn’t on iMessage, Messages will attempt SMS. - Shortcuts: Use
--via shortcutto call a Shortcut that takes a File input and handles sending. See screenshot below for a simple Shortcut.
Creating the Shortcut is simple—use the same structure as the screenshot:
