Skip to content

Add SMS fallback plugin (initial scaffold) and emit message:fallback hook#2

Draft
jr-everstar wants to merge 2 commits into
mainfrom
codex/add-account-based-authentication-and-setup-features-txrt7v
Draft

Add SMS fallback plugin (initial scaffold) and emit message:fallback hook#2
jr-everstar wants to merge 2 commits into
mainfrom
codex/add-account-based-authentication-and-setup-features-txrt7v

Conversation

@jr-everstar
Copy link
Copy Markdown
Owner

Motivation

  • Introduce an initial, opt-in SMS fallback mechanism to signal when outbound WhatsApp sends fail due to recipient not being registered.
  • Wire a plugin extension and observability path so provider integrations (Twilio, Vonage, etc.) can be added in follow-ups.

Description

  • Add a new hook event message:fallback to HookEvent and make MessageService.sendText emit message:fallback when failure matches WhatsApp-registration errors via isWhatsAppRegistrationError.
  • Implement a built-in mock SmsFallbackPlugin in src/plugins/extensions/sms-fallback.plugin.ts that registers on message:failed, logs fallback intents, and exposes a small config schema (enabled, provider, apiKey, from).
  • Register the sms-fallback built-in plugin in PluginLoaderService.loadBuiltInPlugins and add documentation (docs/23-sms-fallback-plugin.md) plus README entries pointing to the new docs.
  • Apply small related cleanups and typing fixes across the codebase: return typing in HookManager.getRegisteredHooks, minor type/formatting adjustments in engine.factory.ts, session.service.ts (remove unnecessary casts when dispatching events), docker.service.ts PortBindings reduction, and a signature cast removal in bulk-message.service.ts.
  • Update unit tests in src/modules/message/message.service.spec.ts to assert the message:fallback hook is emitted when target is not a WhatsApp account.

Testing

  • Updated unit tests in src/modules/message/message.service.spec.ts to cover fallback emission and existing send flows.
  • Ran unit tests with npm test and all tests completed successfully.

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant