Send SMS, make voice calls, look up phone numbers, and more — via the seven API.
- Elixir ~> 1.14
- A seven account with API key (How to get your API key)
Add the package to your mix.exs dependencies:
def deps do
[{:seven_io, "~> 0.1"}]
endThen fetch dependencies:
mix deps.get# Set your API key (or use the SEVEN_API_KEY environment variable)
Application.put_env(:seven_io, :api_key, "YOUR_API_KEY")
# Check your balance
Seven.Balance.get!()
# Send an SMS
Seven.Sms.post!(%{
text: "Hello from seven!",
to: "+491234567890"
})Seven.Sms.post!(%{
text: "Hello from seven!",
to: "+491234567890"
})Seven.Voice.post!(%{
text: "Hello, this is a test call from seven.",
to: "+491234567890"
})Seven.Lookup.post!(%{
number: "+491234567890",
type: "mnp"
})Seven.Balance.get!()| Feature | Module | Description |
|---|---|---|
| SMS | Seven.Sms |
Send and manage SMS messages |
| Voice | Seven.Voice |
Text-to-speech voice calls |
| Lookup | Seven.Lookup |
Phone number lookups (HLR, CNAM, MNP, Format) |
| Contacts | Seven.Contacts |
Manage address book contacts |
| Hooks | Seven.Hooks |
Manage webhooks |
| Balance | Seven.Balance |
Retrieve account balance |
| Analytics | Seven.Analytics |
Retrieve account analytics |
| Journal | Seven.Journal |
Retrieve message journal |
| Pricing | Seven.Pricing |
Retrieve pricing information |
| Status | Seven.Status |
Retrieve message delivery status |
| ValidateForVoice | Seven.ValidateForVoice |
Validate phone numbers for voice calls |
| Subaccounts | Seven.Subaccounts |
Manage subaccounts |
All modules follow a consistent pattern with two variants:
# Returns {:ok, result} or {:error, reason}
Seven.Sms.post(%{text: "Hi", to: "+49..."})
# Returns the result directly or raises on error
Seven.Sms.post!(%{text: "Hi", to: "+49..."})Need help? Feel free to contact us or open an issue.