Official Ruby gem for the ClickSend API — send and manage SMS, MMS, email, voice, fax, letters, postcards, and more.
Add this to your Gemfile:
gem'clicksend',:git=>'https://github.com/ClickSend/clicksend-ruby-v2.git'Then run:
bundle installrequire'clicksend'ClickSend.configuredo |config|
config.username=ENV['CLICKSEND_USERNAME']config.password=ENV['CLICKSEND_API_KEY']endapi_instance=ClickSend::SmsApi.newsend_sms_request=ClickSend::SendSmsRequest.new(messages: [{source: 'sdk',body: 'Hello from ClickSend!',to: '+61411111111'}])beginresult=api_instance.send_sms(send_sms_request: send_sms_request)presultrescueClickSend::ApiError=>eputs"Exception when calling SmsApi->send_sms: #{e}"endapi_instance=ClickSend::ManagementApi.newbeginresult=api_instance.view_account_detailspresultrescueClickSend::ApiError=>eputs"Exception when calling ManagementApi->view_account_details: #{e}"endapi_instance=ClickSend::MmsApi.newsend_mms_request=ClickSend::SendMmsRequest.new(media_file: 'https://clicksend.com/logo.png',messages: [{source: 'sdk',to: '+61411111111',from: 'sdk',subject: 'Hello',body: 'Hello from ClickSend!'}])beginresult=api_instance.send_mms(send_mms_request: send_mms_request)presultrescueClickSend::ApiError=>eputs"Exception when calling MmsApi->send_mms: #{e}"endThe API uses HTTP Basic authentication — your ClickSend username and API key (available from the ClickSend Dashboard).
Full API reference: https://developers.clicksend.com/docs/rest/v3/
Need help? Contact ClickSend Support or visit the Help Centre.