aliyun - sms 发送短信

访问量: 973

代码如下:
# gem install aliyunsdkcore

require 'aliyunsdkcore'

client = RPCClient.new(
  access_key_id: '',
  access_key_secret: '',

  endpoint: 'https://dysmsapi.aliyuncs.com',
  api_version: '2017-05-25'
)

response = client.request(
  action: 'SendSms',
  params: {
    "PhoneNumbers": "13566667777",
    "SignName": "签名名字",
    "TemplateCode": "SMS_15050????",
    "TemplateParam": "{\"code\":\"bxss\"}"
},
  opts: {
    method: 'POST'
  }
)

print response

发送成功后,会的到下面的内容:


{"RequestId"=>"1DCC09DB-77F6-5184-8BFB-CE88E094CD18", "Message"=>"OK", "BizId"=>"814416837372570457^0", "Code"=>"OK"}

订阅/RSS Feed

Subscribe