Skip to content

Latest commit

 

History

History
42 lines (31 loc) · 1.19 KB

README.md

File metadata and controls

42 lines (31 loc) · 1.19 KB

AliyunSms

Build Status Hex.pm

Aliyun SMS API(阿里云短信服务 API)

Installation

If available in Hex, the package can be installed by adding aliyun_sms to your list of dependencies in mix.exs:

def deps do
  [
    {:aliyun_sms, "~> 0.2.2"}
  ]
end

Configuration

config :aliyun_sms,
  access_key_id: "ALIYUN_ACCESS_KEY_ID",
  access_key_secret: "ALIYUN_ACCESS_KEY_SECRET"

Usage

Aliyun.Sms.send_sms("1500000000", "sign", "template", %{code: "222333"})
#{:ok, %{"Code" => "OK", "Message" => "OK", ...}}
#{:error, code, %{"Code" => "isv.SMS_SIGNATURE_ILLEGAL", "Message" => "短信签名不合法"}}
#{:error, :http_error, reason}
#{:error, :json_decode_error, body}

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/aliyun_sms.