Skip to content

feat(integriq): build messaging-sms-providers-and-notifynl-mail - #3628

Merged
rubenvdlinde merged 18 commits into
developmentfrom
quality/build-messaging-sms-providers-and-notifynl-mail
Nov 17, 2026
Merged

rubenvdlinde merged 18 commits into
developmentfrom
quality/build-messaging-sms-providers-and-notifynl-mail

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

Continues openspec/changes/messaging-sms-providers-and-notifynl-mail after #3563 (tasks 1 to 4 and 8). This builds the remaining code tasks 5, 6 and 7.

Tasks done

  • 5, source choice and provider picker: sendMessage() takes sourceSlug; a slug that is not an enabled source of type sms is refused (unknown-source, 400) before anything is stored or sent. The sending source's slug is stored on sms_message (schema 1.1.0) and shown as a column on the SMS page, and a status read goes through that source. GET /api/sms/providers lists the registry's bindings with name and config schema; the source form gets an SMS provider picker built from it, showing the picked provider's settings. sms joins the form's type list.
  • 6, vendor delivery callbacks: POST /api/sms/{provider}/status/{token} (public, rate limited, kept as a standard-protocol path so the URL a vendor signs is not rewritten). The per-source token picks the source in constant time before the body is read; Twilio and MessageBird signatures are verified with the source's signing key; a checked status goes to handleStatusCallback(), which leaves an unknown id unchanged. A save listener gives an SMS source its token and stores a typed signing key encrypted. The form shows the callback URL and a signing key field.
  • 7, NotifyNL e-mail: RestNotifyNlProvider::sendEmail() posts to /v2/notifications/email. POST /api/notifynl/emails (new action notifynl.email) validates the address first, asks the opt-out list, opens the outbound log row on channel notifynl, sends with the row uuid as NotifyNL's reference and hands the row over with NotifyNL's id. notifyNl#inbound falls back from sms_message to that row and moves the recipient the id was handed over for.

Tasks left

  • The e2e tests in tests/e2e/sms-providers.spec.ts for tasks 5 to 7 and one live send per vendor: browser and vendor accounts needed, not done here.

Tests added

  • PHPUnit: dispatcher source choice (7), SmsProvidersController (2), NotifyNL controller send/e-mail/inbound paths (10), the three vendors' callback signature checks and status mapping (20), SmsStatusCallbackService (4), SmsStatusController (3), SmsSourceCallbackListener (3), NotifyNlEmailService (10), RestNotifyNlProvider::sendEmail() (2).
  • vitest: the SMS picker, its settings and the callback URL (4).
  • OpenAPI documents, the registration-order fixture and l10n (en, nl) are updated.

Suite before/after

  • Unit, development: 8920 tests, 2 errors and 5 failures. This branch: 8982 tests, the same 2 errors and 5 failures, no new ones.
  • vitest: 163 files, all passing. phpcs, phpstan and phpmd are clean on the touched files; eslint is clean on the touched Vue/JS; tests/validate-register.js passes.

Generated by Claude Code

…fynl-mail [skip ci]

Assisted-by: ClaudeCode:claude-opus-5-5
… ci]

Task 5: a caller names the SMS source with sourceSlug; a slug that is not an enabled SMS source is refused (400 unknown-source) before anything is stored or sent; the sending source's slug is stored on sms_message (1.1.0) and shown on the SMS page, and a status read goes through that source. GET /api/sms/providers lists the registry's bindings with name and config schema, and the source form gets an SMS provider picker built from it, with the picked provider's settings.

Assisted-by: ClaudeCode:claude-opus-5-5
… ci]

Task 6: vendor delivery callbacks. POST /api/sms/{provider}/status/{token} (public, rate limited, a standard-protocol path so the signed URL is left as is) picks the source by its per-source token in constant time before reading the body; Twilio's X-Twilio-Signature and MessageBird's MessageBird-Signature-JWT are verified with the source's signing key; a checked status goes to handleStatusCallback, which leaves an unknown id unchanged. An SMS source gets its random token on save, and a typed signing key is stored encrypted. The source form shows the callback URL and the signing key field.

Assisted-by: ClaudeCode:claude-opus-5-5
Assisted-by: ClaudeCode:claude-opus-5-5
… ci]

Task 7: NotifyNL e-mail. RestNotifyNlProvider::sendEmail() posts to /v2/notifications/email; POST /api/notifynl/emails (action notifynl.email) validates the address before anything is sent or recorded, asks the opt-out list, opens the outbound log row on channel notifynl, sends with the row uuid as NotifyNL's reference and hands the row over with NotifyNL's id. notifyNl#inbound falls back from sms_message to that row and moves the recipient the id was handed over for.

Assisted-by: ClaudeCode:claude-opus-5-5
…fynl-mail [skip ci]

Assisted-by: ClaudeCode:claude-opus-5-5
rubenvdlinde and others added 12 commits November 14, 2026 16:37
…ogue tail [skip ci]

Assisted-by: ClaudeCode:claude-opus-5-5
…ed catalogue tail [skip ci]

Assisted-by: ClaudeCode:claude-opus-5-5
…fynl-mail [skip ci]

integriq_register.json: info.version 1.2.1, above development's 1.2.0, so the
register import still runs for this branch's schema change.

Assisted-by: ClaudeCode:claude-opus-5-5
…r steps [skip ci]

SmsDispatchService::sendMessage, NotifyNlEmailService::sendEmail and
CmComSmsProvider::readStatusCallback each hand a self-contained step
(recipient normalisation, the opt-out check, the unsubscribe text, the
queued record, the log-row settlement, the report flattening) to a
private helper. Same order of calls, same values, same exceptions.

Assisted-by: ClaudeCode:claude-opus-5-5
…inability floor [skip ci]

NotifyNlEmailService and SmsStatusCallbackService each repeated the
enabled-source search ActiveSourceLookup already ran. ActiveSourceLookup now
offers it as enabledQuery() and resultsOf(), and all three use it. The
search, its filters and limits, and every refusal are unchanged.

Assisted-by: ClaudeCode:claude-opus-5-5
Assisted-by: ClaudeCode:claude-opus-5-5
…, not classes [skip ci]

The controllers and the SMS source listener reached SmsDispatchService,
NotifyNlEmailService, SmsStatusCallbackService and SmsProviderRegistry
directly, and NotifyNlEmailService reached MessageRecorder, which exposed
about 1000 lines across components and put the tree that would land at
3.54, under integriq's 3.56 maintainability floor.

They now take NotifyNlEmailServiceInterface, SmsStatusCallbackServiceInterface,
SmsProviderRegistryInterface and MessageRecorderInterface, bound next to the
existing aliases; the constants callers read (SOURCE_TYPE, ERROR_UNKNOWN_SOURCE,
ERROR_INVALID_ADDRESS, ERROR_MISSING_TEMPLATE, TOKEN_KEY, SIGNING_KEY) move
onto the contracts, so Class::CONST keeps resolving. No method body, value
or route changed. Estimated maintainability after merge: 3.56 to 3.65.

Assisted-by: ClaudeCode:claude-opus-5-5
…fynl-mail [skip ci]

Keeps the branch's queueMessage() helper and saves through development's
RegisterSave::options() (openregister main object API).

Assisted-by: ClaudeCode:claude-opus-5-5
…e sent [skip ci]

SmsStatusCallbackService resolved the source from the callback token but
handed only the provider message id on, so a callback through one source
could set the status of a message another source sent. handleStatusCallback
takes the source (slug and provider) as an optional last argument and
matches the message on its stored sourceSlug; a message stored without one
matches a source of its provider. Callers without a source are unchanged.

Assisted-by: ClaudeCode:claude-opus-5-5
Six class-level @SPEC tags named REQ-SMSP anchors under
openspec/specs/notifynl-sms-channel, where they do not exist; they now
use the change's spec path, as the method tags already do.
SmsStatusController::getRawContent gets its @SPEC tag.

Assisted-by: ClaudeCode
@rubenvdlinde
rubenvdlinde merged commit b0441f7 into development Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants