宏衍短信 hongyansms
客户接口说明
短信接口增加 JSON 格式,增加传递参数 rt=json,表示按 json 格式返回数据。
目录
官方 HTTP 接口
1. 发送短信接口
1.1 请求 URL
1.2 请求头
1.3 请求参数说明
参数
类型
是否必须
值-示例
解释说明
userid
int
是
123456
企业ID
timestamp
string
是
"1569227749245"
系统当时间戳
sign
string
是
"1569227749245"
使用 账号+密码+时间戳 生成MD5字符串作为签名 MD5生成32位,且需要小写
mobile
string
是
"13888888888,13988858555"
发信发送的目的号码.多个号码之间用半角逗号隔开
content
string
是
"【宏衍】这是测试短信"
发送短信的内容,内容需要UTF-8编码
sendTime
string
否
"2010-10-24 09:08:10"
定时发送时间,为空表示立即发送
action
string
否
"send"
发送任务命令,设置为固定的:send
extno
string
否
"12345"
扩展子号,请先询问配置的通道是否支持扩展子号,如果不支持,请填空。子号只能为数字,且最多10位数。
1.4 请求参数示例
{
"userid" : "123456" ,
"timestamp" : "1569227749245" ,
"sign" : "1569227749245" ,
"mobile" : "13888888888,13988858555" ,
"content" : "【宏衍】这是测试短信" ,
"sendTime" : "2010-10-24 09:08:10" ,
"action" : "send" ,
"extno" : "12345" ,
}
1.5 返回参数说明
1.6 返回参数示例
2. 余额及已发送量查询接口
2.1 请求 URL
2.2 请求头
2.3 请求参数说明
2.4 请求参数示例
2.5 返回参数说明
2.6 返回参数示例
3. 非法关键词查询
3.1 请求 URL
3.2 请求头
3.3 请求参数说明
3.4 请求参数示例
3.5 返回参数说明
3.6 返回参数示例
4. 状态报告接口
4.1 请求 URL
4.2 请求头
4.3 请求参数说明
4.4 请求参数示例
4.5 返回参数说明
4.6 返回参数示例
5. 上行接口
5.1 请求 URL
5.2 请求头
5.3 请求参数说明
5.4 请求参数示例
5.5 返回参数说明
5.6 返回参数示例
SDK
使用说明
// 1.引入模块
const HYSms = require ( "hongyansms" ) ;
const hysms = new HYSms ( {
userid,
username,
userpwd,
} ) ;
// 1.1 发送短信
hysms
. sendMessage ( {
mobile,
message,
senTime,
} )
. then ( ( res ) => {
console . log ( res . text ) ;
} ) ;
// 1.2 余额及已发送量查询
hysms . sendMessage ( { } ) . then ( ( res ) => {
console . log ( res . text ) ;
} ) ;
// 1.3 非法关键词查询
hysms
. sendMessage ( {
message,
} )
. then ( ( res ) => {
console . log ( res . text ) ;
} ) ;
// 1.4 状态报告接口
hysms . sendMessage ( { } ) . then ( ( res ) => {
console . log ( res . text ) ;
} ) ;
// 1.5 用户上行数据获取
hysms . sendMessage ( { } ) . then ( ( res ) => {
console . log ( res . text ) ;
} ) ;