[Open Source] SMS Aggregation Component: Easily Integrate Multiple SMS Providers and Simplify SMS Sending
![[Open Source] SMS Aggregation Component: Easily Integrate Multiple SMS Providers and Simplify SMS Sending](https://yy123.ink/api/img/1782589729951-8q9hd4.jpg)
1. Project Overview
SMS4J -- Making SMS Sending Simpler
SMS4J is an SMS aggregation component that makes it easy to integrate multiple SMS service providers, eliminating the tedious process of connecting to multiple SMS SDKs. SMS4J is open source under the Apache-2.0 license, making it easy for like-minded developers to contribute to the open-source community.
It currently supports several popular SMS service providers, with more integrations planned. Additional related features will also be introduced in future versions.
sms-aggregation Officially Renamed to sms4j
Since its release as open source, sms-aggregation has received a great deal of feedback. Many users complained that the name was unattractive, too long, and difficult to remember. Following a community vote, the project has officially adopted the new name sms4j. The new name comes with a new package name, groupId, new features, and new documentation. The release is scheduled for Saturday. This update marks a major milestone and a fresh start. Going forward, version iteration and maintenance plans will be introduced. The author intends to maintain this project for as long as possible.
2. Open Source License
Licensed under Apache-2.0
3. Screenshots



4. Feature Overview
SMS sending is frequently used in everyday development, especially by small and medium-sized outsourcing companies. After all, not every company has the resources of Alibaba or Tencent, nor does every company have internal SMS procedures like banks and telecom operators. Third-party SMS services are often the most common solution. However, there are numerous third-party SMS providers on the market, each with different methods and standards. Every time you need to use one, you have to spend time reading documentation and writing corresponding utility code. Too much time and effort are wasted on something as simple as sending an SMS. The purpose of this tool is to standardize SMS sending methods across different providers. You can even switch SMS providers simply by modifying the YAML configuration file.
Supported Providers
- Alibaba Cloud Domestic SMS
- Tencent Cloud Domestic SMS
- Huawei Cloud Domestic SMS
- JD Cloud Domestic SMS
- Ronglian Cloud Domestic SMS
- Yimei Softcom Domestic SMS
- Heyi SMS
- Yunpian SMS
Plug and Play
Extremely simple configuration and convenient usage. Get SMS sending up and running in just three minutes.
Simple and Elegant
Unifies the sending methods and features of different providers, eliminating the need to learn their individual implementation differences and making SMS integration as simple as possible.
Flexible Switching
Switch between different service providers immediately using only the configuration file. No more reading documentation or copying and pasting code. Sending SMS is as easy as a few clicks.
Rich Functions
Common SMS restrictions and rules are supported without requiring additional custom methods or modules. Simply enable the corresponding configuration. More features will be integrated in the future for greater convenience.
Features
✅ Ready to use out of the box, simple and convenient
✅ Compatible with SpringBoot3 for seamless upgrades
✅ Supports configuration for multiple providers with ease
✅ Supports asynchronous SMS, delayed SMS, and many other additional features
✅ Easy to use and beginner-friendly
✅ Minimal dependencies to minimize the risk of dependency conflicts
✅ Flexible configuration with support for multiple configuration methods
5. Tech Stack

Integration in a SpringBoot Environment
1. Add the Maven Dependency
<dependency> <groupId>org.dromara.sms4j</groupId> <artifactId>sms4j-spring-boot-starter</artifactId> <version> version </version> </dependency>
2. Configure the Configuration File
sms:
alibaba:
#Alibaba Cloud accessKey
accessKeyId: Your accessKey
#Alibaba Cloud accessKeySecret
accessKeySecret: Your accessKeySecret
#SMS signature
signature: Test Signature
#Template ID, used for sending SMS messages with a fixed template
templateId: SMS_215125134
#Template variables
templateName: code
#Request URL. Defaults to dysmsapi.aliyuncs.com. No need to configure unless special changes are required
requestUrl: dysmsapi.aliyuncs.com
huawei:
#Huawei SMS appKey
appKey: 5N6fvXXXX920HaWhVXXXXXX7fYa
#Huawei SMS appSecret
app-secret: Wujt7EYzZTBXXXXXXEhSP6XXXX
#SMS signature
signature: Huawei SMS Test
#Channel number
sender: 8823040504797
#Template ID. Not required when using the custom template sending method
template-id: acXXXXXXXXc274b2a8263479b954c1ab5
#Huawei callback URL. Leave unset or empty if not needed
statusCallBack:
#App request URL assigned by Huawei
url: [https://XXXXX.cn-north-4.XXXXXXXX.com:443](https://XXXXX.cn-north-4.XXXXXXXX.com:443)
3. Method Usage
@RestController
@RequestMapping("/test/")
public class DemoController {
// Test sending SMS messages using a fixed template
@RequestMapping("/")
public void doLogin(String username, String password) {
// Send an SMS to this phone number using Alibaba Cloud
SmsFactory.createSmsBlend(SupplierType.ALIBABA).sendMessage("18888888888","123456");
// Send an SMS to this phone number using Huawei Cloud
SmsFactory.createSmsBlend(SupplierType.HUAWEI).sendMessage("16666666666","000000");
}
}
Configuration Details
Thread Pool Configuration
Each provider has different levels of support for asynchronous SMS, and some providers do not support it at all. To provide a unified asynchronous SMS interface, we configure a thread pool to execute asynchronous SMS tasks. The default thread pool configuration is as follows:
sms: #Core thread pool size corePoolSize: 10 #Maximum number of threads maxPoolSize: 30 #Queue capacity queueCapacity: 50 #Keep-alive time keepAliveSeconds: 60 #Thread name prefix threadNamePrefix: sms-executor- #Wait for all tasks to complete before destroying other Beans when shutting down the thread pool shutdownStrategy: true
The above is the default thread pool configuration. You can customize it in your yml file according to your needs.