CLI
Tim Phillips edited this page Nov 15, 2018
·
15 revisions
Messages is capable of being used in scripts, programs, as well as via the command line.
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...
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.
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.
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 you@there.com \
> -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: yourEmail@here.com
* To: ['you@there.com']
* Cc: None
* Bcc: None
* Subject: Test
* Body: See the attached file...
* Attachments: ['~/docs/file.pdf']
Message sent.
$ 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.
- About
- Contributing Code
- TODO List
- Architecture & Design
- Installation
- Usage
- Message Types: