Send messages from Bash / Shell with the SendiMessage API
Shell scripts send messages the same way everything else does — cURL against the REST API. The example is a complete script with an exit code you can trust in cron jobs, deploy hooks, and monitoring glue.
Operational alerting is the sweet spot: notify an on-call phone when a backup fails, or message a driver when a route is assigned, straight from the systems you already script.
What this integration enables
Architecture
- Your application eventAn order ships, a booking nears, a ticket updates
- Bash / Shell server codeBuilds the request with credentials from the environment
- SendiMessage APIPOST /send-message returns the queued message
- Managed messaging lineSMS, or iMessage on supported lines and destinations
- Webhook eventsDelivery status and incoming replies post back to your endpoint
Example request
#!/usr/bin/env bashset -euo pipefailNUMBER="${1:?usage: send.sh +15555550123 \"message text\"}"CONTENT="${2:?missing message text}"response=$(curl -sS --fail-with-body https://api.sendimessage.com/v1/send-message \-H "X-API-Key: ${SENDIMESSAGE_KEY:?SENDIMESSAGE_KEY not set}" \-H "X-API-Secret: ${SENDIMESSAGE_SECRET:?SENDIMESSAGE_SECRET not set}" \-H "Content-Type: application/json" \-d "$(printf '{"number":"%s","content":"%s"}' "$TO" "$TEXT")")echo "$response" # {"message_handle":"4e828182-…","status":"QUEUED",…}
Delivery events and incoming replies
Delivery status and incoming replies arrive as signed webhook events. Verify the signature, then correlate events with your own records via the message_handle returned when you sent.
// "outbound" event → your bash endpoint// Verify the SendiMessage-Signature header (t={timestamp},v1=HMAC-SHA256 of// "{timestamp}.{raw body}", keyed with your webhook secret), then use// GET /v2/messages/{message_handle} for authoritative state and match it to// your contact_id in bash.
Limitations and honest notes
- iMessage delivery is available on supported messaging lines and destinations. Recipients without iMessage receive SMS when fallback is configured — never assume universal iMessage availability.
- Messages are accepted asynchronously — the API returns status QUEUED and final status arrives via webhook or the message endpoints.
- No official SDK for this ecosystem yet — the example uses plain HTTP against the REST API. Official SDKs are published for JavaScript/TypeScript (npm: sendimessage), Python (PyPI: sendimessage), PHP (Composer: sendimessage/sdk), and Go (github.com/sendimessage/sendimessage-go). Every SDK is dependency-free and covers the full public API surface.
Security considerations
- Load the API key pair from the environment — never commit it or embed it in client-side code.
- Verify webhook signatures before processing events.
- Log message handles, not message bodies, in shared logs.
Frequently asked questions
Is there an official Bash / Shell SDK for SendiMessage?
What does the API return when I send a message?
Can I send iMessage from Bash / Shell?
Related integrations
Ready to connect Bash / Shell?
Request a messaging line and a SendiMessage integration specialist will review your Bash / Shell workflow and guide the setup.