@sendblue/cli 0.5.0 → 0.5.1

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.
@@ -13,7 +13,7 @@ export async function sendCommand(number, message) {
13
13
  const normalized = normalizeNumber(number);
14
14
  const spinner = ora({ text: `Sending to ${normalized}...`, indent: 2 }).start();
15
15
  try {
16
- const result = await sendMessage(creds.apiKey, creds.apiSecret, normalized, message);
16
+ const result = await sendMessage(creds.apiKey, creds.apiSecret, normalized, message, creds.assignedNumber);
17
17
  spinner.succeed(`Message sent to ${normalized}`);
18
18
  if (result.messageId) {
19
19
  console.log(chalk.dim(` Message ID: ${result.messageId}`));
package/dist/lib/api.d.ts CHANGED
@@ -22,7 +22,7 @@ interface AccountResponse {
22
22
  export declare function sendCode(email: string): Promise<void>;
23
23
  export declare function verifySetup(email: string, code: string, companyName: string): Promise<SetupResponse>;
24
24
  export declare function verifyLogin(email: string, code: string): Promise<SetupResponse>;
25
- export declare function sendMessage(apiKey: string, apiSecret: string, number: string, content: string): Promise<SendMessageResponse>;
25
+ export declare function sendMessage(apiKey: string, apiSecret: string, number: string, content: string, fromNumber?: string): Promise<SendMessageResponse>;
26
26
  export declare function getAccount(apiKey: string, apiSecret: string): Promise<AccountResponse>;
27
27
  interface ContactRoute {
28
28
  id: number;
package/dist/lib/api.js CHANGED
@@ -35,7 +35,10 @@ export async function verifyLogin(email, code) {
35
35
  }
36
36
  return res.json();
37
37
  }
38
- export async function sendMessage(apiKey, apiSecret, number, content) {
38
+ export async function sendMessage(apiKey, apiSecret, number, content, fromNumber) {
39
+ const body = { number, content };
40
+ if (fromNumber)
41
+ body.from_number = fromNumber;
39
42
  const res = await fetch(`${API_BASE}/api/send-message`, {
40
43
  method: 'POST',
41
44
  headers: {
@@ -43,7 +46,7 @@ export async function sendMessage(apiKey, apiSecret, number, content) {
43
46
  'sb-api-key-id': apiKey,
44
47
  'sb-api-secret-key': apiSecret
45
48
  },
46
- body: JSON.stringify({ number, content })
49
+ body: JSON.stringify(body)
47
50
  });
48
51
  if (!res.ok) {
49
52
  const body = await res.json().catch(() => ({}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sendblue/cli",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Sendblue CLI — iMessage numbers for agents",
5
5
  "type": "module",
6
6
  "bin": {