-
-
Notifications
You must be signed in to change notification settings - Fork 584
feature/connector-http-sms #7510
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
feature/connector-http-sms #7510
Conversation
COMPARE TO
|
Name | Diff |
---|---|
.changeset/olive-maps-wave.md | 📈 +69 Bytes |
packages/connectors/connector-http-sms/README.md | 📈 +1.52 KB |
packages/connectors/connector-http-sms/logo-dark.svg | 📈 +4.09 KB |
packages/connectors/connector-http-sms/logo.svg | 📈 +4.09 KB |
packages/connectors/connector-http-sms/package.json | 📈 +1.57 KB |
packages/connectors/connector-http-sms/src/constant.ts | 📈 +941 Bytes |
packages/connectors/connector-http-sms/src/index.test.ts | 📈 +1.16 KB |
packages/connectors/connector-http-sms/src/index.ts | 📈 +1.87 KB |
packages/connectors/connector-http-sms/src/mock.ts | 📈 +188 Bytes |
packages/connectors/connector-http-sms/src/types.ts | 📈 +204 Bytes |
pnpm-lock.yaml | 📈 +859 Bytes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, thanks for the contribution. Could you please check the requirement of the commitlint?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new HTTP-based SMS connector mirroring the existing HTTP email connector for sending SMS messages via JSON payloads to configurable endpoints.
- Defines Zod schema and TypeScript types for connector configuration
- Implements
sendMessage
logic with HTTP error handling and optional auth header - Adds unit tests, mock data, metadata, documentation, and changelog for initial release
Reviewed Changes
Copilot reviewed 8 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
src/types.ts | Adds httpSmsConfigGuard and HttpSmsConfig |
src/mock.ts | Provides mockedConfig for testing |
src/index.ts | Implements connector creation and sendMessage |
src/index.test.ts | Adds unit tests for happy path |
src/constant.ts | Defines connector metadata and form items |
package.json | Declares package info, dependencies, and scripts |
README.md | Documents setup, payload, and usage |
CHANGELOG.md | Records initial 1.0.0 release |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (3)
packages/connectors/connector-http-sms/src/index.ts:40
- The error branch for non-HTTP errors isn’t covered by tests. Add a unit test simulating a network or validation failure to ensure this path is handled correctly.
} catch (error: unknown) {
packages/connectors/connector-http-sms/README.md:33
- [nitpick] The link references the
passwordless.ts
types but this is an SMS connector. Consider linking to the correct SMS template type definitions in theconnector-kit
for clarity.
You can find all of the types in https://docs.logto.io/docs/recipes/configure-connectors/sms-connector/configure-popular-sms-service/#sms-template, and the full type definition of `SendMessageData` in [connector-kit](https://github.com/logto-io/logto/tree/master/packages/toolkit/connector-kit/src/types/passwordless.ts).
packages/connectors/connector-http-sms/src/constant.ts:32
- [nitpick] The tooltip language is slightly unclear. Consider rephrasing to: ‘Optional HTTP Authorization header to include in the request for API authentication.’
'The authorization header to be sent with the request, you can verify the value in your server.',
Thanks for the review. I think I addressed all issues. lmk and feel free to take over |
hi @michakfromparis, one last thing, you need to sign your commits. |
…tions and payload details
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
c2e1da6
to
1348ef6
Compare
Hey @wangsijie! I just signed all my commits and force pushed. Let me know if you need anything else from us. |
@michakfromparis The pnpm lock file is not up-to-date, can you please run |
@wangsijie I just did! |
@michakfromparis CI failed, please check the lint issues. |
79c7ed3
to
4ea3ea3
Compare
@wangsijie I just got back, rewrote all the commit messages and merged with upstream. I guess (hope) this should fix the issues. |
@michakfromparis you can enable "Allow edits by maintainers", that would make things easier, I can take care of the rest. |
Summary
This PR adds a new HTTP SMS connector that allows sending SMS messages via HTTP API calls, following the exact same pattern and architecture as the existing HTTP email connector.
Features
SendMessageData
structure (to
,type
,payload
) to external SMS servicesImplementation Details
@logto/connector-http-sms
SmsConnector
interface@logto/connector-kit
,got
,zod
)SendMessageData
to configured endpoint as JSONFile Structure
Configuration
The connector accepts a simple configuration:
Payload Example
When sending an SMS, the connector forwards the complete Logto message data:
This design allows external SMS services to handle template rendering, localization, and business logic while providing full access to Logto's rich context data.
Testing
Unit Tests
SendMessageData
formatTest Coverage
Testing
docker build -t logto:latest .
Screenshots