Skip to content

Latest commit

 

History

History
42 lines (33 loc) · 1.39 KB

README.md

File metadata and controls

42 lines (33 loc) · 1.39 KB

热巴云通讯 sdk


  • 添加maven依赖
<dependency>
    <groupId>com.github.rebayun</groupId>
    <artifactId>reba-sms-java-sdk</artifactId>
    <version>1.0.0</version>
</dependency>

如果非maven项目可手动获取jar包

  • 调用方法
 private static final String serverUrl = "https://api.100sms.cn/api";
 private static final String apikey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx";//修改为您的apikey
 private static final RebaClient client = new DefaultRebaClient(serverUrl, apikey);

 public void testSmsBatchSubmit() {
     try {
         client.smsBatchSubmit(Arrays.asList(
             new SmsSubmit("187xxxxxxxx", "【热巴云通讯】您的验证码是:1234"),//修改为你要发送的手机号和短信内容
             new SmsSubmit("186xxxxxxxx", "【热巴云通讯】您的验证码是:5678")//修改为你要发送的手机号和短信内容
         ));
     } catch (RebaApiException e) {
         System.out.println("RebaApiException, code: " + e.getCode() + ", message: " + e.getMessage());
     } catch (Exception e) {
         e.printStackTrace();
     }
 }

注意事项