@kapso/cli
Advanced tools
| export declare const conversationStatusOptions: readonly ["active", "ended"]; | ||
| export declare const messageDirectionOptions: readonly ["inbound", "outbound"]; | ||
| export declare const messageStatusOptions: readonly ["pending", "sent", "delivered", "read", "failed"]; | ||
| export declare const templateCategoryOptions: readonly ["MARKETING", "UTILITY", "AUTHENTICATION"]; | ||
| export declare const templateStatusOptions: readonly ["APPROVED", "PENDING", "REJECTED", "PAUSED", "IN_APPEAL", "DISABLED"]; |
| export const conversationStatusOptions = ['active', 'ended']; | ||
| export const messageDirectionOptions = ['inbound', 'outbound']; | ||
| export const messageStatusOptions = ['pending', 'sent', 'delivered', 'read', 'failed']; | ||
| export const templateCategoryOptions = ['MARKETING', 'UTILITY', 'AUTHENTICATION']; | ||
| export const templateStatusOptions = ['APPROVED', 'PENDING', 'REJECTED', 'PAUSED', 'IN_APPEAL', 'DISABLED']; |
@@ -25,2 +25,6 @@ import { Command } from '@oclif/core'; | ||
| export declare const projectFlag: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>; | ||
| export declare function createPhoneNumberIdFlag(options?: { | ||
| required?: boolean; | ||
| }): import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>; | ||
| export declare const phoneNumberFlag: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>; | ||
| export declare abstract class BaseCommand extends Command { | ||
@@ -32,2 +36,3 @@ protected readonly tokenStore: TokenStore; | ||
| protected readonly projectContext: ProjectContextService; | ||
| protected exitSilently(code?: number): never; | ||
| protected fail(error: unknown): never; | ||
@@ -39,2 +44,7 @@ protected requireAuthenticated(): Promise<TokenVerifyResponse>; | ||
| }): Promise<ResolvedProjectSelection>; | ||
| protected resolveWhatsAppPhoneNumberId(projectId: string, options: { | ||
| conversationId?: string; | ||
| phoneNumber?: string; | ||
| phoneNumberId?: string; | ||
| }): Promise<string>; | ||
| } |
+27
-0
@@ -20,2 +20,11 @@ import { Command, Flags } from '@oclif/core'; | ||
| }); | ||
| export function createPhoneNumberIdFlag(options = {}) { | ||
| return Flags.string({ | ||
| description: 'WhatsApp phone number ID (Meta internal ID). If you have the real number instead, use "--phone-number".', | ||
| required: options.required ?? false, | ||
| }); | ||
| } | ||
| export const phoneNumberFlag = Flags.string({ | ||
| description: 'WhatsApp display phone number (resolved to a phone number ID)', | ||
| }); | ||
| export class BaseCommand extends Command { | ||
@@ -27,4 +36,19 @@ tokenStore = new TokenStore(); | ||
| projectContext = new ProjectContextService(this.tokenStore, this.contextStore, this.cliApi); | ||
| exitSilently(code = 1) { | ||
| const error = new Error('silent exit'); | ||
| Object.assign(error, { | ||
| exitCode: code, | ||
| oclif: { exit: code }, | ||
| skipOclifErrorHandling: true, | ||
| }); | ||
| throw error; | ||
| } | ||
| fail(error) { | ||
| if (error instanceof ApiHttpError) { | ||
| if (error.message === 'server_error') { | ||
| return this.error('Request failed with server_error. Check "--help" for valid flag values and confirm your identifiers are correct.'); | ||
| } | ||
| if (error.message === 'WhatsApp configuration not found') { | ||
| return this.error('WhatsApp number not found. You may have passed a display phone number instead of a Meta phone number ID. Retry with "--phone-number <display-number>" or run "kapso whatsapp numbers list".'); | ||
| } | ||
| return this.error(error.message); | ||
@@ -97,2 +121,5 @@ } | ||
| } | ||
| async resolveWhatsAppPhoneNumberId(projectId, options) { | ||
| return this.projectContext.resolvePhoneNumberId(projectId, options); | ||
| } | ||
| } |
@@ -7,3 +7,3 @@ import { Flags } from '@oclif/core'; | ||
| export default class Setup extends BaseCommand { | ||
| static description = 'Set up Kapso for a WhatsApp number'; | ||
| static description = 'Guided first-time setup for Kapso and a WhatsApp number'; | ||
| static flags = { | ||
@@ -44,3 +44,3 @@ 'area-code': Flags.string({ | ||
| if (payload.data.kind === 'blocked') { | ||
| this.exit(1); | ||
| this.exitSilently(1); | ||
| } | ||
@@ -47,0 +47,0 @@ } |
| import { Flags } from '@oclif/core'; | ||
| import { BaseCommand, outputFlag, projectFlag } from '../../../base-command.js'; | ||
| import { renderData } from '../../../utilities/output.js'; | ||
| import { conversationStatusOptions } from '../../../utilities/whatsapp-enums.js'; | ||
| export default class WhatsappConversationsList extends BaseCommand { | ||
@@ -26,2 +27,3 @@ static description = 'List WhatsApp conversations in the current project'; | ||
| description: 'Filter by conversation status', | ||
| options: [...conversationStatusOptions], | ||
| }), | ||
@@ -28,0 +30,0 @@ unassigned: Flags.boolean({ |
@@ -9,2 +9,3 @@ import { BaseCommand } from '../../../base-command.js'; | ||
| output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>; | ||
| 'phone-number': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>; | ||
| 'phone-number-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>; | ||
@@ -11,0 +12,0 @@ project: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>; |
@@ -1,3 +0,3 @@ | ||
| import { Args, Flags } from '@oclif/core'; | ||
| import { BaseCommand, outputFlag, projectFlag } from '../../../base-command.js'; | ||
| import { Args } from '@oclif/core'; | ||
| import { BaseCommand, createPhoneNumberIdFlag, outputFlag, phoneNumberFlag, projectFlag, } from '../../../base-command.js'; | ||
| import { renderData } from '../../../utilities/output.js'; | ||
@@ -14,6 +14,4 @@ export default class WhatsappMessagesGet extends BaseCommand { | ||
| output: outputFlag, | ||
| 'phone-number-id': Flags.string({ | ||
| description: 'WhatsApp phone number ID (Meta internal ID)', | ||
| required: true, | ||
| }), | ||
| 'phone-number': phoneNumberFlag, | ||
| 'phone-number-id': createPhoneNumberIdFlag(), | ||
| project: projectFlag, | ||
@@ -25,5 +23,9 @@ }; | ||
| const projectId = await this.requireAuthenticatedProjectId(flags.project); | ||
| const phoneNumberId = await this.resolveWhatsAppPhoneNumberId(projectId, { | ||
| phoneNumber: flags['phone-number'], | ||
| phoneNumberId: flags['phone-number-id'], | ||
| }); | ||
| const response = await this.projectContext.withWhatsAppClient(projectId, (client) => client.messages.get({ | ||
| messageId: args.messageId, | ||
| phoneNumberId: flags['phone-number-id'], | ||
| phoneNumberId, | ||
| })); | ||
@@ -30,0 +32,0 @@ renderData(this, response, flags.output, () => JSON.stringify(response, null, 2)); |
@@ -11,2 +11,3 @@ import { BaseCommand } from '../../../base-command.js'; | ||
| output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>; | ||
| 'phone-number': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>; | ||
| 'phone-number-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>; | ||
@@ -13,0 +14,0 @@ project: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>; |
| import { Flags } from '@oclif/core'; | ||
| import { BaseCommand, outputFlag, projectFlag } from '../../../base-command.js'; | ||
| import { BaseCommand, createPhoneNumberIdFlag, outputFlag, phoneNumberFlag, projectFlag, } from '../../../base-command.js'; | ||
| import { renderData } from '../../../utilities/output.js'; | ||
| import { messageDirectionOptions, messageStatusOptions } from '../../../utilities/whatsapp-enums.js'; | ||
| export default class WhatsappMessagesList extends BaseCommand { | ||
@@ -14,6 +15,7 @@ static description = 'List WhatsApp messages in the current project'; | ||
| conversation: Flags.string({ | ||
| description: 'Filter by conversation ID', | ||
| description: 'Filter by conversation ID. If no WhatsApp number is provided, it is resolved from the conversation.', | ||
| }), | ||
| direction: Flags.string({ | ||
| description: 'Filter by direction', | ||
| options: [...messageDirectionOptions], | ||
| }), | ||
@@ -24,6 +26,4 @@ limit: Flags.integer({ | ||
| output: outputFlag, | ||
| 'phone-number-id': Flags.string({ | ||
| description: 'WhatsApp phone number ID (Meta internal ID)', | ||
| required: true, | ||
| }), | ||
| 'phone-number': phoneNumberFlag, | ||
| 'phone-number-id': createPhoneNumberIdFlag(), | ||
| project: projectFlag, | ||
@@ -35,2 +35,3 @@ since: Flags.string({ | ||
| description: 'Filter by message status', | ||
| options: [...messageStatusOptions], | ||
| }), | ||
@@ -45,2 +46,7 @@ until: Flags.string({ | ||
| const projectId = await this.requireAuthenticatedProjectId(flags.project); | ||
| const phoneNumberId = await this.resolveWhatsAppPhoneNumberId(projectId, { | ||
| conversationId: flags.conversation, | ||
| phoneNumber: flags['phone-number'], | ||
| phoneNumberId: flags['phone-number-id'], | ||
| }); | ||
| const response = await this.projectContext.withWhatsAppClient(projectId, (client) => client.messages.query({ | ||
@@ -52,3 +58,3 @@ after: flags.after, | ||
| limit: flags.limit, | ||
| phoneNumberId: flags['phone-number-id'], | ||
| phoneNumberId, | ||
| since: flags.since, | ||
@@ -55,0 +61,0 @@ status: flags.status, |
@@ -7,2 +7,3 @@ import { BaseCommand } from '../../../base-command.js'; | ||
| output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>; | ||
| 'phone-number': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>; | ||
| 'phone-number-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>; | ||
@@ -9,0 +10,0 @@ project: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>; |
| import { Flags } from '@oclif/core'; | ||
| import { BaseCommand, outputFlag, projectFlag } from '../../../base-command.js'; | ||
| import { BaseCommand, createPhoneNumberIdFlag, outputFlag, phoneNumberFlag, projectFlag, } from '../../../base-command.js'; | ||
| import { readJsonInput } from '../../../utilities/input.js'; | ||
@@ -12,6 +12,4 @@ import { renderData, renderKeyValueBlock } from '../../../utilities/output.js'; | ||
| output: outputFlag, | ||
| 'phone-number-id': Flags.string({ | ||
| description: 'WhatsApp phone number ID (Meta internal ID)', | ||
| required: true, | ||
| }), | ||
| 'phone-number': phoneNumberFlag, | ||
| 'phone-number-id': createPhoneNumberIdFlag(), | ||
| project: projectFlag, | ||
@@ -33,2 +31,6 @@ stdin: Flags.boolean({ | ||
| const projectId = await this.requireAuthenticatedProjectId(flags.project); | ||
| const phoneNumberId = await this.resolveWhatsAppPhoneNumberId(projectId, { | ||
| phoneNumber: flags['phone-number'], | ||
| phoneNumberId: flags['phone-number-id'], | ||
| }); | ||
| const response = await this.projectContext.withWhatsAppClient(projectId, async (client) => { | ||
@@ -41,3 +43,3 @@ if (flags.text || flags.to) { | ||
| body: flags.text, | ||
| phoneNumberId: flags['phone-number-id'], | ||
| phoneNumberId, | ||
| to: flags.to, | ||
@@ -53,3 +55,3 @@ }); | ||
| payload, | ||
| phoneNumberId: flags['phone-number-id'], | ||
| phoneNumberId, | ||
| }); | ||
@@ -59,3 +61,3 @@ }); | ||
| ['Messaging Product', response.messagingProduct], | ||
| ['Phone Number ID', flags['phone-number-id']], | ||
| ['Phone Number ID', phoneNumberId], | ||
| ['Recipient', flags.to ?? undefined], | ||
@@ -62,0 +64,0 @@ ['Message IDs', response.messages.map((message) => message.id).join(', ')], |
| import { BaseCommand } from '../../../base-command.js'; | ||
| export default class WhatsappNumbersGet extends BaseCommand { | ||
| static args: { | ||
| phoneNumberId: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>; | ||
| numberRef: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>; | ||
| }; | ||
@@ -6,0 +6,0 @@ static description: string; |
@@ -6,8 +6,8 @@ import { Args } from '@oclif/core'; | ||
| static args = { | ||
| phoneNumberId: Args.string({ | ||
| description: 'WhatsApp phone number ID', | ||
| numberRef: Args.string({ | ||
| description: 'WhatsApp phone number ID or display phone number', | ||
| required: true, | ||
| }), | ||
| }; | ||
| static description = 'Get a WhatsApp number by phone number ID'; | ||
| static description = 'Get a WhatsApp number by Meta ID or display phone number'; | ||
| static flags = { | ||
@@ -21,3 +21,6 @@ output: outputFlag, | ||
| const projectId = await this.requireAuthenticatedProjectId(flags.project); | ||
| const response = await this.projectContext.withPlatformClient(projectId, (client) => client.getWhatsappNumber(args.phoneNumberId)); | ||
| const phoneNumberId = await this.resolveWhatsAppPhoneNumberId(projectId, { | ||
| phoneNumberId: args.numberRef, | ||
| }); | ||
| const response = await this.projectContext.withPlatformClient(projectId, (client) => client.getWhatsappNumber(phoneNumberId)); | ||
| renderData(this, response, flags.output, () => renderKeyValueBlock([ | ||
@@ -24,0 +27,0 @@ ['ID', response.data.id], |
| import { BaseCommand } from '../../../base-command.js'; | ||
| export default class WhatsappNumbersHealth extends BaseCommand { | ||
| static args: { | ||
| phoneNumberId: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>; | ||
| numberRef: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>; | ||
| }; | ||
@@ -6,0 +6,0 @@ static description: string; |
@@ -6,4 +6,4 @@ import { Args } from '@oclif/core'; | ||
| static args = { | ||
| phoneNumberId: Args.string({ | ||
| description: 'WhatsApp phone number ID', | ||
| numberRef: Args.string({ | ||
| description: 'WhatsApp phone number ID or display phone number', | ||
| required: true, | ||
@@ -21,7 +21,10 @@ }), | ||
| const projectId = await this.requireAuthenticatedProjectId(flags.project); | ||
| const response = await this.projectContext.withPlatformClient(projectId, (client) => client.getWhatsappNumberHealth(args.phoneNumberId)); | ||
| const phoneNumberId = await this.resolveWhatsAppPhoneNumberId(projectId, { | ||
| phoneNumberId: args.numberRef, | ||
| }); | ||
| const response = await this.projectContext.withPlatformClient(projectId, (client) => client.getWhatsappNumberHealth(phoneNumberId)); | ||
| const checks = toRecord(response.checks); | ||
| const messagingHealth = toRecord(checks?.messagingHealth); | ||
| renderData(this, response, flags.output, () => renderKeyValueBlock([ | ||
| ['Phone Number ID', args.phoneNumberId], | ||
| ['Phone Number ID', phoneNumberId], | ||
| ['Status', stringValue(response.status)], | ||
@@ -28,0 +31,0 @@ ['Timestamp', stringValue(response.timestamp)], |
@@ -5,3 +5,3 @@ import { Flags } from '@oclif/core'; | ||
| export default class WhatsappNumbersNew extends BaseCommand { | ||
| static description = 'Start WhatsApp number setup'; | ||
| static description = 'Create a WhatsApp setup link in the current project'; | ||
| static flags = { | ||
@@ -8,0 +8,0 @@ 'area-code': Flags.string({ |
@@ -9,2 +9,3 @@ import { BaseCommand } from '../../../base-command.js'; | ||
| output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>; | ||
| 'phone-number': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>; | ||
| 'phone-number-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>; | ||
@@ -11,0 +12,0 @@ project: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>; |
@@ -1,3 +0,3 @@ | ||
| import { Args, Flags } from '@oclif/core'; | ||
| import { BaseCommand, outputFlag, projectFlag } from '../../../base-command.js'; | ||
| import { Args } from '@oclif/core'; | ||
| import { BaseCommand, createPhoneNumberIdFlag, outputFlag, phoneNumberFlag, projectFlag, } from '../../../base-command.js'; | ||
| import { renderData, renderKeyValueBlock } from '../../../utilities/output.js'; | ||
@@ -14,6 +14,4 @@ export default class WhatsappTemplatesGet extends BaseCommand { | ||
| output: outputFlag, | ||
| 'phone-number-id': Flags.string({ | ||
| description: 'WhatsApp phone number ID (Meta internal ID)', | ||
| required: true, | ||
| }), | ||
| 'phone-number': phoneNumberFlag, | ||
| 'phone-number-id': createPhoneNumberIdFlag(), | ||
| project: projectFlag, | ||
@@ -25,3 +23,7 @@ }; | ||
| const projectId = await this.requireAuthenticatedProjectId(flags.project); | ||
| const businessAccountId = await this.projectContext.resolveBusinessAccountId(projectId, flags['phone-number-id']); | ||
| const phoneNumberId = await this.resolveWhatsAppPhoneNumberId(projectId, { | ||
| phoneNumber: flags['phone-number'], | ||
| phoneNumberId: flags['phone-number-id'], | ||
| }); | ||
| const businessAccountId = await this.projectContext.resolveBusinessAccountId(projectId, phoneNumberId); | ||
| const response = await this.projectContext.withWhatsAppClient(projectId, (client) => client.templates.get({ | ||
@@ -28,0 +30,0 @@ businessAccountId, |
@@ -12,2 +12,3 @@ import { BaseCommand } from '../../../base-command.js'; | ||
| output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>; | ||
| 'phone-number': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>; | ||
| 'phone-number-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>; | ||
@@ -14,0 +15,0 @@ project: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>; |
| import { Flags } from '@oclif/core'; | ||
| import { BaseCommand, outputFlag, projectFlag } from '../../../base-command.js'; | ||
| import { BaseCommand, createPhoneNumberIdFlag, outputFlag, phoneNumberFlag, projectFlag, } from '../../../base-command.js'; | ||
| import { renderData } from '../../../utilities/output.js'; | ||
| import { templateCategoryOptions, templateStatusOptions } from '../../../utilities/whatsapp-enums.js'; | ||
| export default class WhatsappTemplatesList extends BaseCommand { | ||
@@ -15,2 +16,3 @@ static description = 'List WhatsApp templates for a number'; | ||
| description: 'Filter by template category', | ||
| options: [...templateCategoryOptions], | ||
| }), | ||
@@ -27,9 +29,8 @@ language: Flags.string({ | ||
| output: outputFlag, | ||
| 'phone-number-id': Flags.string({ | ||
| description: 'WhatsApp phone number ID (Meta internal ID)', | ||
| required: true, | ||
| }), | ||
| 'phone-number': phoneNumberFlag, | ||
| 'phone-number-id': createPhoneNumberIdFlag(), | ||
| project: projectFlag, | ||
| status: Flags.string({ | ||
| description: 'Filter by template status', | ||
| options: [...templateStatusOptions], | ||
| }), | ||
@@ -41,3 +42,7 @@ }; | ||
| const projectId = await this.requireAuthenticatedProjectId(flags.project); | ||
| const businessAccountId = await this.projectContext.resolveBusinessAccountId(projectId, flags['phone-number-id']); | ||
| const phoneNumberId = await this.resolveWhatsAppPhoneNumberId(projectId, { | ||
| phoneNumber: flags['phone-number'], | ||
| phoneNumberId: flags['phone-number-id'], | ||
| }); | ||
| const businessAccountId = await this.projectContext.resolveBusinessAccountId(projectId, phoneNumberId); | ||
| const response = await this.projectContext.withWhatsAppClient(projectId, (client) => client.templates.list({ | ||
@@ -44,0 +49,0 @@ after: flags.after, |
@@ -7,2 +7,3 @@ import { BaseCommand } from '../../../base-command.js'; | ||
| output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>; | ||
| 'phone-number': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>; | ||
| 'phone-number-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>; | ||
@@ -9,0 +10,0 @@ project: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>; |
| import { Flags } from '@oclif/core'; | ||
| import { BaseCommand, outputFlag, projectFlag } from '../../../base-command.js'; | ||
| import { BaseCommand, createPhoneNumberIdFlag, outputFlag, phoneNumberFlag, projectFlag, } from '../../../base-command.js'; | ||
| import { readJsonInput } from '../../../utilities/input.js'; | ||
| import { renderData, renderKeyValueBlock } from '../../../utilities/output.js'; | ||
| import { templateCategoryOptions } from '../../../utilities/whatsapp-enums.js'; | ||
| export default class WhatsappTemplatesNew extends BaseCommand { | ||
@@ -12,6 +13,4 @@ static description = 'Create a WhatsApp template for a number'; | ||
| output: outputFlag, | ||
| 'phone-number-id': Flags.string({ | ||
| description: 'WhatsApp phone number ID (Meta internal ID)', | ||
| required: true, | ||
| }), | ||
| 'phone-number': phoneNumberFlag, | ||
| 'phone-number-id': createPhoneNumberIdFlag(), | ||
| project: projectFlag, | ||
@@ -27,3 +26,7 @@ stdin: Flags.boolean({ | ||
| const projectId = await this.requireAuthenticatedProjectId(flags.project); | ||
| const businessAccountId = await this.projectContext.resolveBusinessAccountId(projectId, flags['phone-number-id']); | ||
| const phoneNumberId = await this.resolveWhatsAppPhoneNumberId(projectId, { | ||
| phoneNumber: flags['phone-number'], | ||
| phoneNumberId: flags['phone-number-id'], | ||
| }); | ||
| const businessAccountId = await this.projectContext.resolveBusinessAccountId(projectId, phoneNumberId); | ||
| const rawInput = await readJsonInput({ | ||
@@ -66,2 +69,5 @@ inputPath: flags.input, | ||
| } | ||
| if (!templateCategoryOptions.includes(candidate.category)) { | ||
| throw new Error(`Template payload category must be one of: ${templateCategoryOptions.join(', ')}.`); | ||
| } | ||
| if (!Array.isArray(candidate.components) || candidate.components.length === 0) { | ||
@@ -68,0 +74,0 @@ throw new Error('Template payload must include a non-empty "components" array.'); |
@@ -16,2 +16,3 @@ import { WhatsAppClient } from '@kapso/whatsapp-cloud-api'; | ||
| inferCustomerId(projectId: string, explicitCustomerId?: string): Promise<string>; | ||
| listAllWhatsAppNumbers(projectId: string): Promise<WhatsAppNumber[]>; | ||
| requireProjectId(explicitProjectId?: string): Promise<string>; | ||
@@ -30,2 +31,7 @@ resolveBusinessAccountId(projectId: string, phoneNumberId: string): Promise<string>; | ||
| }>; | ||
| resolvePhoneNumberId(projectId: string, options: { | ||
| conversationId?: string; | ||
| phoneNumber?: string; | ||
| phoneNumberId?: string; | ||
| }): Promise<string>; | ||
| setCurrentProject(projectId: string): Promise<CurrentProject>; | ||
@@ -35,4 +41,7 @@ withPlatformClient<T>(projectId: string, callback: (client: PlatformApiClient) => Promise<T>): Promise<T>; | ||
| private ensureProjectApiKey; | ||
| private fetchWhatsAppNumber; | ||
| private findWhatsAppNumbersByDisplayNumber; | ||
| private refreshProjectApiKey; | ||
| private resolvePhoneNumberIdByDisplayNumber; | ||
| private withRetry; | ||
| } |
@@ -24,4 +24,11 @@ import { GraphApiError, WhatsAppClient } from '@kapso/whatsapp-cloud-api'; | ||
| async getWhatsAppNumber(projectId, phoneNumberId) { | ||
| const response = await this.withPlatformClient(projectId, (client) => client.getWhatsappNumber(phoneNumberId)); | ||
| return response.data; | ||
| try { | ||
| return await this.fetchWhatsAppNumber(projectId, phoneNumberId); | ||
| } | ||
| catch (error) { | ||
| if (isApiNotFoundError(error)) { | ||
| throw new Error(`WhatsApp number "${phoneNumberId}" not found. Pass a Meta phone number ID or use "--phone-number <display-number>". Run "kapso whatsapp numbers list" to inspect available numbers.`); | ||
| } | ||
| throw error; | ||
| } | ||
| } | ||
@@ -38,2 +45,21 @@ async inferCustomerId(projectId, explicitCustomerId) { | ||
| } | ||
| async listAllWhatsAppNumbers(projectId) { | ||
| const numbers = []; | ||
| let page = 1; | ||
| while (true) { | ||
| // Pagination must happen sequentially because each request depends on the previous page. | ||
| // eslint-disable-next-line no-await-in-loop | ||
| const response = await this.withPlatformClient(projectId, (client) => client.listWhatsappNumbers({ | ||
| page, | ||
| perPage: 100, | ||
| })); | ||
| numbers.push(...response.data); | ||
| const totalPages = response.meta?.totalPages ?? page; | ||
| if (page >= totalPages || response.data.length === 0) { | ||
| break; | ||
| } | ||
| page += 1; | ||
| } | ||
| return numbers; | ||
| } | ||
| async requireProjectId(explicitProjectId) { | ||
@@ -87,2 +113,22 @@ if (explicitProjectId) { | ||
| } | ||
| async resolvePhoneNumberId(projectId, options) { | ||
| if (options.phoneNumberId) { | ||
| if (looksLikeDisplayPhoneNumber(options.phoneNumberId)) { | ||
| return this.resolvePhoneNumberIdByDisplayNumber(projectId, options.phoneNumberId); | ||
| } | ||
| return options.phoneNumberId; | ||
| } | ||
| if (options.phoneNumber) { | ||
| return this.resolvePhoneNumberIdByDisplayNumber(projectId, options.phoneNumber); | ||
| } | ||
| if (options.conversationId) { | ||
| const response = await this.withPlatformClient(projectId, (client) => client.getConversation(options.conversationId)); | ||
| const { phoneNumberId } = response.data; | ||
| if (!phoneNumberId) { | ||
| throw new Error(`Conversation "${options.conversationId}" is missing a phone number ID. Retry with "--phone-number-id" or "--phone-number".`); | ||
| } | ||
| return phoneNumberId; | ||
| } | ||
| throw new Error('A WhatsApp number is required. Pass "--phone-number-id <meta-id>" or "--phone-number <display-number>".'); | ||
| } | ||
| async setCurrentProject(projectId) { | ||
@@ -114,2 +160,21 @@ const project = await this.cliApi.getProject(projectId); | ||
| } | ||
| async fetchWhatsAppNumber(projectId, phoneNumberId) { | ||
| const response = await this.withPlatformClient(projectId, (client) => client.getWhatsappNumber(phoneNumberId)); | ||
| return response.data; | ||
| } | ||
| async findWhatsAppNumbersByDisplayNumber(projectId, input) { | ||
| const normalizedInput = normalizePhoneNumber(input); | ||
| const trimmedInput = input.trim(); | ||
| const numbers = await this.listAllWhatsAppNumbers(projectId); | ||
| return numbers.filter((number) => { | ||
| const displayPhoneNumber = number.displayPhoneNumber?.trim(); | ||
| if (!displayPhoneNumber) { | ||
| return false; | ||
| } | ||
| if (displayPhoneNumber === trimmedInput) { | ||
| return true; | ||
| } | ||
| return normalizePhoneNumber(displayPhoneNumber) === normalizedInput; | ||
| }); | ||
| } | ||
| async refreshProjectApiKey(projectId) { | ||
@@ -120,2 +185,15 @@ const apiKey = await this.cliApi.generateProjectApiKey(projectId); | ||
| } | ||
| async resolvePhoneNumberIdByDisplayNumber(projectId, input) { | ||
| const matches = await this.findWhatsAppNumbersByDisplayNumber(projectId, input); | ||
| if (matches.length === 1) { | ||
| return matches[0].phoneNumberId; | ||
| } | ||
| if (matches.length === 0) { | ||
| throw new Error(`WhatsApp number "${input}" not found. Run "kapso whatsapp numbers list" and retry with "--phone-number-id" or "--phone-number".`); | ||
| } | ||
| const details = matches | ||
| .map((number) => `- ${number.displayPhoneNumber ?? 'unknown'} phone_number_id=${number.phoneNumberId}`) | ||
| .join('\n'); | ||
| throw new Error(`Multiple WhatsApp numbers matched "${input}". Retry with "--phone-number-id <meta-id>".\n${details}`); | ||
| } | ||
| async withRetry(projectId, callback) { | ||
@@ -144,1 +222,10 @@ let apiKey = await this.ensureProjectApiKey(projectId); | ||
| } | ||
| function isApiNotFoundError(error) { | ||
| return error instanceof ApiHttpError && error.status === 404; | ||
| } | ||
| function normalizePhoneNumber(input) { | ||
| return input.replaceAll(/\D+/g, ''); | ||
| } | ||
| function looksLikeDisplayPhoneNumber(input) { | ||
| return /[+\s()-]/.test(input); | ||
| } |
+93
-23
@@ -50,3 +50,3 @@ { | ||
| "args": {}, | ||
| "description": "Set up Kapso for a WhatsApp number", | ||
| "description": "Guided first-time setup for Kapso and a WhatsApp number", | ||
| "flags": { | ||
@@ -517,2 +517,6 @@ "area-code": { | ||
| "multiple": false, | ||
| "options": [ | ||
| "active", | ||
| "ended" | ||
| ], | ||
| "type": "option" | ||
@@ -566,6 +570,13 @@ }, | ||
| }, | ||
| "phone-number": { | ||
| "description": "WhatsApp display phone number (resolved to a phone number ID)", | ||
| "name": "phone-number", | ||
| "hasDynamicHelp": false, | ||
| "multiple": false, | ||
| "type": "option" | ||
| }, | ||
| "phone-number-id": { | ||
| "description": "WhatsApp phone number ID (Meta internal ID)", | ||
| "description": "WhatsApp phone number ID (Meta internal ID). If you have the real number instead, use \"--phone-number\".", | ||
| "name": "phone-number-id", | ||
| "required": true, | ||
| "required": false, | ||
| "hasDynamicHelp": false, | ||
@@ -619,3 +630,3 @@ "multiple": false, | ||
| "conversation": { | ||
| "description": "Filter by conversation ID", | ||
| "description": "Filter by conversation ID. If no WhatsApp number is provided, it is resolved from the conversation.", | ||
| "name": "conversation", | ||
@@ -631,2 +642,6 @@ "hasDynamicHelp": false, | ||
| "multiple": false, | ||
| "options": [ | ||
| "inbound", | ||
| "outbound" | ||
| ], | ||
| "type": "option" | ||
@@ -653,6 +668,13 @@ }, | ||
| }, | ||
| "phone-number": { | ||
| "description": "WhatsApp display phone number (resolved to a phone number ID)", | ||
| "name": "phone-number", | ||
| "hasDynamicHelp": false, | ||
| "multiple": false, | ||
| "type": "option" | ||
| }, | ||
| "phone-number-id": { | ||
| "description": "WhatsApp phone number ID (Meta internal ID)", | ||
| "description": "WhatsApp phone number ID (Meta internal ID). If you have the real number instead, use \"--phone-number\".", | ||
| "name": "phone-number-id", | ||
| "required": true, | ||
| "required": false, | ||
| "hasDynamicHelp": false, | ||
@@ -681,2 +703,9 @@ "multiple": false, | ||
| "multiple": false, | ||
| "options": [ | ||
| "pending", | ||
| "sent", | ||
| "delivered", | ||
| "read", | ||
| "failed" | ||
| ], | ||
| "type": "option" | ||
@@ -732,6 +761,13 @@ }, | ||
| }, | ||
| "phone-number": { | ||
| "description": "WhatsApp display phone number (resolved to a phone number ID)", | ||
| "name": "phone-number", | ||
| "hasDynamicHelp": false, | ||
| "multiple": false, | ||
| "type": "option" | ||
| }, | ||
| "phone-number-id": { | ||
| "description": "WhatsApp phone number ID (Meta internal ID)", | ||
| "description": "WhatsApp phone number ID (Meta internal ID). If you have the real number instead, use \"--phone-number\".", | ||
| "name": "phone-number-id", | ||
| "required": true, | ||
| "required": false, | ||
| "hasDynamicHelp": false, | ||
@@ -788,9 +824,9 @@ "multiple": false, | ||
| "args": { | ||
| "phoneNumberId": { | ||
| "description": "WhatsApp phone number ID", | ||
| "name": "phoneNumberId", | ||
| "numberRef": { | ||
| "description": "WhatsApp phone number ID or display phone number", | ||
| "name": "numberRef", | ||
| "required": true | ||
| } | ||
| }, | ||
| "description": "Get a WhatsApp number by phone number ID", | ||
| "description": "Get a WhatsApp number by Meta ID or display phone number", | ||
| "flags": { | ||
@@ -836,5 +872,5 @@ "output": { | ||
| "args": { | ||
| "phoneNumberId": { | ||
| "description": "WhatsApp phone number ID", | ||
| "name": "phoneNumberId", | ||
| "numberRef": { | ||
| "description": "WhatsApp phone number ID or display phone number", | ||
| "name": "numberRef", | ||
| "required": true | ||
@@ -946,3 +982,3 @@ } | ||
| "args": {}, | ||
| "description": "Start WhatsApp number setup", | ||
| "description": "Create a WhatsApp setup link in the current project", | ||
| "flags": { | ||
@@ -1061,6 +1097,13 @@ "area-code": { | ||
| }, | ||
| "phone-number": { | ||
| "description": "WhatsApp display phone number (resolved to a phone number ID)", | ||
| "name": "phone-number", | ||
| "hasDynamicHelp": false, | ||
| "multiple": false, | ||
| "type": "option" | ||
| }, | ||
| "phone-number-id": { | ||
| "description": "WhatsApp phone number ID (Meta internal ID)", | ||
| "description": "WhatsApp phone number ID (Meta internal ID). If you have the real number instead, use \"--phone-number\".", | ||
| "name": "phone-number-id", | ||
| "required": true, | ||
| "required": false, | ||
| "hasDynamicHelp": false, | ||
@@ -1118,2 +1161,7 @@ "multiple": false, | ||
| "multiple": false, | ||
| "options": [ | ||
| "MARKETING", | ||
| "UTILITY", | ||
| "AUTHENTICATION" | ||
| ], | ||
| "type": "option" | ||
@@ -1154,6 +1202,13 @@ }, | ||
| }, | ||
| "phone-number": { | ||
| "description": "WhatsApp display phone number (resolved to a phone number ID)", | ||
| "name": "phone-number", | ||
| "hasDynamicHelp": false, | ||
| "multiple": false, | ||
| "type": "option" | ||
| }, | ||
| "phone-number-id": { | ||
| "description": "WhatsApp phone number ID (Meta internal ID)", | ||
| "description": "WhatsApp phone number ID (Meta internal ID). If you have the real number instead, use \"--phone-number\".", | ||
| "name": "phone-number-id", | ||
| "required": true, | ||
| "required": false, | ||
| "hasDynamicHelp": false, | ||
@@ -1175,2 +1230,10 @@ "multiple": false, | ||
| "multiple": false, | ||
| "options": [ | ||
| "APPROVED", | ||
| "PENDING", | ||
| "REJECTED", | ||
| "PAUSED", | ||
| "IN_APPEAL", | ||
| "DISABLED" | ||
| ], | ||
| "type": "option" | ||
@@ -1219,6 +1282,13 @@ } | ||
| }, | ||
| "phone-number": { | ||
| "description": "WhatsApp display phone number (resolved to a phone number ID)", | ||
| "name": "phone-number", | ||
| "hasDynamicHelp": false, | ||
| "multiple": false, | ||
| "type": "option" | ||
| }, | ||
| "phone-number-id": { | ||
| "description": "WhatsApp phone number ID (Meta internal ID)", | ||
| "description": "WhatsApp phone number ID (Meta internal ID). If you have the real number instead, use \"--phone-number\".", | ||
| "name": "phone-number-id", | ||
| "required": true, | ||
| "required": false, | ||
| "hasDynamicHelp": false, | ||
@@ -1259,3 +1329,3 @@ "multiple": false, | ||
| }, | ||
| "version": "0.0.14" | ||
| "version": "0.1.0" | ||
| } |
+9
-9
| { | ||
| "name": "@kapso/cli", | ||
| "description": "Kapso CLI for operating Kapso WhatsApp projects, numbers, conversations, messages, and templates", | ||
| "version": "0.0.14", | ||
| "version": "0.1.0", | ||
| "author": "Andrés Matte", | ||
@@ -77,13 +77,13 @@ "bin": { | ||
| }, | ||
| "whatsapp conversations": { | ||
| "description": "List and inspect WhatsApp conversations" | ||
| "whatsapp:conversations": { | ||
| "description": "Manage WhatsApp conversations" | ||
| }, | ||
| "whatsapp messages": { | ||
| "description": "List, inspect, and send WhatsApp messages" | ||
| "whatsapp:messages": { | ||
| "description": "Manage WhatsApp messages" | ||
| }, | ||
| "whatsapp numbers": { | ||
| "description": "Provision and inspect WhatsApp numbers" | ||
| "whatsapp:numbers": { | ||
| "description": "Manage WhatsApp numbers" | ||
| }, | ||
| "whatsapp templates": { | ||
| "description": "List, inspect, and create WhatsApp templates" | ||
| "whatsapp:templates": { | ||
| "description": "Manage WhatsApp templates" | ||
| } | ||
@@ -90,0 +90,0 @@ }, |
+82
-61
@@ -23,3 +23,3 @@ @kapso/cli | ||
| $ kapso (--version) | ||
| @kapso/cli/0.0.14 linux-x64 node-v24.12.0 | ||
| @kapso/cli/0.1.0 linux-x64 node-v24.12.0 | ||
| $ kapso --help [COMMAND] | ||
@@ -60,4 +60,4 @@ USAGE | ||
| * [`kapso whatsapp messages send`](#kapso-whatsapp-messages-send) | ||
| * [`kapso whatsapp numbers get PHONENUMBERID`](#kapso-whatsapp-numbers-get-phonenumberid) | ||
| * [`kapso whatsapp numbers health PHONENUMBERID`](#kapso-whatsapp-numbers-health-phonenumberid) | ||
| * [`kapso whatsapp numbers get NUMBERREF`](#kapso-whatsapp-numbers-get-numberref) | ||
| * [`kapso whatsapp numbers health NUMBERREF`](#kapso-whatsapp-numbers-health-numberref) | ||
| * [`kapso whatsapp numbers list`](#kapso-whatsapp-numbers-list) | ||
@@ -89,3 +89,3 @@ * [`kapso whatsapp numbers new`](#kapso-whatsapp-numbers-new) | ||
| _See code: [src/commands/customers/get.ts](https://github.com/gokapso/kapso-cli/blob/v0.0.14/src/commands/customers/get.ts)_ | ||
| _See code: [src/commands/customers/get.ts](https://github.com/gokapso/kapso-cli/blob/v0.1.0/src/commands/customers/get.ts)_ | ||
@@ -109,3 +109,3 @@ ## `kapso customers list` | ||
| _See code: [src/commands/customers/list.ts](https://github.com/gokapso/kapso-cli/blob/v0.0.14/src/commands/customers/list.ts)_ | ||
| _See code: [src/commands/customers/list.ts](https://github.com/gokapso/kapso-cli/blob/v0.1.0/src/commands/customers/list.ts)_ | ||
@@ -131,3 +131,3 @@ ## `kapso customers new` | ||
| _See code: [src/commands/customers/new.ts](https://github.com/gokapso/kapso-cli/blob/v0.0.14/src/commands/customers/new.ts)_ | ||
| _See code: [src/commands/customers/new.ts](https://github.com/gokapso/kapso-cli/blob/v0.1.0/src/commands/customers/new.ts)_ | ||
@@ -169,3 +169,3 @@ ## `kapso help [COMMAND]` | ||
| _See code: [src/commands/login.ts](https://github.com/gokapso/kapso-cli/blob/v0.0.14/src/commands/login.ts)_ | ||
| _See code: [src/commands/login.ts](https://github.com/gokapso/kapso-cli/blob/v0.1.0/src/commands/login.ts)_ | ||
@@ -187,3 +187,3 @@ ## `kapso logout` | ||
| _See code: [src/commands/logout.ts](https://github.com/gokapso/kapso-cli/blob/v0.0.14/src/commands/logout.ts)_ | ||
| _See code: [src/commands/logout.ts](https://github.com/gokapso/kapso-cli/blob/v0.1.0/src/commands/logout.ts)_ | ||
@@ -206,3 +206,3 @@ ## `kapso projects current` | ||
| _See code: [src/commands/projects/current.ts](https://github.com/gokapso/kapso-cli/blob/v0.0.14/src/commands/projects/current.ts)_ | ||
| _See code: [src/commands/projects/current.ts](https://github.com/gokapso/kapso-cli/blob/v0.1.0/src/commands/projects/current.ts)_ | ||
@@ -225,3 +225,3 @@ ## `kapso projects list` | ||
| _See code: [src/commands/projects/list.ts](https://github.com/gokapso/kapso-cli/blob/v0.0.14/src/commands/projects/list.ts)_ | ||
| _See code: [src/commands/projects/list.ts](https://github.com/gokapso/kapso-cli/blob/v0.1.0/src/commands/projects/list.ts)_ | ||
@@ -243,7 +243,7 @@ ## `kapso projects use PROJECTID` | ||
| _See code: [src/commands/projects/use.ts](https://github.com/gokapso/kapso-cli/blob/v0.0.14/src/commands/projects/use.ts)_ | ||
| _See code: [src/commands/projects/use.ts](https://github.com/gokapso/kapso-cli/blob/v0.1.0/src/commands/projects/use.ts)_ | ||
| ## `kapso setup` | ||
| Set up Kapso for a WhatsApp number | ||
| Guided first-time setup for Kapso and a WhatsApp number | ||
@@ -270,6 +270,6 @@ ``` | ||
| DESCRIPTION | ||
| Set up Kapso for a WhatsApp number | ||
| Guided first-time setup for Kapso and a WhatsApp number | ||
| ``` | ||
| _See code: [src/commands/setup.ts](https://github.com/gokapso/kapso-cli/blob/v0.0.14/src/commands/setup.ts)_ | ||
| _See code: [src/commands/setup.ts](https://github.com/gokapso/kapso-cli/blob/v0.1.0/src/commands/setup.ts)_ | ||
@@ -292,3 +292,3 @@ ## `kapso status` | ||
| _See code: [src/commands/status.ts](https://github.com/gokapso/kapso-cli/blob/v0.0.14/src/commands/status.ts)_ | ||
| _See code: [src/commands/status.ts](https://github.com/gokapso/kapso-cli/blob/v0.1.0/src/commands/status.ts)_ | ||
@@ -315,3 +315,3 @@ ## `kapso whatsapp conversations get CONVERSATIONID` | ||
| _See code: [src/commands/whatsapp/conversations/get.ts](https://github.com/gokapso/kapso-cli/blob/v0.0.14/src/commands/whatsapp/conversations/get.ts)_ | ||
| _See code: [src/commands/whatsapp/conversations/get.ts](https://github.com/gokapso/kapso-cli/blob/v0.1.0/src/commands/whatsapp/conversations/get.ts)_ | ||
@@ -325,3 +325,3 @@ ## `kapso whatsapp conversations list` | ||
| $ kapso whatsapp conversations list [--assigned-user <value>] [--output json|human] [--page <value>] [--per-page <value>] | ||
| [--phone <value>] [--phone-number-id <value>] [--project <value>] [--status <value>] [--unassigned] | ||
| [--phone <value>] [--phone-number-id <value>] [--project <value>] [--status active|ended] [--unassigned] | ||
@@ -337,3 +337,4 @@ FLAGS | ||
| --project=<value> Project ID override | ||
| --status=<value> Filter by conversation status | ||
| --status=<option> Filter by conversation status | ||
| <options: active|ended> | ||
| --unassigned Only include unassigned conversations | ||
@@ -345,3 +346,3 @@ | ||
| _See code: [src/commands/whatsapp/conversations/list.ts](https://github.com/gokapso/kapso-cli/blob/v0.0.14/src/commands/whatsapp/conversations/list.ts)_ | ||
| _See code: [src/commands/whatsapp/conversations/list.ts](https://github.com/gokapso/kapso-cli/blob/v0.1.0/src/commands/whatsapp/conversations/list.ts)_ | ||
@@ -354,3 +355,4 @@ ## `kapso whatsapp messages get MESSAGEID` | ||
| USAGE | ||
| $ kapso whatsapp messages get MESSAGEID --phone-number-id <value> [--output json|human] [--project <value>] | ||
| $ kapso whatsapp messages get MESSAGEID [--output json|human] [--phone-number <value>] [--phone-number-id <value>] | ||
| [--project <value>] | ||
@@ -363,3 +365,5 @@ ARGUMENTS | ||
| <options: json|human> | ||
| --phone-number-id=<value> (required) WhatsApp phone number ID (Meta internal ID) | ||
| --phone-number=<value> WhatsApp display phone number (resolved to a phone number ID) | ||
| --phone-number-id=<value> WhatsApp phone number ID (Meta internal ID). If you have the real number instead, use | ||
| "--phone-number". | ||
| --project=<value> Project ID override | ||
@@ -371,3 +375,3 @@ | ||
| _See code: [src/commands/whatsapp/messages/get.ts](https://github.com/gokapso/kapso-cli/blob/v0.0.14/src/commands/whatsapp/messages/get.ts)_ | ||
| _See code: [src/commands/whatsapp/messages/get.ts](https://github.com/gokapso/kapso-cli/blob/v0.1.0/src/commands/whatsapp/messages/get.ts)_ | ||
@@ -380,5 +384,5 @@ ## `kapso whatsapp messages list` | ||
| USAGE | ||
| $ kapso whatsapp messages list --phone-number-id <value> [--after <value>] [--before <value>] [--conversation <value>] | ||
| [--direction <value>] [--limit <value>] [--output json|human] [--project <value>] [--since <value>] [--status | ||
| <value>] [--until <value>] | ||
| $ kapso whatsapp messages list [--after <value>] [--before <value>] [--conversation <value>] [--direction | ||
| inbound|outbound] [--limit <value>] [--output json|human] [--phone-number <value>] [--phone-number-id <value>] | ||
| [--project <value>] [--since <value>] [--status pending|sent|delivered|read|failed] [--until <value>] | ||
@@ -388,11 +392,16 @@ FLAGS | ||
| --before=<value> Cursor for the previous page | ||
| --conversation=<value> Filter by conversation ID | ||
| --direction=<value> Filter by direction | ||
| --conversation=<value> Filter by conversation ID. If no WhatsApp number is provided, it is resolved from the | ||
| conversation. | ||
| --direction=<option> Filter by direction | ||
| <options: inbound|outbound> | ||
| --limit=<value> Maximum number of messages to return | ||
| --output=<option> [default: json] Output format | ||
| <options: json|human> | ||
| --phone-number-id=<value> (required) WhatsApp phone number ID (Meta internal ID) | ||
| --phone-number=<value> WhatsApp display phone number (resolved to a phone number ID) | ||
| --phone-number-id=<value> WhatsApp phone number ID (Meta internal ID). If you have the real number instead, use | ||
| "--phone-number". | ||
| --project=<value> Project ID override | ||
| --since=<value> Filter by messages created at/after this timestamp | ||
| --status=<value> Filter by message status | ||
| --status=<option> Filter by message status | ||
| <options: pending|sent|delivered|read|failed> | ||
| --until=<value> Filter by messages created at/before this timestamp | ||
@@ -404,3 +413,3 @@ | ||
| _See code: [src/commands/whatsapp/messages/list.ts](https://github.com/gokapso/kapso-cli/blob/v0.0.14/src/commands/whatsapp/messages/list.ts)_ | ||
| _See code: [src/commands/whatsapp/messages/list.ts](https://github.com/gokapso/kapso-cli/blob/v0.1.0/src/commands/whatsapp/messages/list.ts)_ | ||
@@ -413,4 +422,4 @@ ## `kapso whatsapp messages send` | ||
| USAGE | ||
| $ kapso whatsapp messages send --phone-number-id <value> [--input <value>] [--output json|human] [--project <value>] | ||
| [--stdin] [--text <value>] [--to <value>] | ||
| $ kapso whatsapp messages send [--input <value>] [--output json|human] [--phone-number <value>] [--phone-number-id | ||
| <value>] [--project <value>] [--stdin] [--text <value>] [--to <value>] | ||
@@ -421,3 +430,5 @@ FLAGS | ||
| <options: json|human> | ||
| --phone-number-id=<value> (required) WhatsApp phone number ID (Meta internal ID) | ||
| --phone-number=<value> WhatsApp display phone number (resolved to a phone number ID) | ||
| --phone-number-id=<value> WhatsApp phone number ID (Meta internal ID). If you have the real number instead, use | ||
| "--phone-number". | ||
| --project=<value> Project ID override | ||
@@ -432,14 +443,14 @@ --stdin Read the JSON payload from stdin | ||
| _See code: [src/commands/whatsapp/messages/send.ts](https://github.com/gokapso/kapso-cli/blob/v0.0.14/src/commands/whatsapp/messages/send.ts)_ | ||
| _See code: [src/commands/whatsapp/messages/send.ts](https://github.com/gokapso/kapso-cli/blob/v0.1.0/src/commands/whatsapp/messages/send.ts)_ | ||
| ## `kapso whatsapp numbers get PHONENUMBERID` | ||
| ## `kapso whatsapp numbers get NUMBERREF` | ||
| Get a WhatsApp number by phone number ID | ||
| Get a WhatsApp number by Meta ID or display phone number | ||
| ``` | ||
| USAGE | ||
| $ kapso whatsapp numbers get PHONENUMBERID [--output json|human] [--project <value>] | ||
| $ kapso whatsapp numbers get NUMBERREF [--output json|human] [--project <value>] | ||
| ARGUMENTS | ||
| PHONENUMBERID WhatsApp phone number ID | ||
| NUMBERREF WhatsApp phone number ID or display phone number | ||
@@ -452,8 +463,8 @@ FLAGS | ||
| DESCRIPTION | ||
| Get a WhatsApp number by phone number ID | ||
| Get a WhatsApp number by Meta ID or display phone number | ||
| ``` | ||
| _See code: [src/commands/whatsapp/numbers/get.ts](https://github.com/gokapso/kapso-cli/blob/v0.0.14/src/commands/whatsapp/numbers/get.ts)_ | ||
| _See code: [src/commands/whatsapp/numbers/get.ts](https://github.com/gokapso/kapso-cli/blob/v0.1.0/src/commands/whatsapp/numbers/get.ts)_ | ||
| ## `kapso whatsapp numbers health PHONENUMBERID` | ||
| ## `kapso whatsapp numbers health NUMBERREF` | ||
@@ -464,6 +475,6 @@ Run a health check for a WhatsApp number | ||
| USAGE | ||
| $ kapso whatsapp numbers health PHONENUMBERID [--output json|human] [--project <value>] | ||
| $ kapso whatsapp numbers health NUMBERREF [--output json|human] [--project <value>] | ||
| ARGUMENTS | ||
| PHONENUMBERID WhatsApp phone number ID | ||
| NUMBERREF WhatsApp phone number ID or display phone number | ||
@@ -479,3 +490,3 @@ FLAGS | ||
| _See code: [src/commands/whatsapp/numbers/health.ts](https://github.com/gokapso/kapso-cli/blob/v0.0.14/src/commands/whatsapp/numbers/health.ts)_ | ||
| _See code: [src/commands/whatsapp/numbers/health.ts](https://github.com/gokapso/kapso-cli/blob/v0.1.0/src/commands/whatsapp/numbers/health.ts)_ | ||
@@ -503,7 +514,7 @@ ## `kapso whatsapp numbers list` | ||
| _See code: [src/commands/whatsapp/numbers/list.ts](https://github.com/gokapso/kapso-cli/blob/v0.0.14/src/commands/whatsapp/numbers/list.ts)_ | ||
| _See code: [src/commands/whatsapp/numbers/list.ts](https://github.com/gokapso/kapso-cli/blob/v0.1.0/src/commands/whatsapp/numbers/list.ts)_ | ||
| ## `kapso whatsapp numbers new` | ||
| Start WhatsApp number setup | ||
| Create a WhatsApp setup link in the current project | ||
@@ -530,6 +541,6 @@ ``` | ||
| DESCRIPTION | ||
| Start WhatsApp number setup | ||
| Create a WhatsApp setup link in the current project | ||
| ``` | ||
| _See code: [src/commands/whatsapp/numbers/new.ts](https://github.com/gokapso/kapso-cli/blob/v0.0.14/src/commands/whatsapp/numbers/new.ts)_ | ||
| _See code: [src/commands/whatsapp/numbers/new.ts](https://github.com/gokapso/kapso-cli/blob/v0.1.0/src/commands/whatsapp/numbers/new.ts)_ | ||
@@ -542,3 +553,4 @@ ## `kapso whatsapp templates get TEMPLATEID` | ||
| USAGE | ||
| $ kapso whatsapp templates get TEMPLATEID --phone-number-id <value> [--output json|human] [--project <value>] | ||
| $ kapso whatsapp templates get TEMPLATEID [--output json|human] [--phone-number <value>] [--phone-number-id <value>] | ||
| [--project <value>] | ||
@@ -551,3 +563,5 @@ ARGUMENTS | ||
| <options: json|human> | ||
| --phone-number-id=<value> (required) WhatsApp phone number ID (Meta internal ID) | ||
| --phone-number=<value> WhatsApp display phone number (resolved to a phone number ID) | ||
| --phone-number-id=<value> WhatsApp phone number ID (Meta internal ID). If you have the real number instead, use | ||
| "--phone-number". | ||
| --project=<value> Project ID override | ||
@@ -559,3 +573,3 @@ | ||
| _See code: [src/commands/whatsapp/templates/get.ts](https://github.com/gokapso/kapso-cli/blob/v0.0.14/src/commands/whatsapp/templates/get.ts)_ | ||
| _See code: [src/commands/whatsapp/templates/get.ts](https://github.com/gokapso/kapso-cli/blob/v0.1.0/src/commands/whatsapp/templates/get.ts)_ | ||
@@ -568,4 +582,5 @@ ## `kapso whatsapp templates list` | ||
| USAGE | ||
| $ kapso whatsapp templates list --phone-number-id <value> [--after <value>] [--before <value>] [--category <value>] | ||
| [--language <value>] [--limit <value>] [--name <value>] [--output json|human] [--project <value>] [--status <value>] | ||
| $ kapso whatsapp templates list [--after <value>] [--before <value>] [--category MARKETING|UTILITY|AUTHENTICATION] | ||
| [--language <value>] [--limit <value>] [--name <value>] [--output json|human] [--phone-number <value>] | ||
| [--phone-number-id <value>] [--project <value>] [--status APPROVED|PENDING|REJECTED|PAUSED|IN_APPEAL|DISABLED] | ||
@@ -575,3 +590,4 @@ FLAGS | ||
| --before=<value> Cursor for the previous page | ||
| --category=<value> Filter by template category | ||
| --category=<option> Filter by template category | ||
| <options: MARKETING|UTILITY|AUTHENTICATION> | ||
| --language=<value> Filter by language code | ||
@@ -582,5 +598,8 @@ --limit=<value> Maximum number of templates to return | ||
| <options: json|human> | ||
| --phone-number-id=<value> (required) WhatsApp phone number ID (Meta internal ID) | ||
| --phone-number=<value> WhatsApp display phone number (resolved to a phone number ID) | ||
| --phone-number-id=<value> WhatsApp phone number ID (Meta internal ID). If you have the real number instead, use | ||
| "--phone-number". | ||
| --project=<value> Project ID override | ||
| --status=<value> Filter by template status | ||
| --status=<option> Filter by template status | ||
| <options: APPROVED|PENDING|REJECTED|PAUSED|IN_APPEAL|DISABLED> | ||
@@ -591,3 +610,3 @@ DESCRIPTION | ||
| _See code: [src/commands/whatsapp/templates/list.ts](https://github.com/gokapso/kapso-cli/blob/v0.0.14/src/commands/whatsapp/templates/list.ts)_ | ||
| _See code: [src/commands/whatsapp/templates/list.ts](https://github.com/gokapso/kapso-cli/blob/v0.1.0/src/commands/whatsapp/templates/list.ts)_ | ||
@@ -600,4 +619,4 @@ ## `kapso whatsapp templates new` | ||
| USAGE | ||
| $ kapso whatsapp templates new --phone-number-id <value> [--input <value>] [--output json|human] [--project <value>] | ||
| [--stdin] | ||
| $ kapso whatsapp templates new [--input <value>] [--output json|human] [--phone-number <value>] [--phone-number-id | ||
| <value>] [--project <value>] [--stdin] | ||
@@ -608,3 +627,5 @@ FLAGS | ||
| <options: json|human> | ||
| --phone-number-id=<value> (required) WhatsApp phone number ID (Meta internal ID) | ||
| --phone-number=<value> WhatsApp display phone number (resolved to a phone number ID) | ||
| --phone-number-id=<value> WhatsApp phone number ID (Meta internal ID). If you have the real number instead, use | ||
| "--phone-number". | ||
| --project=<value> Project ID override | ||
@@ -617,3 +638,3 @@ --stdin Read the JSON payload from stdin | ||
| _See code: [src/commands/whatsapp/templates/new.ts](https://github.com/gokapso/kapso-cli/blob/v0.0.14/src/commands/whatsapp/templates/new.ts)_ | ||
| _See code: [src/commands/whatsapp/templates/new.ts](https://github.com/gokapso/kapso-cli/blob/v0.1.0/src/commands/whatsapp/templates/new.ts)_ | ||
| <!-- commandsstop --> |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 5 instances in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 5 instances in 1 package
177024
9.03%83
2.47%4204
6.32%601
3.62%