@getdial/cli 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +1 -3
- package/dist/commands/send.js +1 -5
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -106,16 +106,14 @@ numbers
|
|
|
106
106
|
})));
|
|
107
107
|
program
|
|
108
108
|
.command("send")
|
|
109
|
-
.description("Send an SMS
|
|
109
|
+
.description("Send an SMS. POST /api/v1/messages.")
|
|
110
110
|
.requiredOption("--to <e164>", "destination phone number, E.164 (e.g. +14155551234)")
|
|
111
111
|
.requiredOption("--body <text>", "message body")
|
|
112
|
-
.option("--channel <sms|whatsapp>", "channel to send on", "sms")
|
|
113
112
|
.option("--from-number-id <id>", "phone_number_id to send from (defaults to onboard's number)")
|
|
114
113
|
.option("--json", "machine-readable output")
|
|
115
114
|
.action(async (opts) => process.exit(await runSend({
|
|
116
115
|
to: opts.to,
|
|
117
116
|
body: opts.body,
|
|
118
|
-
channel: opts.channel,
|
|
119
117
|
fromNumberId: opts.fromNumberId,
|
|
120
118
|
json: !!opts.json,
|
|
121
119
|
})));
|
package/dist/commands/send.js
CHANGED
|
@@ -11,11 +11,7 @@ export async function runSend(opts) {
|
|
|
11
11
|
fail(opts.json, "no_from_number", "No default phone_number_id in auth. Pass --from-number-id <id>.");
|
|
12
12
|
return 1;
|
|
13
13
|
}
|
|
14
|
-
|
|
15
|
-
fail(opts.json, "bad_channel", `--channel must be sms or whatsapp, got "${opts.channel}".`);
|
|
16
|
-
return 1;
|
|
17
|
-
}
|
|
18
|
-
const res = await apiPost("/api/v1/messages", { to: opts.to, body: opts.body, channel: opts.channel, from_number_id: fromNumberId }, auth.api_key);
|
|
14
|
+
const res = await apiPost("/api/v1/messages", { to: opts.to, body: opts.body, channel: "sms", from_number_id: fromNumberId }, auth.api_key);
|
|
19
15
|
if (!res.ok) {
|
|
20
16
|
fail(opts.json, "send_failed", res.error, { status: res.status });
|
|
21
17
|
return 2;
|