README.md in messente_api-1.4.0 vs README.md in messente_api-2.1.0

- old
+ new

@@ -1,9 +1,9 @@ # Messente API Library -- Messente API version: 1.4.0 -- Ruby gem version: 1.4.0 +- Messente API version: 2.0.0 +- Ruby gem version: 2.1.0 [Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you&#39;re not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world. ## Installation @@ -23,10 +23,14 @@ 1. Adds a phone number to the blacklist [`add_to_blacklist`](docs/BlacklistApi.md#add_to_blacklist) 1. Deletes a phone number from the blacklist [`delete_from_blacklist`](docs/BlacklistApi.md#delete_from_blacklist) 1. Returns all blacklisted phone numbers [`fetch_blacklist`](docs/BlacklistApi.md#fetch_blacklist) 1. Checks if a phone number is blacklisted [`is_blacklisted`](docs/BlacklistApi.md#is_blacklisted) +### BulkMessagingApi + +1. Sends a bulk Omnimessage [`send_bulk_omnimessage`](docs/BulkMessagingApi.md#send_bulk_omnimessage) + ### ContactsApi 1. Adds a contact to a group [`add_contact_to_group`](docs/ContactsApi.md#add_contact_to_group) 1. Creates a new contact [`create_contact`](docs/ContactsApi.md#create_contact) 1. Deletes a contact [`delete_contact`](docs/ContactsApi.md#delete_contact) @@ -79,41 +83,40 @@ config.password = '<MESSENTE_API_PASSWORD>' end api_instance = MessenteApi::OmnimessageApi.new omnimessage = MessenteApi::Omnimessage.new -omnimessage.to = '<phone number in e.164 format>' -omnimessage.messages = [ - MessenteApi::SMS.new( - { - :sender => "<sender name or phone number in e.164 format>", - :text => "Hello SMS!" - } - ), - MessenteApi::WhatsApp.new( - { - :sender => "<sender name or phone number in e.164 format>", - :text => MessenteApi::WhatsAppText.new( - { - :body => "Hello from WhatsApp!", - :preview_url => false - } - ) - } - ), - MessenteApi::Viber.new( - { - :sender => "<sender name or phone number in e.164 format>", - :text => "Hello from Viber!" - } - ) +omnimessage.to = '<recipient_phone_number>' + +sms = MessenteApi::SMS.new( + sender: "<sender name (optional)>", + text: "Hello SMS!" +) + +viber = MessenteApi::Viber.new( + sender: "<sender name (optional)>", + text: "Hello from Viber!" +) + +wa_parameters = [ + MessenteApi::WhatsAppParameter.new(type: 'text', text: 'hello whatsapp'), ] +wa_component = MessenteApi::WhatsAppComponent.new(type: 'body', parameters: wa_parameters) +wa_lang = MessenteApi::WhatsAppLanguage.new(code: '<language_code>') +wa_template = MessenteApi::WhatsAppTemplate.new(name: '<template_name>', language: wa_lang, components: [wa_component]) +whatsapp = MessenteApi::WhatsApp.new( + sender: '<sender name (optional)>', + template: wa_template, +) +omnimessage.messages = [sms, viber, whatsapp] + begin - result = api_instance.send_omnimessage(omnimessage) + result = api_instance.send_omnimessage(omnimessage) + puts result rescue MessenteApi::ApiError => e - puts "Exception when calling send_omnimessage: #{e}" - puts e.response_body + puts "Exception when calling send_omnimessage: #{e}" + puts e.response_body end ``` ## License