Nexmo / nexmo-cli

Nexmo CLI (Command Line Interface)
https://nexmo.com
MIT License
78 stars 52 forks source link

Add SMS sending #78

Closed cbetta closed 8 years ago

cbetta commented 8 years ago

Adds sending of an SMS. Only implements the basics to keep things simple. It auto detects if a from sender has been given and if not uses Nexmo CLI as the from field.

> nexmo sms <destination_number> "Hello world!" --confirm
Message sent to:   <destination_number>
Remaining balance: 26.80110000 EUR
Message price:     0.03330000 EUR

> nexmo sms <from_name_or_number> <destination_number> "Hello world!" --confirm
Message sent to:   <destination_number>
Remaining balance: 26.80110000 EUR
Message price:     0.03330000 EUR

Closes #17

cbetta commented 8 years ago

Based on feedback from @leggetter the syntax has changed to:

> nexmo sms <destination_number> Hello world! --confirm
Message sent to:   <destination_number>
Remaining balance: 26.80110000 EUR
Message price:     0.03330000 EUR

> nexmo sms  <destination_number> Hello world! --from "Acme Inc" --confirm
Message sent to:   <destination_number>
Remaining balance: 26.80110000 EUR
Message price:     0.03330000 EUR

This is mostly because the previous syntax was very error prone. CommanderJS doesn't really like variable arguments so it's better to just override the from with a flag.

I also made sure that the text field is now a variadic field, allowing us to capture Hello World without surrounding it in ".

sammachin commented 8 years ago

Alphanumeric Senders don't support spaces anyway, just testing on the API with the python lib whatspace is removed from the sender somewhere along the line Sam Machin became SamMachin at the handset