Giter Club home page Giter Club logo

cloopen's Introduction

Cloopen

云通讯发送短信的 Gem。

Installation

Add this line to your application's Gemfile:

gem 'cloopen'

And then execute:

$ bundle

Or install it yourself as:

$ gem install cloopen

Usage

申请云通讯的短信通道服务

  1. 注册 云通讯 ,申请企业认证(只有企业帐号才可以发短信)。

  2. 这个页面 查看帐号的 account_sid, auth_token

  3. 这个页面 创建 App,获得 app_id

  4. 这里 创建你的短信模板,比如:

    【薄荷网】您的的验证码是{1}

  5. 等待云通讯的管理员审核,大概需要 2 个小时的时间。

    • App 通过审核
    • 短信模板通过审核

生成配置文件

  1. 执行 rails g cloopen 生成配置文件 config/initialiers/cloopen_setup.rb

  2. 替换 sid、token、app_id、env

# config/initialiers/cloopen_setup.rb
Cloopen.account_sid = "Your Yuntongxun Account Sid"
Cloopen.auth_token  = "Your Yuntongxun Auth token"
Cloopen.app_id      = "Your Yuntongxun App id"
Cloopen.env         = "production" # 如果是测试环境,填写 "development"

发送验证码

  Cloopen::SMS.deliver(18668189884, 3127, ['a32d1k'])   # 短信形式
  Cloopen::Voice.deliver(18668189884, 3127, ['a32d1k']) # 语音形式
  • 第一个参数是手机号码

  • 第二个是模板id。只能使用已审通过核的模板发短信。

  • 第三个是模板中的变量的值。用于替换模板中的变量 1 【薄荷网】您的的验证码是{1}

荣耀归给仨小伙

Contributing

  1. Fork it ( https://github.com/xiaoronglv/cloopen/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

cloopen's People

Contributors

debbbbie avatar teddy-ma avatar xiewenwei avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.