gupshup

DESCRIPTION

gupshup is a Ruby wrapper for the HTTP APIs provided by SMS GupShup which is a Group SMS Platform for the enterprises with advanced features such as masks, keywords, text/flash/vcard/bulk messages, advertising and keyword campaigns and so on.

Documentation of HTTP APIs is available here: enterprise.smsgupshup.com/doc/GatewayAPIDoc.pdf

FEATURES

  • V 0.2.0 Return boolean status instead of raising exceptions. API_URL is now configurable.

  • V 0.1.5 Added group_post method and a generic call_api method. All methods now expect a hash of API params instead if individual arguments

  • V 0.1.2 Bulk file upload implemented. Only CSV format supported for now.

  • V 0.1.0 send_vcard and send_unicode_message implemented. Error checking.

  • V 0.0.5 send_text_message and send_flash_message are implemented

  • V 0.0.1 send_message is implemented.

USAGE

# "target_phone_number" should be a 12 digit Indian mobile number starting with "91" (either integer or string)

gup = Gupshup::Enterprise.new(:userid => 'your_gupshup_login', :password => 'your_password')

#optional parameters
  mask - An alphanumeric string with maximum length of 8 characters. Each enterprise account has a default mask. Each account can have multiple masks, preapproved by Enterprise Support team. If no mask is specified, the default mask is chosen.

  override_dnd - Specifies if the message to be sent to a number listed in DND(Do Not Disturb) list. By default value is false

  gup = Gupshup::Enterprise.new(:userid => 'your_gupshup_login', :password => 'your_password', :mask => 'maskname', :override_dnd => true)

#send a normal text message
gup.send_text_message(:msg => 'sms message text', :send_to => '91xxxxxxxxxx')

#flash messages appear on mobile's screen immediately but may not be saved on some handsets
gup.send_flash_message(:msg => 'sms message text', :send_to => '91xxxxxxxxxx')

#send a contact in VCARD format
vcard = "BEGIN:VCARD\r\nVERSION:1.2\r\nN:ICICI\r\nTEL:18002098888\r\nEND:VCARD"
gup.send_vcard(:msg => vcard, :send_to => '91xxxxxxxxxx')

#send a non-english message with a hex-encoded UTF-8 string
gup.send_unicode_message(:msg => "\xE0\xA4\x97\xE0\xA4\xAA\xE0\xA4\xB6\xE0\xA4\xAA", :send_to => '91xxxxxxxxxx') # will send "gupshup" in Devnagari script

#Upload a CSV file for bulk messages
gup.bulk_file_upload(file_path)

REQUIREMENTS

  • httpclient

Installation

* Include the gem in your Gemfile:

gem 'parity-gupshup', '~> 2.0.0'

* Or

sudo gem install parity-gupshup