VICTOR-LUO-F / aliyun-sms

a Ruby Gem for using aliyun sms service. 一个应用阿里云短信推送服务的Ruby Gem。
MIT License
69 stars 38 forks source link

SMS won't send - no error #12

Open bmrejen opened 4 years ago

bmrejen commented 4 years ago

I have this

Aliyun::Sms.configure do |config|
    config.access_key_id = ENV['ALIYUN_SMS_ID']            
    config.access_key_secret = ENV['ALIYUN_SMS_SECRET']    
    config.action = 'SendSms'                       # default value
    config.format = 'JSON'                           # http return format, value is 'JSON' or 'XML'
    config.region_id = 'cn-hangzhou'                # default value      
    config.sign_name = 'Plain'                  
    config.signature_method = 'HMAC-SHA1'           # default value
    config.signature_version = '1.0'                # default value
    config.version = '2017-05-25'                   # default value

    puts config.access_key_id, config.access_key_secret
end

phone_number = '15618928329'
template_code = 'SMS_180765444'
template_param = {"name"=>"hello"}.to_json
Aliyun::Sms.send(phone_number, template_code, template_param)

But I don't receive anything. I can find my sms templates on this address: https://dysms.console.aliyun.com/dysms.htm

and my credentials are fine.

Why doesn't it send? Where can I see the error?

bmrejen commented 4 years ago

@VICTOR-LUO-F @qwlong @wxjzeke

1c7 commented 4 years ago

Same here, need help or guidence (2020-2-25)

it only return this: image clearly it says response_code=400 but I have no idea what's wrong

1c7 commented 4 years ago

Opps, my mistake, I forgot to set sign_name

/config/initializers/aliyun-sms.rb image

.env image

Problem solved

image

1c7 commented 4 years ago

sign_name come from here

image

Just in case some people confused what it is

aggy-k commented 4 years ago

Got response_code=200 but SMS never received... also not logged on SMS send-out record on Aliyun.. Using official Ruby SDK with same credentials and other detail, SMS sent/received fine