CLI - HomeMadePy/messages GitHub Wiki
Messages is capable of being used in scripts, programs, as well as via the command line.
CLI
Invoking the help option, you can see the list of available commands.
$ messages --help
Usage: messages [OPTIONS] COMMAND [ARGS]...
See available commands below to create appropriate message.
Options:
--version Show the version and exit.
--help Show this message and exit.
Commands:
configure Configure profiles for the given message...
email Send email message.
slackpost Send SlackPost message.
slackwebhook Send SlackWebhook message.
telegram Send TelegramBot message.
twilio Send twilio text message.
whatsapp Send WhatsApp text message via the Twilio...
Commands
In order to see which options are available for each message type, see the following example:
$ messages email --help
Usage: messages email [OPTIONS] [PROFILE] [BODY]
Send email message.
* PROFILE: Pre-configured user profile.
* BODY: message body text.
Options:
-f, --from TEXT Originating (from) email address
-t, --to TEXT Recipient email addresses.
-c, --carboncopy TEXT Carbon Copy (CC) email addresses.
-b, --blindcopy TEXT Blind Carbon Copy (BCC) email addresses.
-s, --subject TEXT Subject line.
-m, --file TEXT Read message body from filepath.
-a, --attach TEXT Attachments -- filepath to attach.
-S, --save Save default values in current profile.
-P, --profile TEXT Specify pre-configured user profile.
-V, --verbose Display verbose output and debug information.
--help Show this message and exit.
Recommended Use
To get the most out of the CLI, it is best to configure a specific profile via the configure command. See the CLI Example to learn how to configure via the command line.
After Configuration
One only needs to provide a minimal set of arguments to send a message via the command line once a profile is configured.
$ messages email myProfileName "See the attached file" \
> -t [email protected] \
> -s "Test" \
> -a ~/docs/file.pdf \
> -V
Debugging info
--------------
2018-Aug-03 19:31:30 Message created.
2018-Aug-03 19:31:32 Login successful.
2018-Aug-03 19:31:34 Logged out.
2018-Aug-03 19:31:34 Email info:
* Server: smtp.here.com:465
* From: [email protected]
* To: ['[email protected]']
* Cc: None
* Bcc: None
* Subject: Test
* Body: See the attached file...
* Attachments: ['~/docs/file.pdf']
Message sent.
Text
$ messages twilio myProfileName "BTC price is below $7000, buy now!" \
> -t +19998675309 \
> -V
Debugging info
--------------
2018-Aug-03 19:34:52 Message created.
2018-Aug-03 19:34:54 Twilio info:
* From: +15556667777
* To: ['+19998675309']
* Body: BTC price is below $7000, buy now!...
* Attachments: None
* SID: SM5105201dd97cd532ef679
Message sent.