Nexmo / nexmo-cli

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

Verify interactive example #148

Open tommorris opened 6 years ago

tommorris commented 6 years ago

It'd be useful to have an interactive example for Verify built into the CLI.

Something like this:

$ nexmo verify:example

What number would you like to verify?
> +44 207 1234567
Which language? [default: en-us]
> en-gb
What brand? [default: MyApp]
> Steve's Dog Treats

Verify request sent
{{ copy of HTTP request/response }}

Type in the code you have just received by SMS.
Type 's' or 'skip' to skip to next verification event.
Type 'c' or 'cancel' to cancel verification.
> 1234
CORRECT
{{ copy of HTTP request/response }}

Cost of transaction: €0.10

Or if they chose to skip.

> skip
Skipping to phone call.

{{ copy of HTTP request/response }}

> cancel
Cancelling reuqest.
{{ copy of HTTP request/response }}

The purpose of this is to enable developers to more easily test the Verify API to see if it matches the needs of the developer (or their employer etc.).

sammachin commented 6 years ago

Seems like a good idea but it shouldn't be interactive, the rest of the CLI isn't and its designed as an admin tool rather than a testing tool.

But having several commands for each stage seems like a good idea so nexmo verify:start [NUMBER] [BRAND] - returns the ID nexmo verify:code [ID] [CODE] - checks the code against the ID and returns pass/fail nexmo verify:skip [ID] - skips the next stage nexmo verify:cancel [ID - cancels the verification

This wasy is more in keeping with the rest of the CLI and allows you to use a single part of the CLI with a verify request that may be made outside the CLI, for example I just want to cancel a request that my code sent and I have the ID