diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 0000000..92961aa --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,19 @@ +name: validate-pr +on: pull_request + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: "Checkout Project" + uses: actions/checkout@v1 + with: + fetch-depth: 1 + - name: "Docker run test" + env: # Or as an environment variable + CLIENT_ID: ${{ secrets.CLIENT_ID }} + CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} + PHONE_NO: ${{ secrets.PHONE_NO }} + FROM_ALIAS: ${{ secrets.FROM_ALIAS }} + run: docker-compose up --build --exit-code-from telstradev \ No newline at end of file diff --git a/.rubocop.yml b/.rubocop.yml index 98c7e3c..0ef33ce 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,7 +1,7 @@ # This file is based on https://github.com/rails/rails/blob/master/.rubocop.yml (MIT license) # Automatically generated by OpenAPI Generator (https://openapi-generator.tech) AllCops: - TargetRubyVersion: 2.2 + TargetRubyVersion: 2.4 # RuboCop has a bunch of cops enabled by default. This setting tells RuboCop # to ignore them, so only the ones explicitly set in this file are enabled. DisabledByDefault: true @@ -46,7 +46,7 @@ Layout/EmptyLinesAroundMethodBody: Layout/EmptyLinesAroundModuleBody: Enabled: true -Layout/FirstParameterIndentation: +Layout/IndentFirstArgument: Enabled: true # Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }. diff --git a/DockerFile b/DockerFile new file mode 100644 index 0000000..cce883e --- /dev/null +++ b/DockerFile @@ -0,0 +1,14 @@ +FROM ruby:2.7.0 + +WORKDIR /app +COPY . . + +RUN bundle install --verbose + +RUN rake + +RUN gem build Telstra_Messaging.gemspec + +RUN gem install ./Telstra_Messaging-1.0.8.gem + +CMD ["ruby", "backward-compat-test.rb"] \ No newline at end of file diff --git a/Gemfile b/Gemfile index d255a3a..69255e5 100644 --- a/Gemfile +++ b/Gemfile @@ -4,4 +4,6 @@ gemspec group :development, :test do gem 'rake', '~> 12.0.0' + gem 'pry-byebug' + gem 'rubocop', '~> 0.66.0' end diff --git a/README.md b/README.md index be83d96..979a7bd 100644 --- a/README.md +++ b/README.md @@ -2,149 +2,13 @@ Telstra_Messaging - the Ruby gem for the Telstra Messaging API +The Telstra Messaging API specification -# Introduction - - -# Features - -The Telstra Messaging API provides the features below. -| Feature | Description | -| --- | --- | -| `Dedicated Number` | Provision a mobile number for your account to be used as `from` address in the API | -| `Send Messages` | Sending SMS or MMS messages | -| `Receive Messages` | Telstra will deliver messages sent to a dedicated number or to the `notifyURL` defined by you | -| `Broadcast Messages` | Invoke a single API call to send a message to a list of numbers provided in `to` | -| `Delivery Status` | Query the delivery status of your messages | -| `Callbacks` | Provide a notification URL and Telstra will notify your app when a message status changes | -| `Alphanumeric Identifier` | Differentiate yourself by providing an alphanumeric string in `from`. This feature is only available on paid plans | -| `Concatenation` | Send messages up to 1900 characters long and Telstra will automaticaly segment and reassemble them | -| `Reply Request` | Create a chat session by associating `messageId` and `to` number to track responses received from a mobile number. We will store this association for 8 days | -| `Character set` | Accepts all Unicode characters as part of UTF-8 | -| `Bounce-back response` | See if your SMS hits an unreachable or unallocated number (Australia Only) | -| `Queuing` | Messaging API will automatically queue and deliver each message at a compliant rate. | -| `Emoji Encoding` | The API supports the encoding of the full range of emojis. Emojis in the reply messages will be in their UTF-8 format. | - -## Delivery Notification or Callbacks - -The API provides several methods for notifying when a message has been delivered to the destination. - -1. When you send a message there is an opportunity to specify a `notifyURL`. Once the message has been delivered the API will make a call to this URL to advise of the message status. -2. If you do not specify a URL you can always call the `GET /status` API to get the status of the message. - -# Getting Access to the API - -1. Register at [https://dev.telstra.com](https://dev.telstra.com). -2. After registration, login to [https://dev.telstra.com](https://dev.telstra.com) and navigate to the **My apps** page. -3. Create your application by clicking the **Add new app** button -4. Select **API Free Trial** Product when configuring your application. This Product includes the Telstra Messaging API as well as other free trial APIs. Your application will be approved automatically. -5. There is a maximum of 1000 free messages per developer. Additional messages and features can be purchased from [https://dev.telstra.com](https://dev.telstra.com). -6. Note your `Client key` and `Client secret` as these will be needed to provision a number for your application and for authentication. - -Now head over to **Getting Started** where you can find a postman collection as well as some links to sample apps and SDKs to get you started. - -Happy Messaging! - -# Frequently Asked Questions - -**Q: Is creating a subscription via the Provisioning call a required step?** - -A. Yes. You will only be able to start sending messages if you have a provisioned dedicated number. Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. - -**Q: When trying to send an SMS I receive a `400 Bad Request` response. How can I fix this?** - -A. You need to make sure you have a provisioned dedicated number before you can send an SMS. -If you do not have a provisioned dedicated number and you try to send a message via the API, you will get the error below in the response: - -
{
-  \"status\":\"400\",
-  \"code\":\"DELIVERY-IMPOSSIBLE\",
-  \"message\":\"Invalid \\'from\\' address specified\"
-}
- -Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. - -**Q: How long does my dedicated number stay active for?** - -A. When you provision a dedicated number, by default it will be active for 30 days. -You can use the `activeDays` parameter during the provisioning call to increment or decrement the number of days your dedicated number will remain active. - -Note that Free Trial apps will have 30 days as the maximum `activeDays` they can add to their provisioned number. If the Provisioning call is made several times within that 30-Day period, it will return the `expiryDate` in the Unix format and will not add any activeDays until after that `expiryDate`. - -**Q: Can I send a broadcast message using the Telstra Messaging API?** - -A. Yes. Recipient numbers can be in the form of an array of strings if a broadcast message needs to be sent, allowing you to send to multiple mobile numbers in one API call. - A sample request body for this will be: `{\"to\":[\"+61412345678\",\"+61487654321\"],\"body\":\"Test Message\"}` - -**Q: Can I send SMS and MMS to all countries?** - -A. You can send SMS and MMS to all countries EXCEPT to countries which are subject to global sanctions namely: Burma, Côte d'Ivoire, Cuba, Iran, North Korea, Syria. - -**Q: Can I use `Alphanumeric Identifier` from my paid plan via credit card?** - -A. `Alphanumeric Identifier` is only available on Telstra Account paid plans, not through credit card paid plans. - -**Q: What is the maximum sized MMS that I can send?** - -A. This will depend on the carrier that will receive the MMS. For Telstra it's up to 2MB, Optus up to 1.5MB and Vodafone only allows up to 500kB. You will need to check with international carriers for thier MMS size limits. - -**Q: How is the size of an MMS calculated?** - -A. Images are scaled up to approximately 4/3 when base64 encoded. -Additionally, there is approximately 200 bytes of overhead on each MMS. -Assuming the maximum MMS that can be sent on Telstra’s network is 2MB, then the maximum image size that can be sent will be approximately 1.378MB (1.378 x 1.34 + 200, without SOAP encapsulation). - -**Q: How is an MMS classified as Small or Large?** - -A. MMSes with size below 600kB are classed as Small whereas those that are bigger than 600kB are classed as Large. They will be charged accordingly. - -**Q: Are SMILs supported by the Messaging API?** - -A. While there will be no error if you send an MMS with a SMIL presentation, the actual layout or sequence defined in the SMIL may not display as expected because most of the new smartphone devices ignore the SMIL presentation layer. SMIL was used in feature phones which had limited capability and SMIL allowed a *powerpoint type* presentation to be provided. Smartphones now have the capability to display video which is the better option for presentations. It is recommended that MMS messages should just drop the SMIL. - -**Q: How do I assign a delivery notification or callback URL?** - -A. You can assign a delivery notification or callback URL by adding the `notifyURL` parameter in the body of the request when you send a message. Once the message has been delivered, a notification will then be posted to this callback URL. - -**Q: What is the difference between the `notifyURL` parameter in the Provisoning call versus the `notifyURL` parameter in the Send Message call?** - -A. The `notifyURL` in the Provisoning call will be the URL where replies to the provisioned number will be posted. -On the other hand, the `notifyURL` in the Send Message call will be the URL where the delivery notification will be posted, e.g. when an SMS has already been delivered to the recipient. - -# Getting Started - -Below are the steps to get started with the Telstra Messaging API. - 1. Generate an OAuth2 token using your `Client key` and `Client secret`. - 2. Use the Provisioning call to create a subscription and receive a dedicated number. - 3. Send a message to a specific mobile number. - -## Run in Postman -\"Run - -## Sample Apps - - [Perl Sample App](https://github.com/telstra/MessagingAPI-perl-sample-app) - - [Happy Chat App](https://github.com/telstra/messaging-sample-code-happy-chat) - - [PHP Sample App](https://github.com/developersteve/telstra-messaging-php) - -## SDK Repos - - [Messaging API - PHP SDK](https://github.com/telstra/MessagingAPI-SDK-php) - - [Messaging API - Python SDK](https://github.com/telstra/MessagingAPI-SDK-python) - - [Messaging API - Ruby SDK](https://github.com/telstra/MessagingAPI-SDK-ruby) - - [Messaging API - NodeJS SDK](https://github.com/telstra/MessagingAPI-SDK-node) - - [Messaging API - .Net2 SDK](https://github.com/telstra/MessagingAPI-SDK-dotnet) - - [Messaging API - Java SDK](https://github.com/telstra/MessagingAPI-SDK-Java) - -## Blog Posts -For more information on the Messaging API, you can read these blog posts: -- [Callbacks Part 1](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-1) -- [Callbacks Part 2](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-2) - - +This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: - API version: 2.2.9 -- Package version: 1.0.6 +- Package version: 1.0.8 +- Build package: org.openapitools.codegen.languages.RubyClientCodegen ## Installation @@ -159,15 +23,16 @@ gem build Telstra_Messaging.gemspec Then either install the gem locally: ```shell -gem install ./Telstra_Messaging-1.0.6.gem +gem install ./Telstra_Messaging-1.0.8.gem ``` -(for development, run `gem install --dev ./Telstra_Messaging-1.0.6.gem` to install the development dependencies) + +(for development, run `gem install --dev ./Telstra_Messaging-1.0.8.gem` to install the development dependencies) or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/). Finally add this to the Gemfile: - gem 'Telstra_Messaging', '~> 1.0.6' + gem 'Telstra_Messaging', '~> 1.0.8' ### Install from Git @@ -186,6 +51,7 @@ ruby -Ilib script.rb ## Getting Started Please follow the [installation](#installation) procedure and then run the following code: + ```ruby # Load the gem require 'Telstra_Messaging' @@ -194,10 +60,13 @@ api_instance = Telstra_Messaging::AuthenticationApi.new client_id = 'client_id_example' # String | client_secret = 'client_secret_example' # String | grant_type = 'client_credentials' # String | +opts = { + scope: 'scope_example' # String | NSMS +} begin #Generate OAuth2 token - result = api_instance.auth_token(client_id, client_secret, grant_type) + result = api_instance.auth_token(client_id, client_secret, grant_type, opts) p result rescue Telstra_Messaging::ApiError => e puts "Exception when calling AuthenticationApi->auth_token: #{e}" @@ -214,8 +83,11 @@ Class | Method | HTTP request | Description *Telstra_Messaging::AuthenticationApi* | [**auth_token**](docs/AuthenticationApi.md#auth_token) | **POST** /oauth/token | Generate OAuth2 token *Telstra_Messaging::MessagingApi* | [**get_mms_status**](docs/MessagingApi.md#get_mms_status) | **GET** /messages/mms/{messageid}/status | Get MMS Status *Telstra_Messaging::MessagingApi* | [**get_sms_status**](docs/MessagingApi.md#get_sms_status) | **GET** /messages/sms/{messageId}/status | Get SMS Status -*Telstra_Messaging::MessagingApi* | [**retrieve_mms_responses**](docs/MessagingApi.md#retrieve_mms_responses) | **GET** /messages/mms | Retrieve MMS Responses -*Telstra_Messaging::MessagingApi* | [**retrieve_sms_responses**](docs/MessagingApi.md#retrieve_sms_responses) | **GET** /messages/sms | Retrieve SMS Responses +*Telstra_Messaging::MessagingApi* | [**m_ms_health_check**](docs/MessagingApi.md#m_ms_health_check) | **GET** /messages/mms/healthcheck | MMS Health Check +*Telstra_Messaging::MessagingApi* | [**retrieve_mms_replies**](docs/MessagingApi.md#retrieve_mms_replies) | **GET** /messages/mms | Retrieve MMS Replies +*Telstra_Messaging::MessagingApi* | [**retrieve_sms_replies**](docs/MessagingApi.md#retrieve_sms_replies) | **GET** /messages/sms | Retrieve SMS Replies +*Telstra_Messaging::MessagingApi* | [**s_ms_health_check**](docs/MessagingApi.md#s_ms_health_check) | **GET** /messages/sms/healthcheck | SMS Health Check +*Telstra_Messaging::MessagingApi* | [**s_ms_multi**](docs/MessagingApi.md#s_ms_multi) | **POST** /messages/sms/multi | Send Multiple SMS *Telstra_Messaging::MessagingApi* | [**send_mms**](docs/MessagingApi.md#send_mms) | **POST** /messages/mms | Send MMS *Telstra_Messaging::MessagingApi* | [**send_sms**](docs/MessagingApi.md#send_sms) | **POST** /messages/sms | Send SMS *Telstra_Messaging::ProvisioningApi* | [**create_subscription**](docs/ProvisioningApi.md#create_subscription) | **POST** /messages/provisioning/subscriptions | Create Subscription @@ -226,28 +98,34 @@ Class | Method | HTTP request | Description ## Documentation for Models - [Telstra_Messaging::DeleteNumberRequest](docs/DeleteNumberRequest.md) + - [Telstra_Messaging::GetMmsResponse](docs/GetMmsResponse.md) - [Telstra_Messaging::GetSubscriptionResponse](docs/GetSubscriptionResponse.md) + - [Telstra_Messaging::HealthCheckResponse](docs/HealthCheckResponse.md) - [Telstra_Messaging::InboundPollResponse](docs/InboundPollResponse.md) - [Telstra_Messaging::MMSContent](docs/MMSContent.md) - [Telstra_Messaging::Message](docs/Message.md) - - [Telstra_Messaging::MessageSentResponse](docs/MessageSentResponse.md) + - [Telstra_Messaging::MessageMulti](docs/MessageMulti.md) + - [Telstra_Messaging::MessageSentResponseMms](docs/MessageSentResponseMms.md) + - [Telstra_Messaging::MessageSentResponseSms](docs/MessageSentResponseSms.md) - [Telstra_Messaging::OAuthResponse](docs/OAuthResponse.md) - [Telstra_Messaging::OutboundPollResponse](docs/OutboundPollResponse.md) - [Telstra_Messaging::ProvisionNumberRequest](docs/ProvisionNumberRequest.md) - [Telstra_Messaging::ProvisionNumberResponse](docs/ProvisionNumberResponse.md) - [Telstra_Messaging::SendMmsRequest](docs/SendMmsRequest.md) - [Telstra_Messaging::SendSMSRequest](docs/SendSMSRequest.md) + - [Telstra_Messaging::SendSmsMultiRequest](docs/SendSmsMultiRequest.md) - [Telstra_Messaging::Status](docs/Status.md) -## Documentation for Authorisation +## Documentation for Authorization ### auth + - **Type**: OAuth - **Flow**: application -- **Authorisation URL**: +- **Authorization URL**: - **Scopes**: - NSMS: NSMS diff --git a/Telstra_Messaging.gemspec b/Telstra_Messaging.gemspec index 063e07e..f6692ef 100644 --- a/Telstra_Messaging.gemspec +++ b/Telstra_Messaging.gemspec @@ -3,12 +3,12 @@ =begin #Telstra Messaging API -# # Introduction

Send and receive SMS and MMS messages globally using Telstra's enterprise grade Messaging API. It also allows your application to track the delivery status of both sent and received messages. Get your dedicated Australian number, and start sending and receiving messages today.

# Features The Telstra Messaging API provides the features below. | Feature | Description | | --- | --- | | `Dedicated Number` | Provision a mobile number for your account to be used as `from` address in the API | | `Send Messages` | Sending SMS or MMS messages | | `Receive Messages` | Telstra will deliver messages sent to a dedicated number or to the `notifyURL` defined by you | | `Broadcast Messages` | Invoke a single API call to send a message to a list of numbers provided in `to` | | `Delivery Status` | Query the delivery status of your messages | | `Callbacks` | Provide a notification URL and Telstra will notify your app when a message status changes | | `Alphanumeric Identifier` | Differentiate yourself by providing an alphanumeric string in `from`. This feature is only available on paid plans | | `Concatenation` | Send messages up to 1900 characters long and Telstra will automaticaly segment and reassemble them | | `Reply Request` | Create a chat session by associating `messageId` and `to` number to track responses received from a mobile number. We will store this association for 8 days | | `Character set` | Accepts all Unicode characters as part of UTF-8 | | `Bounce-back response` | See if your SMS hits an unreachable or unallocated number (Australia Only) | | `Queuing` | Messaging API will automatically queue and deliver each message at a compliant rate. | | `Emoji Encoding` | The API supports the encoding of the full range of emojis. Emojis in the reply messages will be in their UTF-8 format. | ## Delivery Notification or Callbacks The API provides several methods for notifying when a message has been delivered to the destination. 1. When you send a message there is an opportunity to specify a `notifyURL`. Once the message has been delivered the API will make a call to this URL to advise of the message status. 2. If you do not specify a URL you can always call the `GET /status` API to get the status of the message. # Getting Access to the API 1. Register at [https://dev.telstra.com](https://dev.telstra.com). 2. After registration, login to [https://dev.telstra.com](https://dev.telstra.com) and navigate to the **My apps** page. 3. Create your application by clicking the **Add new app** button 4. Select **API Free Trial** Product when configuring your application. This Product includes the Telstra Messaging API as well as other free trial APIs. Your application will be approved automatically. 5. There is a maximum of 1000 free messages per developer. Additional messages and features can be purchased from [https://dev.telstra.com](https://dev.telstra.com). 6. Note your `Client key` and `Client secret` as these will be needed to provision a number for your application and for authentication. Now head over to **Getting Started** where you can find a postman collection as well as some links to sample apps and SDKs to get you started. Happy Messaging! # Frequently Asked Questions **Q: Is creating a subscription via the Provisioning call a required step?** A. Yes. You will only be able to start sending messages if you have a provisioned dedicated number. Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: When trying to send an SMS I receive a `400 Bad Request` response. How can I fix this?** A. You need to make sure you have a provisioned dedicated number before you can send an SMS. If you do not have a provisioned dedicated number and you try to send a message via the API, you will get the error below in the response:
{   \"status\":\"400\",   \"code\":\"DELIVERY-IMPOSSIBLE\",   \"message\":\"Invalid \\'from\\' address specified\" }
Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: How long does my dedicated number stay active for?** A. When you provision a dedicated number, by default it will be active for 30 days. You can use the `activeDays` parameter during the provisioning call to increment or decrement the number of days your dedicated number will remain active. Note that Free Trial apps will have 30 days as the maximum `activeDays` they can add to their provisioned number. If the Provisioning call is made several times within that 30-Day period, it will return the `expiryDate` in the Unix format and will not add any activeDays until after that `expiryDate`. **Q: Can I send a broadcast message using the Telstra Messaging API?** A. Yes. Recipient numbers can be in the form of an array of strings if a broadcast message needs to be sent, allowing you to send to multiple mobile numbers in one API call. A sample request body for this will be: `{\"to\":[\"+61412345678\",\"+61487654321\"],\"body\":\"Test Message\"}` **Q: Can I send SMS and MMS to all countries?** A. You can send SMS and MMS to all countries EXCEPT to countries which are subject to global sanctions namely: Burma, Côte d'Ivoire, Cuba, Iran, North Korea, Syria. **Q: Can I use `Alphanumeric Identifier` from my paid plan via credit card?** A. `Alphanumeric Identifier` is only available on Telstra Account paid plans, not through credit card paid plans. **Q: What is the maximum sized MMS that I can send?** A. This will depend on the carrier that will receive the MMS. For Telstra it's up to 2MB, Optus up to 1.5MB and Vodafone only allows up to 500kB. You will need to check with international carriers for thier MMS size limits. **Q: How is the size of an MMS calculated?** A. Images are scaled up to approximately 4/3 when base64 encoded. Additionally, there is approximately 200 bytes of overhead on each MMS. Assuming the maximum MMS that can be sent on Telstra’s network is 2MB, then the maximum image size that can be sent will be approximately 1.378MB (1.378 x 1.34 + 200, without SOAP encapsulation). **Q: How is an MMS classified as Small or Large?** A. MMSes with size below 600kB are classed as Small whereas those that are bigger than 600kB are classed as Large. They will be charged accordingly. **Q: Are SMILs supported by the Messaging API?** A. While there will be no error if you send an MMS with a SMIL presentation, the actual layout or sequence defined in the SMIL may not display as expected because most of the new smartphone devices ignore the SMIL presentation layer. SMIL was used in feature phones which had limited capability and SMIL allowed a *powerpoint type* presentation to be provided. Smartphones now have the capability to display video which is the better option for presentations. It is recommended that MMS messages should just drop the SMIL. **Q: How do I assign a delivery notification or callback URL?** A. You can assign a delivery notification or callback URL by adding the `notifyURL` parameter in the body of the request when you send a message. Once the message has been delivered, a notification will then be posted to this callback URL. **Q: What is the difference between the `notifyURL` parameter in the Provisoning call versus the `notifyURL` parameter in the Send Message call?** A. The `notifyURL` in the Provisoning call will be the URL where replies to the provisioned number will be posted. On the other hand, the `notifyURL` in the Send Message call will be the URL where the delivery notification will be posted, e.g. when an SMS has already been delivered to the recipient. # Getting Started Below are the steps to get started with the Telstra Messaging API. 1. Generate an OAuth2 token using your `Client key` and `Client secret`. 2. Use the Provisioning call to create a subscription and receive a dedicated number. 3. Send a message to a specific mobile number. ## Run in Postman \"Run ## Sample Apps - [Perl Sample App](https://github.com/telstra/MessagingAPI-perl-sample-app) - [Happy Chat App](https://github.com/telstra/messaging-sample-code-happy-chat) - [PHP Sample App](https://github.com/developersteve/telstra-messaging-php) ## SDK Repos - [Messaging API - PHP SDK](https://github.com/telstra/MessagingAPI-SDK-php) - [Messaging API - Python SDK](https://github.com/telstra/MessagingAPI-SDK-python) - [Messaging API - Ruby SDK](https://github.com/telstra/MessagingAPI-SDK-ruby) - [Messaging API - NodeJS SDK](https://github.com/telstra/MessagingAPI-SDK-node) - [Messaging API - .Net2 SDK](https://github.com/telstra/MessagingAPI-SDK-dotnet) - [Messaging API - Java SDK](https://github.com/telstra/MessagingAPI-SDK-Java) ## Blog Posts For more information on the Messaging API, you can read these blog posts: - [Callbacks Part 1](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-1) - [Callbacks Part 2](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-2) +#The Telstra Messaging API specification -OpenAPI spec version: 2.2.9 +The version of the OpenAPI document: 2.2.9 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0 +OpenAPI Generator version: 4.2.3-SNAPSHOT =end @@ -23,7 +23,7 @@ Gem::Specification.new do |s| s.email = [""] s.homepage = "https://dev.telstra.com" s.summary = "Telstra Messaging API Ruby Gem" - s.description = " # Introduction

Send and receive SMS and MMS messages globally using Telstra's enterprise grade Messaging API. It also allows your application to track the delivery status of both sent and received messages. Get your dedicated Australian number, and start sending and receiving messages today.

# Features The Telstra Messaging API provides the features below. | Feature | Description | | --- | --- | | `Dedicated Number` | Provision a mobile number for your account to be used as `from` address in the API | | `Send Messages` | Sending SMS or MMS messages | | `Receive Messages` | Telstra will deliver messages sent to a dedicated number or to the `notifyURL` defined by you | | `Broadcast Messages` | Invoke a single API call to send a message to a list of numbers provided in `to` | | `Delivery Status` | Query the delivery status of your messages | | `Callbacks` | Provide a notification URL and Telstra will notify your app when a message status changes | | `Alphanumeric Identifier` | Differentiate yourself by providing an alphanumeric string in `from`. This feature is only available on paid plans | | `Concatenation` | Send messages up to 1900 characters long and Telstra will automaticaly segment and reassemble them | | `Reply Request` | Create a chat session by associating `messageId` and `to` number to track responses received from a mobile number. We will store this association for 8 days | | `Character set` | Accepts all Unicode characters as part of UTF-8 | | `Bounce-back response` | See if your SMS hits an unreachable or unallocated number (Australia Only) | | `Queuing` | Messaging API will automatically queue and deliver each message at a compliant rate. | | `Emoji Encoding` | The API supports the encoding of the full range of emojis. Emojis in the reply messages will be in their UTF-8 format. | ## Delivery Notification or Callbacks The API provides several methods for notifying when a message has been delivered to the destination. 1. When you send a message there is an opportunity to specify a `notifyURL`. Once the message has been delivered the API will make a call to this URL to advise of the message status. 2. If you do not specify a URL you can always call the `GET /status` API to get the status of the message. # Getting Access to the API 1. Register at [https://dev.telstra.com](https://dev.telstra.com). 2. After registration, login to [https://dev.telstra.com](https://dev.telstra.com) and navigate to the **My apps** page. 3. Create your application by clicking the **Add new app** button 4. Select **API Free Trial** Product when configuring your application. This Product includes the Telstra Messaging API as well as other free trial APIs. Your application will be approved automatically. 5. There is a maximum of 1000 free messages per developer. Additional messages and features can be purchased from [https://dev.telstra.com](https://dev.telstra.com). 6. Note your `Client key` and `Client secret` as these will be needed to provision a number for your application and for authentication. Now head over to **Getting Started** where you can find a postman collection as well as some links to sample apps and SDKs to get you started. Happy Messaging! # Frequently Asked Questions **Q: Is creating a subscription via the Provisioning call a required step?** A. Yes. You will only be able to start sending messages if you have a provisioned dedicated number. Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: When trying to send an SMS I receive a `400 Bad Request` response. How can I fix this?** A. You need to make sure you have a provisioned dedicated number before you can send an SMS. If you do not have a provisioned dedicated number and you try to send a message via the API, you will get the error below in the response:
{   \"status\":\"400\",   \"code\":\"DELIVERY-IMPOSSIBLE\",   \"message\":\"Invalid \\'from\\' address specified\" }
Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: How long does my dedicated number stay active for?** A. When you provision a dedicated number, by default it will be active for 30 days. You can use the `activeDays` parameter during the provisioning call to increment or decrement the number of days your dedicated number will remain active. Note that Free Trial apps will have 30 days as the maximum `activeDays` they can add to their provisioned number. If the Provisioning call is made several times within that 30-Day period, it will return the `expiryDate` in the Unix format and will not add any activeDays until after that `expiryDate`. **Q: Can I send a broadcast message using the Telstra Messaging API?** A. Yes. Recipient numbers can be in the form of an array of strings if a broadcast message needs to be sent, allowing you to send to multiple mobile numbers in one API call. A sample request body for this will be: `{\"to\":[\"+61412345678\",\"+61487654321\"],\"body\":\"Test Message\"}` **Q: Can I send SMS and MMS to all countries?** A. You can send SMS and MMS to all countries EXCEPT to countries which are subject to global sanctions namely: Burma, Côte d'Ivoire, Cuba, Iran, North Korea, Syria. **Q: Can I use `Alphanumeric Identifier` from my paid plan via credit card?** A. `Alphanumeric Identifier` is only available on Telstra Account paid plans, not through credit card paid plans. **Q: What is the maximum sized MMS that I can send?** A. This will depend on the carrier that will receive the MMS. For Telstra it's up to 2MB, Optus up to 1.5MB and Vodafone only allows up to 500kB. You will need to check with international carriers for thier MMS size limits. **Q: How is the size of an MMS calculated?** A. Images are scaled up to approximately 4/3 when base64 encoded. Additionally, there is approximately 200 bytes of overhead on each MMS. Assuming the maximum MMS that can be sent on Telstra’s network is 2MB, then the maximum image size that can be sent will be approximately 1.378MB (1.378 x 1.34 + 200, without SOAP encapsulation). **Q: How is an MMS classified as Small or Large?** A. MMSes with size below 600kB are classed as Small whereas those that are bigger than 600kB are classed as Large. They will be charged accordingly. **Q: Are SMILs supported by the Messaging API?** A. While there will be no error if you send an MMS with a SMIL presentation, the actual layout or sequence defined in the SMIL may not display as expected because most of the new smartphone devices ignore the SMIL presentation layer. SMIL was used in feature phones which had limited capability and SMIL allowed a *powerpoint type* presentation to be provided. Smartphones now have the capability to display video which is the better option for presentations. It is recommended that MMS messages should just drop the SMIL. **Q: How do I assign a delivery notification or callback URL?** A. You can assign a delivery notification or callback URL by adding the `notifyURL` parameter in the body of the request when you send a message. Once the message has been delivered, a notification will then be posted to this callback URL. **Q: What is the difference between the `notifyURL` parameter in the Provisoning call versus the `notifyURL` parameter in the Send Message call?** A. The `notifyURL` in the Provisoning call will be the URL where replies to the provisioned number will be posted. On the other hand, the `notifyURL` in the Send Message call will be the URL where the delivery notification will be posted, e.g. when an SMS has already been delivered to the recipient. # Getting Started Below are the steps to get started with the Telstra Messaging API. 1. Generate an OAuth2 token using your `Client key` and `Client secret`. 2. Use the Provisioning call to create a subscription and receive a dedicated number. 3. Send a message to a specific mobile number. ## Run in Postman \"Run ## Sample Apps - [Perl Sample App](https://github.com/telstra/MessagingAPI-perl-sample-app) - [Happy Chat App](https://github.com/telstra/messaging-sample-code-happy-chat) - [PHP Sample App](https://github.com/developersteve/telstra-messaging-php) ## SDK Repos - [Messaging API - PHP SDK](https://github.com/telstra/MessagingAPI-SDK-php) - [Messaging API - Python SDK](https://github.com/telstra/MessagingAPI-SDK-python) - [Messaging API - Ruby SDK](https://github.com/telstra/MessagingAPI-SDK-ruby) - [Messaging API - NodeJS SDK](https://github.com/telstra/MessagingAPI-SDK-node) - [Messaging API - .Net2 SDK](https://github.com/telstra/MessagingAPI-SDK-dotnet) - [Messaging API - Java SDK](https://github.com/telstra/MessagingAPI-SDK-Java) ## Blog Posts For more information on the Messaging API, you can read these blog posts: - [Callbacks Part 1](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-1) - [Callbacks Part 2](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-2) " + s.description = "The Telstra Messaging API specification" s.license = 'Apache-2.0' s.required_ruby_version = ">= 1.9" @@ -31,12 +31,6 @@ Gem::Specification.new do |s| s.add_runtime_dependency 'json', '~> 2.1', '>= 2.1.0' s.add_development_dependency 'rspec', '~> 3.6', '>= 3.6.0' - s.add_development_dependency 'vcr', '~> 3.0', '>= 3.0.1' - s.add_development_dependency 'webmock', '~> 1.24', '>= 1.24.3' - s.add_development_dependency 'autotest', '~> 4.4', '>= 4.4.6' - s.add_development_dependency 'autotest-rails-pure', '~> 4.1', '>= 4.1.2' - s.add_development_dependency 'autotest-growl', '~> 0.2', '>= 0.2.16' - s.add_development_dependency 'autotest-fsevent', '~> 0.2', '>= 0.2.12' s.files = `find *`.split("\n").uniq.sort.select { |f| !f.empty? } s.test_files = `find spec/*`.split("\n") diff --git a/backward-compat-test.rb b/backward-compat-test.rb new file mode 100644 index 0000000..2a40f1a --- /dev/null +++ b/backward-compat-test.rb @@ -0,0 +1,36 @@ +require 'Telstra_Messaging' + +api_instance = Telstra_Messaging::AuthenticationApi.new +client_id = ENV["CLIENT_ID"] # String | +client_secret = ENV["CLIENT_SECRET"] # String | +grant_type = 'client_credentials' # String | +opts = { + scope: 'NSMS' # String | NSMS +} + +begin + #Generate OAuth2 token + result = api_instance.auth_token(client_id, client_secret, grant_type, opts) + puts "Token acquired!" + + Telstra_Messaging.configure do |config| + # Configure OAuth2 access token for authorization: auth + config.access_token = result.access_token + end + + api_instance = Telstra_Messaging::ProvisioningApi.new + body = Telstra_Messaging::ProvisionNumberRequest.new(active_days: 30) + result = api_instance.create_subscription(body) + puts "Number provisioned!" + + api_instance = Telstra_Messaging::MessagingApi.new + payload = Telstra_Messaging::SendSMSRequest.new(to: ENV["PHONE_NO"], + body: 'Testing Ruby SDK PR', + from: ENV["FROM_ALIAS"]) + result = api_instance.send_sms(payload) + p result + + +rescue Telstra_Messaging::ApiError => e + puts "Exception when calling AuthenticationApi->auth_token: #{e}" +end \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..44446f8 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,11 @@ +version: '3' +services: + telstradev: + environment: + - CLIENT_ID + - CLIENT_SECRET + - PHONE_NO + - FROM_ALIAS + build: + context: . + dockerfile: DockerFile \ No newline at end of file diff --git a/docs/AuthenticationApi.md b/docs/AuthenticationApi.md index 9741d5a..32cc66d 100644 --- a/docs/AuthenticationApi.md +++ b/docs/AuthenticationApi.md @@ -7,14 +7,17 @@ Method | HTTP request | Description [**auth_token**](AuthenticationApi.md#auth_token) | **POST** /oauth/token | Generate OAuth2 token -# **auth_token** -> OAuthResponse auth_token(client_id, client_secret, grant_type) + +## auth_token + +> OAuthResponse auth_token(client_id, client_secret, grant_type, opts) Generate OAuth2 token -To generate an OAuth2 Authentication token, pass through your `Client key` and `Client secret` that you received when you registered for the **API Free Trial** Product. The grant_type should be left as `client_credentials` and the scope as `NSMS`. The token will expire in one hour. +To generate an OAuth2 Authentication token, pass through your `Client key` and `Client secret` that you received when you registered for the **API Free Trial** Product. The grant_type should be left as `client_credentials` and the scope as `NSMS`. The token will expire in one hour. ### Example + ```ruby # load the gem require 'Telstra_Messaging' @@ -23,10 +26,13 @@ api_instance = Telstra_Messaging::AuthenticationApi.new client_id = 'client_id_example' # String | client_secret = 'client_secret_example' # String | grant_type = 'client_credentials' # String | +opts = { + scope: 'scope_example' # String | NSMS +} begin #Generate OAuth2 token - result = api_instance.auth_token(client_id, client_secret, grant_type) + result = api_instance.auth_token(client_id, client_secret, grant_type, opts) p result rescue Telstra_Messaging::ApiError => e puts "Exception when calling AuthenticationApi->auth_token: #{e}" @@ -35,11 +41,13 @@ end ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **client_id** | **String**| | **client_secret** | **String**| | **grant_type** | **String**| | [default to 'client_credentials'] + **scope** | **String**| NSMS | [optional] ### Return type @@ -51,8 +59,6 @@ No authorization required ### HTTP request headers - - **Content-Type**: application/x-www-form-urlencoded - - **Accept**: application/json - - +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: application/json diff --git a/docs/DeleteNumberRequest.md b/docs/DeleteNumberRequest.md index e05fd9a..4c21a12 100644 --- a/docs/DeleteNumberRequest.md +++ b/docs/DeleteNumberRequest.md @@ -1,8 +1,17 @@ # Telstra_Messaging::DeleteNumberRequest ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **empty_arr** | **Integer** | Empty Arr | [optional] [default to 0] +## Code Sample + +```ruby +require 'Telstra_Messaging' + +instance = Telstra_Messaging::DeleteNumberRequest.new(empty_arr: null) +``` + diff --git a/docs/GetMmsResponse.md b/docs/GetMmsResponse.md new file mode 100644 index 0000000..01db626 --- /dev/null +++ b/docs/GetMmsResponse.md @@ -0,0 +1,31 @@ +# Telstra_Messaging::GetMmsResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**status** | **String** | The final state of the message. | +**destination_address** | **String** | The number the message was sent to. | +**sender_address** | **String** | The number the message was sent from. | +**subject** | **String** | The subject assigned to the message. | [optional] +**message_id** | **String** | Message Id assigned by the MMSC. | [optional] +**api_msg_id** | **String** | Message Id assigned by the API. | [optional] +**sent_timestamp** | **String** | Time handling of the message ended. | +**mms_content** | [**Array<MMSContent>**](MMSContent.md) | An array of content that was received in an MMS message. | + +## Code Sample + +```ruby +require 'Telstra_Messaging' + +instance = Telstra_Messaging::GetMmsResponse.new(status: RECEIVED, + destination_address: 61412345678, + sender_address: 61487654321, + subject: null, + message_id: null, + api_msg_id: null, + sent_timestamp: 2018-11-23T16:14:02+10:00, + mms_content: null) +``` + + diff --git a/docs/GetSubscriptionResponse.md b/docs/GetSubscriptionResponse.md index 63ea27c..0377201 100644 --- a/docs/GetSubscriptionResponse.md +++ b/docs/GetSubscriptionResponse.md @@ -1,10 +1,21 @@ # Telstra_Messaging::GetSubscriptionResponse ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **active_days** | **String** | Number of active days | [optional] **notify_url** | **String** | Notify url configured | [optional] **destination_address** | **String** | The mobile phone number that was allocated | [optional] +## Code Sample + +```ruby +require 'Telstra_Messaging' + +instance = Telstra_Messaging::GetSubscriptionResponse.new(active_days: null, + notify_url: null, + destination_address: null) +``` + diff --git a/docs/HealthCheckResponse.md b/docs/HealthCheckResponse.md new file mode 100644 index 0000000..9f2096e --- /dev/null +++ b/docs/HealthCheckResponse.md @@ -0,0 +1,17 @@ +# Telstra_Messaging::HealthCheckResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**status** | **String** | message status | [optional] + +## Code Sample + +```ruby +require 'Telstra_Messaging' + +instance = Telstra_Messaging::HealthCheckResponse.new(status: up) +``` + + diff --git a/docs/InboundPollResponse.md b/docs/InboundPollResponse.md index 1a38f91..e6b6e09 100644 --- a/docs/InboundPollResponse.md +++ b/docs/InboundPollResponse.md @@ -1,6 +1,7 @@ # Telstra_Messaging::InboundPollResponse ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **status** | **String** | message status | [optional] @@ -10,4 +11,17 @@ Name | Type | Description | Notes **message_id** | **String** | Message Id | [optional] **sent_timestamp** | **String** | The date and time when the message was sent by recipient. | [optional] +## Code Sample + +```ruby +require 'Telstra_Messaging' + +instance = Telstra_Messaging::InboundPollResponse.new(status: null, + destination_address: null, + sender_address: null, + message: null, + message_id: null, + sent_timestamp: null) +``` + diff --git a/docs/MMSContent.md b/docs/MMSContent.md index 2517938..96cd034 100644 --- a/docs/MMSContent.md +++ b/docs/MMSContent.md @@ -1,10 +1,21 @@ # Telstra_Messaging::MMSContent ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**type** | **String** | The following types are supported audio/amr audio/aac audio/mp3 audio/mpeg3 audio/mpeg audio/mpg audio/wav audio/3gpp audio/mp4 image/gif image/jpeg image/jpg image/png image/bmp video/mpeg4 video/mp4 video/mpeg video/3gpp video/3gp video/h263 text/plain text/x-vCard text/x-vCalendar\" | -**filename** | **String** | The file name to be associated with the content. Some devices will display this file name with a placeholder for the content. | -**payload** | **String** | | +**type** | **String** | The following types are supported audio/amr audio/aac audio/mp3 audio/mpeg3 audio/mpeg audio/mpg audio/wav audio/3gpp audio/mp4 image/gif image/jpeg image/jpg image/png image/bmp video/mpeg4 video/mp4 video/mpeg video/3gpp video/3gp video/h263 text/plain text/x-vCard text/x-vCalendar | +**filename** | **String** | The file name to be associated with the content. Some devices will display this file name with a placeholder for the content. | +**payload** | **String** | Base64 encoded message content. | + +## Code Sample + +```ruby +require 'Telstra_Messaging' + +instance = Telstra_Messaging::MMSContent.new(type: null, + filename: null, + payload: null) +``` diff --git a/docs/Message.md b/docs/Message.md index 8f10661..151fb1e 100644 --- a/docs/Message.md +++ b/docs/Message.md @@ -1,11 +1,24 @@ # Telstra_Messaging::Message ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **to** | **String** | Just a copy of the number the message is sent to. | -**delivery_status** | **String** | Gives an indication if the message has been accepted for delivery. The description field contains information on why a message may have been rejected. | -**message_id** | **String** | For an accepted message, ths will be a unique reference that can be used to check the messages status. Please refer to the Delivery Notification section. Note that `messageId` will be different for each number that the message was sent to. | -**message_status_url** | **String** | For an accepted message, ths will be the URL that can be used to check the messages status. Please refer to the Delivery Notification section. | [optional] +**delivery_status** | **String** | Gives an indication if the message has been accepted for delivery. The description field contains information on why a message may have been rejected. | +**message_id** | **String** | For an accepted message, ths will be a unique reference that can be used to check the messages status. Please refer to the Delivery Notification section. Note that `messageId` will be different for each number that the message was sent to. | +**message_status_url** | **String** | For an accepted message, ths will be the URL that can be used to check the messages status. Please refer to the Delivery Notification section. | [optional] + +## Code Sample + +```ruby +require 'Telstra_Messaging' + +instance = Telstra_Messaging::Message.new(to: +61412345678, + delivery_status: MessageWaiting, + message_id: d997474900097a1f0000000008d7e18102cc0901-1261412345678, + message_status_url: https://tapi.telstra.com/v2/messages/sms/d997474900097a1f0000000008d7e18102cc0901-1261412345678/status +) +``` diff --git a/docs/MessageMulti.md b/docs/MessageMulti.md new file mode 100644 index 0000000..201ef62 --- /dev/null +++ b/docs/MessageMulti.md @@ -0,0 +1,21 @@ +# Telstra_Messaging::MessageMulti + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**to** | **String** | Phone number (in E.164 format) to send the SMS to. This number can be in international format `\"to\": \"+61412345678\"` or in national format. | [optional] +**body** | **String** | The text body of the message. Messages longer than 160 characters will be counted as multiple messages. This field contains the message text, this can be up to 1900 (for a single recipient) or 500 (for multiple recipients) UTF-8 characters. As mobile devices rarely support the full range of UTF-8 characters, it is possible that some characters may not be translated correctly by the mobile device | [optional] +**receipt_off** | **Boolean** | Whether Delivery Receipt will be sent back or not. Setting this field to `true` will disable Delivery Receipts. The `notifyURL` field will be ignored, if there is one in the payload. An \"OLD-NONEXISTANT-MESSAGE-ID\" 400 error will also be returned upon Polling for the SMS Status. | [optional] + +## Code Sample + +```ruby +require 'Telstra_Messaging' + +instance = Telstra_Messaging::MessageMulti.new(to: +61412345678, + body: Test Message, + receipt_off: true) +``` + + diff --git a/docs/MessageSentResponse.md b/docs/MessageSentResponse.md deleted file mode 100644 index 095d95f..0000000 --- a/docs/MessageSentResponse.md +++ /dev/null @@ -1,11 +0,0 @@ -# Telstra_Messaging::MessageSentResponse - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**messages** | [**Array<Message>**](Message.md) | An array of messages. | -**country** | **Array<Object>** | An array of the countries to which the destination MSISDNs belong. | [optional] -**message_type** | **String** | This returns whether the message sent was a SMS or MMS. | -**number_segments** | **Integer** | For SMS messages only, the value indicates the number of 160 character message segments sent. | - - diff --git a/docs/MessageSentResponseMms.md b/docs/MessageSentResponseMms.md new file mode 100644 index 0000000..29c1786 --- /dev/null +++ b/docs/MessageSentResponseMms.md @@ -0,0 +1,25 @@ +# Telstra_Messaging::MessageSentResponseMms + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**messages** | [**Array<Message>**](Message.md) | An array of messages. | +**mms_media_kb** | **Integer** | Indicates the message size in kB of the MMS sent. | [optional] +**country** | **Array<Object>** | An array of the countries to which the destination MSISDNs belong. | [optional] +**message_type** | **String** | This returns whether the message sent was a SMS or MMS. | +**number_segments** | **Integer** | MMS with numberSegments below 600 are classed as Small whereas those that are bigger than 600 are classed as Large. They will be charged accordingly. | + +## Code Sample + +```ruby +require 'Telstra_Messaging' + +instance = Telstra_Messaging::MessageSentResponseMms.new(messages: null, + mms_media_kb: 2, + country: [{AUS=1}], + message_type: MMS, + number_segments: 4) +``` + + diff --git a/docs/MessageSentResponseSms.md b/docs/MessageSentResponseSms.md new file mode 100644 index 0000000..fb44c8e --- /dev/null +++ b/docs/MessageSentResponseSms.md @@ -0,0 +1,23 @@ +# Telstra_Messaging::MessageSentResponseSms + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**messages** | [**Array<Message>**](Message.md) | An array of messages. | +**country** | **Array<Object>** | An array of the countries to which the destination MSISDNs belong. | [optional] +**message_type** | **String** | This returns whether the message sent was a SMS or MMS. | +**number_segments** | **Integer** | A message which has 160 GSM-7 characters or less will have numberSegments=1. Note that multi-part messages which are over 160 GSM-7 characters will include the User Data Header as part of the numberSegments. The User Data Header is being used for the re-assembly of the messages. | + +## Code Sample + +```ruby +require 'Telstra_Messaging' + +instance = Telstra_Messaging::MessageSentResponseSms.new(messages: null, + country: [{AUS=1}], + message_type: SMS, + number_segments: 1) +``` + + diff --git a/docs/MessagingApi.md b/docs/MessagingApi.md index fceb592..3dc0e73 100644 --- a/docs/MessagingApi.md +++ b/docs/MessagingApi.md @@ -6,13 +6,18 @@ Method | HTTP request | Description ------------- | ------------- | ------------- [**get_mms_status**](MessagingApi.md#get_mms_status) | **GET** /messages/mms/{messageid}/status | Get MMS Status [**get_sms_status**](MessagingApi.md#get_sms_status) | **GET** /messages/sms/{messageId}/status | Get SMS Status -[**retrieve_mms_responses**](MessagingApi.md#retrieve_mms_responses) | **GET** /messages/mms | Retrieve MMS Responses -[**retrieve_sms_responses**](MessagingApi.md#retrieve_sms_responses) | **GET** /messages/sms | Retrieve SMS Responses +[**m_ms_health_check**](MessagingApi.md#m_ms_health_check) | **GET** /messages/mms/healthcheck | MMS Health Check +[**retrieve_mms_replies**](MessagingApi.md#retrieve_mms_replies) | **GET** /messages/mms | Retrieve MMS Replies +[**retrieve_sms_replies**](MessagingApi.md#retrieve_sms_replies) | **GET** /messages/sms | Retrieve SMS Replies +[**s_ms_health_check**](MessagingApi.md#s_ms_health_check) | **GET** /messages/sms/healthcheck | SMS Health Check +[**s_ms_multi**](MessagingApi.md#s_ms_multi) | **POST** /messages/sms/multi | Send Multiple SMS [**send_mms**](MessagingApi.md#send_mms) | **POST** /messages/mms | Send MMS [**send_sms**](MessagingApi.md#send_sms) | **POST** /messages/sms | Send SMS -# **get_mms_status** + +## get_mms_status + > Array<OutboundPollResponse> get_mms_status(messageid) Get MMS Status @@ -20,6 +25,7 @@ Get MMS Status Get MMS Status ### Example + ```ruby # load the gem require 'Telstra_Messaging' @@ -30,7 +36,7 @@ Telstra_Messaging.configure do |config| end api_instance = Telstra_Messaging::MessagingApi.new -messageid = 'messageid_example' # String | Unique identifier of a message - it is the value returned from a previous POST call to https://api.telstra.com/v2/messages/mms +messageid = 'messageid_example' # String | Unique identifier of a message - it is the value returned from a previous POST call to https://tapi.telstra.com/v2/messages/mms begin #Get MMS Status @@ -43,9 +49,10 @@ end ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **messageid** | **String**| Unique identifier of a message - it is the value returned from a previous POST call to https://api.telstra.com/v2/messages/mms | + **messageid** | **String**| Unique identifier of a message - it is the value returned from a previous POST call to https://tapi.telstra.com/v2/messages/mms | ### Return type @@ -57,19 +64,20 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: application/json +## get_sms_status -# **get_sms_status** > Array<OutboundPollResponse> get_sms_status(message_id) Get SMS Status -If no notification URL has been specified, it is possible to poll for the message status. Note that the `MessageId` that appears in the URL must be URL encoded. Just copying the `MessageId` as it was supplied when submitting the message may not work. SMS Status with Notification URL --- When a message has reached its final state, the API will send a POST to the URL that has been previously specified.
{     to: '+61418123456'     sentTimestamp: '2017-03-17T10:05:22+10:00'     receivedTimestamp: '2017-03-17T10:05:23+10:00'     messageId: /cccb284200035236000000000ee9d074019e0301/1261418123456     deliveryStatus: DELIVRD   } 
The fields are:
Field Description
to The number the message was sent to.
receivedTimestamp Time the message was sent to the API.
sentTimestamp Time handling of the message ended.
deliveryStatus The final state of the message.
messageId The same reference that was returned when the original message was sent.
receivedTimestamp Time the message was sent to the API.
Upon receiving this call it is expected that your servers will give a 204 (No Content) response. Anything else will cause the API to reattempt the call 5 minutes later. +If no notification URL has been specified, it is possible to poll for the message status. Note that the `MessageId` that appears in the URL must be URL encoded. Just copying the `MessageId` as it was supplied when submitting the message may not work. # SMS Status with Notification URL When a message has reached its final state, the API will send a POST to the URL that has been previously specified.
{     \"to\": \"+61418123456\",     \"sentTimestamp\": \"2017-03-17T10:05:22+10:00\",     \"receivedTimestamp\": \"2017-03-17T10:05:23+10:00\",     \"messageId\": \"1234567890ABCDEFGHIJKLNOPQRSTUVW\",     \"deliveryStatus\": \"DELIVRD\"   } 
The fields are: | Field | Description | | --- | ---| | `to` | The number the message was sent to. | | `receivedTimestamp` | Time the message was sent to the API. | | `sentTimestamp` | Time handling of the message ended. | | `deliveryStatus` | The final state of the message. | | `messageId` | The same reference that was returned when the original message was sent.| | `receivedTimestamp` | Time the message was sent to the API.| Upon receiving this call it is expected that your servers will give a 204 (No Content) response. ### Example + ```ruby # load the gem require 'Telstra_Messaging' @@ -80,7 +88,7 @@ Telstra_Messaging.configure do |config| end api_instance = Telstra_Messaging::MessagingApi.new -message_id = 'message_id_example' # String | Unique identifier of a message - it is the value returned from a previous POST call to https://api.telstra.com/v2/messages/sms. +message_id = 'message_id_example' # String | Unique identifier of a message - it is the value returned from a previous POST call to https://tapi.telstra.com/v2/messages/sms. begin #Get SMS Status @@ -93,9 +101,10 @@ end ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **message_id** | **String**| Unique identifier of a message - it is the value returned from a previous POST call to https://api.telstra.com/v2/messages/sms. | + **message_id** | **String**| Unique identifier of a message - it is the value returned from a previous POST call to https://tapi.telstra.com/v2/messages/sms. | ### Return type @@ -107,19 +116,63 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: application/json +## m_ms_health_check -# **retrieve_mms_responses** -> Array<MMSContent> retrieve_mms_responses +> HealthCheckResponse m_ms_health_check -Retrieve MMS Responses +MMS Health Check -Messages are retrieved one at a time, starting with the earliest response. If the subscription has a `notifyURL`, response messages will be logged there instead. # Notification URL Format for MMS Replies
{   \"status\": \"RECEIVED\",   \"destinationAddress\": \"+61418123456\",   \"senderAddress\": \"+61421987654\",   \"subject\": \"Foo\",   \"sentTimestamp\": \"2018-03-23T12:15:45+10:00\",   \"envelope\": \"string\",   \"MMSContent\":     [       {         \"type\": \"text/plain\",         \"filename\": \"text_1.txt\",         \"payload\": \"string\"       },       {         \"type\": \"image/jpeg\",         \"filename\": \"sample.jpeg\",         \"payload\": \"string\"       }     ] }
The fields are: | Field | Description | | --- | --- | | `status` | The final state of the message. | | `destinationAddress` |The number the message was sent to. | | `senderAddress` | The number the message was sent from. | | `subject` | The subject assigned to the message. | | `sentTimestamp` | Time handling of the message ended. | | `envelope` | Information about about terminal type and originating operator. | | `MMSContent` | An array of the actual content of the reply message. | | `type` | The content type of the message. | | `filename` | The filename for the message content. | | `payload` | The content of the message. | +Determine whether the MMS service is up or down. ### Example + +```ruby +# load the gem +require 'Telstra_Messaging' + +api_instance = Telstra_Messaging::MessagingApi.new + +begin + #MMS Health Check + result = api_instance.m_ms_health_check + p result +rescue Telstra_Messaging::ApiError => e + puts "Exception when calling MessagingApi->m_ms_health_check: #{e}" +end +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**HealthCheckResponse**](HealthCheckResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## retrieve_mms_replies + +> GetMmsResponse retrieve_mms_replies + +Retrieve MMS Replies + +Messages are retrieved one at a time, starting with the earliest reply. If the subscription has a `notifyURL`, reply messages will be logged there instead, i.e. `GET` and reply `notifyURL` are exclusive. # MMS Reply with Notification URL When a reply is received, the API will send a POST to the subscription URL that has been previously specified.
{   \"to\": \"+61418123456\",   \"from\": \"+61421987654\",   \"sentTimestamp\": \"2018-03-23T12:15:45+10:00\",   \"messageId\": \"XFRO1ApiA0000000111\",   \"subject\": \"Foo\",   \"envelope\": \"string\",   \"MMSContent\":     [       {         \"type\": \"text/plain\",         \"filename\": \"text_1.txt\",         \"payload\": \"string\"       },       {         \"type\": \"image/jpeg\",         \"filename\": \"sample.jpeg\",         \"payload\": \"string\"       }     ] }
The fields are: | Field | Description | | --- | --- | | `to` |The number the message was sent to. | | `from` | The number the message was sent from. | | `sentTimestamp` | Time handling of the message ended. | | `messageId` | Message Id assigned by the MMSC | | `subject` | The subject assigned to the message. | | `envelope` | Information about about terminal type and originating operator. | | `MMSContent` | An array of the actual content of the reply message. | | `type` | The content type of the message. | | `filename` | The filename for the message content. | | `payload` | The content of the message. | + +### Example + ```ruby # load the gem require 'Telstra_Messaging' @@ -132,20 +185,21 @@ end api_instance = Telstra_Messaging::MessagingApi.new begin - #Retrieve MMS Responses - result = api_instance.retrieve_mms_responses + #Retrieve MMS Replies + result = api_instance.retrieve_mms_replies p result rescue Telstra_Messaging::ApiError => e - puts "Exception when calling MessagingApi->retrieve_mms_responses: #{e}" + puts "Exception when calling MessagingApi->retrieve_mms_replies: #{e}" end ``` ### Parameters + This endpoint does not need any parameter. ### Return type -[**Array<MMSContent>**](MMSContent.md) +[**GetMmsResponse**](GetMmsResponse.md) ### Authorization @@ -153,19 +207,20 @@ This endpoint does not need any parameter. ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: application/json +## retrieve_sms_replies -# **retrieve_sms_responses** -> InboundPollResponse retrieve_sms_responses +> InboundPollResponse retrieve_sms_replies -Retrieve SMS Responses +Retrieve SMS Replies -Messages are retrieved one at a time, starting with the earliest response. The API supports the encoding of the full range of emojis in the reply message. The emojis will be in their UTF-8 format. If the subscription has a `notifyURL`, response messages will be logged there instead. # Notification URL Format for SMS Response
{   \"to\":\"+61472880123\",   \"from\":\"+61412345678\",   \"body\":\"Foo4\",   \"sentTimestamp\":\"2018-04-20T14:24:35\",   \"messageId\":\"DMASApiA0000000146\" }
The fields are: | Field | Description | | --- |--- | | `to` | The number the message was sent to. | | `from` | The number the message was sent from. | | `body` | The content of the SMS response. | | `sentTimestamp` | Time handling of the message ended. | | `messageId` | The ID assigned to the message. | +Messages are retrieved one at a time, starting with the earliest reply. The API supports the encoding of emojis in the reply message. The emojis will be in their UTF-8 format. If the subscription has a `notifyURL`, reply messages will be logged there instead. # SMS Reply with Notification URL When a reply is received, the API will send a POST to the subscription URL that has been previously specified.
{   \"to\":\"+61472880123\",   \"from\":\"+61412345678\",   \"body\":\"Foo4\",   \"sentTimestamp\":\"2018-04-20T14:24:35\",   \"messageId\":\"DMASApiA0000000146\" }
The fields are: | Field | Description | | --- |--- | | `to` | The number the message was sent to. | | `from` | The number the message was sent from. | | `body` | The content of the SMS response. | | `sentTimestamp` | Time handling of the message ended. | | `messageId` | The ID assigned to the message. | ### Example + ```ruby # load the gem require 'Telstra_Messaging' @@ -178,15 +233,16 @@ end api_instance = Telstra_Messaging::MessagingApi.new begin - #Retrieve SMS Responses - result = api_instance.retrieve_sms_responses + #Retrieve SMS Replies + result = api_instance.retrieve_sms_replies p result rescue Telstra_Messaging::ApiError => e - puts "Exception when calling MessagingApi->retrieve_sms_responses: #{e}" + puts "Exception when calling MessagingApi->retrieve_sms_replies: #{e}" end ``` ### Parameters + This endpoint does not need any parameter. ### Return type @@ -199,19 +255,115 @@ This endpoint does not need any parameter. ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: application/json + + +## s_ms_health_check + +> HealthCheckResponse s_ms_health_check + +SMS Health Check + +Determine whether the SMS service is up or down. + +### Example + +```ruby +# load the gem +require 'Telstra_Messaging' + +api_instance = Telstra_Messaging::MessagingApi.new + +begin + #SMS Health Check + result = api_instance.s_ms_health_check + p result +rescue Telstra_Messaging::ApiError => e + puts "Exception when calling MessagingApi->s_ms_health_check: #{e}" +end +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**HealthCheckResponse**](HealthCheckResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## s_ms_multi + +> MessageSentResponseSms s_ms_multi(payload) + +Send Multiple SMS + +Send multiple SMS in one API call. + +### Example + +```ruby +# load the gem +require 'Telstra_Messaging' +# setup authorization +Telstra_Messaging.configure do |config| + # Configure OAuth2 access token for authorization: auth + config.access_token = 'YOUR ACCESS TOKEN' +end + +api_instance = Telstra_Messaging::MessagingApi.new +payload = Telstra_Messaging::SendSmsMultiRequest.new # SendSmsMultiRequest | A JSON payload containing the recipient's phone number and text message. This number can be in international format if preceeded by a '+' or in national format ('04xxxxxxxx') where x is a digit. + +begin + #Send Multiple SMS + result = api_instance.s_ms_multi(payload) + p result +rescue Telstra_Messaging::ApiError => e + puts "Exception when calling MessagingApi->s_ms_multi: #{e}" +end +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **payload** | [**SendSmsMultiRequest**](SendSmsMultiRequest.md)| A JSON payload containing the recipient's phone number and text message. This number can be in international format if preceeded by a '+' or in national format ('04xxxxxxxx') where x is a digit. | + +### Return type + +[**MessageSentResponseSms**](MessageSentResponseSms.md) + +### Authorization + +[auth](../README.md#auth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json +## send_mms -# **send_mms** -> MessageSentResponse send_mms(send_mms_request) +> MessageSentResponseMms send_mms(body) Send MMS Send MMS ### Example + ```ruby # load the gem require 'Telstra_Messaging' @@ -222,12 +374,11 @@ Telstra_Messaging.configure do |config| end api_instance = Telstra_Messaging::MessagingApi.new -send_mms_request = Telstra_Messaging::SendMmsRequest.new # SendMmsRequest | A JSON or XML payload containing the recipient's phone number and MMS message. The recipient number should be in the format '04xxxxxxxx' where x is a digit. - +body = Telstra_Messaging::SendMmsRequest.new # SendMmsRequest | A JSON or XML payload containing the recipient's phone number and MMS message. The recipient number should be in the format '04xxxxxxxx' where x is a digit. begin #Send MMS - result = api_instance.send_mms(send_mms_request) + result = api_instance.send_mms(body) p result rescue Telstra_Messaging::ApiError => e puts "Exception when calling MessagingApi->send_mms: #{e}" @@ -236,14 +387,14 @@ end ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **send_mms_request** | [**SendMmsRequest**](SendMmsRequest.md)| A JSON or XML payload containing the recipient's phone number and MMS message. The recipient number should be in the format '04xxxxxxxx' where x is a digit. - | + **body** | [**SendMmsRequest**](SendMmsRequest.md)| A JSON or XML payload containing the recipient's phone number and MMS message. The recipient number should be in the format '04xxxxxxxx' where x is a digit. | ### Return type -[**MessageSentResponse**](MessageSentResponse.md) +[**MessageSentResponseMms**](MessageSentResponseMms.md) ### Authorization @@ -251,19 +402,20 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: application/json +- **Accept**: application/json +## send_sms -# **send_sms** -> MessageSentResponse send_sms(send_sms_request) +> MessageSentResponseSms send_sms(payload) Send SMS Send an SMS Message to a single or multiple mobile number/s. ### Example + ```ruby # load the gem require 'Telstra_Messaging' @@ -274,12 +426,11 @@ Telstra_Messaging.configure do |config| end api_instance = Telstra_Messaging::MessagingApi.new -send_sms_request = Telstra_Messaging::SendSMSRequest.new # SendSMSRequest | A JSON or XML payload containing the recipient's phone number and text message. This number can be in international format if preceeded by a '+' or in national format ('04xxxxxxxx') where x is a digit. - +payload = Telstra_Messaging::SendSMSRequest.new # SendSMSRequest | A JSON or XML payload containing the recipient's phone number and text message. This number can be in international format if preceeded by a '+' or in national format ('04xxxxxxxx') where x is a digit. begin #Send SMS - result = api_instance.send_sms(send_sms_request) + result = api_instance.send_sms(payload) p result rescue Telstra_Messaging::ApiError => e puts "Exception when calling MessagingApi->send_sms: #{e}" @@ -288,14 +439,14 @@ end ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **send_sms_request** | [**SendSMSRequest**](SendSMSRequest.md)| A JSON or XML payload containing the recipient's phone number and text message. This number can be in international format if preceeded by a '+' or in national format ('04xxxxxxxx') where x is a digit. - | + **payload** | [**SendSMSRequest**](SendSMSRequest.md)| A JSON or XML payload containing the recipient's phone number and text message. This number can be in international format if preceeded by a '+' or in national format ('04xxxxxxxx') where x is a digit. | ### Return type -[**MessageSentResponse**](MessageSentResponse.md) +[**MessageSentResponseSms**](MessageSentResponseSms.md) ### Authorization @@ -303,8 +454,6 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json - - +- **Content-Type**: application/json +- **Accept**: application/json diff --git a/docs/OAuthResponse.md b/docs/OAuthResponse.md index 2a166d2..5266c46 100644 --- a/docs/OAuthResponse.md +++ b/docs/OAuthResponse.md @@ -1,10 +1,21 @@ # Telstra_Messaging::OAuthResponse ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **access_token** | **String** | OAuth access token | [optional] **token_type** | **String** | OAuth token type | [optional] **expires_in** | **String** | OAuth expiry time | [optional] +## Code Sample + +```ruby +require 'Telstra_Messaging' + +instance = Telstra_Messaging::OAuthResponse.new(access_token: null, + token_type: null, + expires_in: null) +``` + diff --git a/docs/OutboundPollResponse.md b/docs/OutboundPollResponse.md index ee4e78b..d12e7ae 100644 --- a/docs/OutboundPollResponse.md +++ b/docs/OutboundPollResponse.md @@ -1,11 +1,23 @@ # Telstra_Messaging::OutboundPollResponse ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**to** | **String** | The phone number (recipient) the message was sent to (in E.164 format). | [optional] +**to** | **String** | The phone number (recipient) the message was sent to (in E.164 format). | [optional] **sent_timestamp** | **String** | The date and time when the message was sent. | [optional] **received_timestamp** | **String** | The date and time when the message was recieved by recipient. | [optional] **delivery_status** | [**Status**](Status.md) | | [optional] +## Code Sample + +```ruby +require 'Telstra_Messaging' + +instance = Telstra_Messaging::OutboundPollResponse.new(to: +61418123456, + sent_timestamp: 2017-03-17T09:16:49+10:00, + received_timestamp: 2017-03-17T09:16:50+10:00, + delivery_status: null) +``` + diff --git a/docs/ProvisionNumberRequest.md b/docs/ProvisionNumberRequest.md index a615e86..2c756f5 100644 --- a/docs/ProvisionNumberRequest.md +++ b/docs/ProvisionNumberRequest.md @@ -1,9 +1,19 @@ # Telstra_Messaging::ProvisionNumberRequest ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **active_days** | **Integer** | The number of days before for which this number is provisioned. | [optional] -**notify_url** | **String** | A notification URL that will be POSTed to whenever a new message (e.g. a reply to a message sent) arrives at this destination address. If this is not provided then you can use the Get /sms or /mms API to poll for reply messages. *Please note that the notification URLs and the Get /sms or /mms call are exclusive. If a notification URL has been set then the GET call will not provide any useful information.* | [optional] +**notify_url** | **String** | A notification URL that will be POSTed to whenever a new message (i.e. a reply to a message sent) arrives at this destination address. If this is not provided then you can use the Get /sms or /mms API to poll for reply messages. If you are using a domain URL you must include the forward slash at the end of the URL (e.g. http://www.example.com/). *Please note that the notification URLs and the Get /sms or /mms call are exclusive. If a notification URL has been set then the GET call will not provide any useful information.* | [optional] + +## Code Sample + +```ruby +require 'Telstra_Messaging' + +instance = Telstra_Messaging::ProvisionNumberRequest.new(active_days: 20, + notify_url: http://wwww.example.com/) +``` diff --git a/docs/ProvisionNumberResponse.md b/docs/ProvisionNumberResponse.md index 04a0257..fa6ae7f 100644 --- a/docs/ProvisionNumberResponse.md +++ b/docs/ProvisionNumberResponse.md @@ -1,10 +1,19 @@ # Telstra_Messaging::ProvisionNumberResponse ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **destination_address** | **String** | The mobile phone number that was allocated | [optional] -**description** | **String** | Metadata for provisioned numbers which are valid for more than 5 years | [optional] -**expiry_date** | **Float** | Free Trial apps will have a 30-Day Limit for their provisioned number. This is in Unix time format. | [optional] +**expiry_date** | **Float** | Free Trial apps can only add activeDays for their provisioned number every 30 days. This is in Unix time format. | [optional] + +## Code Sample + +```ruby +require 'Telstra_Messaging' + +instance = Telstra_Messaging::ProvisionNumberResponse.new(destination_address: +61412345678, + expiry_date: 1534463077362) +``` diff --git a/docs/ProvisioningApi.md b/docs/ProvisioningApi.md index d0a7d75..a6a8d8e 100644 --- a/docs/ProvisioningApi.md +++ b/docs/ProvisioningApi.md @@ -9,14 +9,17 @@ Method | HTTP request | Description [**get_subscription**](ProvisioningApi.md#get_subscription) | **GET** /messages/provisioning/subscriptions | Get Subscription -# **create_subscription** -> ProvisionNumberResponse create_subscription(provision_number_request) + +## create_subscription + +> ProvisionNumberResponse create_subscription(body) Create Subscription -Invoke the provisioning API to get a dedicated mobile number for an account or application. Note that Free Trial apps will have a 30-Day Limit for their provisioned number. If the Provisioning call is made several times within that 30-Day period, it will return the `expiryDate` in the Unix format and will not add any activeDays until after that `expiryDate`. For paid apps, a provisioned number can be allotted for a maximum of 5 years. If a Provisioning call is made which will result to activeDays > 1830, the response body will indicate that the provisioned number is already valid for more than 5 years. +Invoke the provisioning API to get a dedicated mobile number for an account or application. Note that Free Trial apps will have a 30-Day Limit for their provisioned number. If the Provisioning call is made several times within that 30-Day period, it will return the `expiryDate` in the Unix format and will not add any activeDays until after that `expiryDate`. After the `expiryDate`, you may make another Provisioning call to extend the activeDays by another 30-Days. For paid apps, a provisioned number can be allotted for a maximum of 5 years. If a Provisioning call is made which will result to activeDays > 1825, a 409 `Active Days Max` response will be returned to indicate that the provisioned number is already valid for more than 5 years and that no update to activeDays has been made. ### Example + ```ruby # load the gem require 'Telstra_Messaging' @@ -27,11 +30,11 @@ Telstra_Messaging.configure do |config| end api_instance = Telstra_Messaging::ProvisioningApi.new -provision_number_request = Telstra_Messaging::ProvisionNumberRequest.new # ProvisionNumberRequest | A JSON payload containing the required attributes +body = Telstra_Messaging::ProvisionNumberRequest.new # ProvisionNumberRequest | A JSON payload containing the required attributes begin #Create Subscription - result = api_instance.create_subscription(provision_number_request) + result = api_instance.create_subscription(body) p result rescue Telstra_Messaging::ApiError => e puts "Exception when calling ProvisioningApi->create_subscription: #{e}" @@ -40,9 +43,10 @@ end ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **provision_number_request** | [**ProvisionNumberRequest**](ProvisionNumberRequest.md)| A JSON payload containing the required attributes | + **body** | [**ProvisionNumberRequest**](ProvisionNumberRequest.md)| A JSON payload containing the required attributes | ### Return type @@ -54,19 +58,20 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: application/json +- **Accept**: application/json +## delete_subscription -# **delete_subscription** -> delete_subscription(delete_number_request) +> delete_subscription(body) Delete Subscription Delete a mobile number subscription from an account ### Example + ```ruby # load the gem require 'Telstra_Messaging' @@ -77,11 +82,11 @@ Telstra_Messaging.configure do |config| end api_instance = Telstra_Messaging::ProvisioningApi.new -delete_number_request = Telstra_Messaging::DeleteNumberRequest.new # DeleteNumberRequest | EmptyArr +body = Telstra_Messaging::DeleteNumberRequest.new # DeleteNumberRequest | EmptyArr begin #Delete Subscription - api_instance.delete_subscription(delete_number_request) + api_instance.delete_subscription(body) rescue Telstra_Messaging::ApiError => e puts "Exception when calling ProvisioningApi->delete_subscription: #{e}" end @@ -89,9 +94,10 @@ end ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **delete_number_request** | [**DeleteNumberRequest**](DeleteNumberRequest.md)| EmptyArr | + **body** | [**DeleteNumberRequest**](DeleteNumberRequest.md)| EmptyArr | ### Return type @@ -103,12 +109,12 @@ nil (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: Not defined +- **Content-Type**: application/json +- **Accept**: Not defined +## get_subscription -# **get_subscription** > GetSubscriptionResponse get_subscription Get Subscription @@ -116,6 +122,7 @@ Get Subscription Get mobile number subscription for an account ### Example + ```ruby # load the gem require 'Telstra_Messaging' @@ -137,6 +144,7 @@ end ``` ### Parameters + This endpoint does not need any parameter. ### Return type @@ -149,8 +157,6 @@ This endpoint does not need any parameter. ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/json - - +- **Content-Type**: Not defined +- **Accept**: application/json diff --git a/docs/SendMmsRequest.md b/docs/SendMmsRequest.md index de4a077..52cd9cb 100644 --- a/docs/SendMmsRequest.md +++ b/docs/SendMmsRequest.md @@ -1,13 +1,27 @@ # Telstra_Messaging::SendMmsRequest ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**from** | **String** | This will be the source address that will be displayed on the receiving device. If it is not present then it will default to the MSISDN assigned to the app. If replyRequest is set to true, then this field will be ignored. | **to** | **String** | This is the destination address. Can be an array of strings if sending to multiple numbers: \"to\":[\"+61412345678\", \"+61418765432\"] | -**subject** | **String** | The subject that will be used in an MMS message. | -**reply_request** | **BOOLEAN** | If set to true, the reply message functionality will be implemented and the to address will be ignored if present. | -**notify_url** | **String** | Notify url | [optional] -**mms_content** | [**Array<MMSContent>**](MMSContent.md) | An array of content that will be sent in an MMS message. If this array is present it will cause the `body` element to be ignored, and the message will be sent as an MMS. | +**from** | **String** | This will be the source address that will be displayed on the receiving device. You can set an Alphanumeric sender ID of up to 11 characters that the MMS was sent from. Phone numbers in the `from` attribute will be blocked (400-error) to prevent number spoofing. Most standard ASCII characters are accepted in the alphanumeric `from` attribute, however there are some limitations. The following limitations and characters are allowed in the alphanumeric `from` attribute; any alphabetic character (e.g. `abc`), any number mixed with alphabetic characters (e.g. `123abc`), uppercase and lowercase characters (e.g. `aBc`), any of the following special characters mixed with alphabetic characters are allowed; `~!@#$%^&*()~_~+-={}|[];'?,./` (e.g. `abc~!@`), any combination of lowercase, uppercase, numeric or allowed special characters (e.g. `abc@#123DE`). All other characters, including spaces and extended ASCII characters, are not allowed (e.g. `<>:\"\\`). If attribute is not present, the service will use the mobile number associated with the application (in E.164 format). If `replyRequest` is set to true, this field should not be present. This feature is only available on Telstra Account paid plans, not through Free Trials or credit card paid plans. *Please note:* *- Alphanumeric sender ID works for domestic, i.e. Australian, destinations only.* *- When Alphanumeric sender ID is used in sending MMS, Delivery Reports will NOT be returned.* | [optional] +**subject** | **String** | The subject that will be used in an MMS message. Subject is limited to maximum of 64 characters. Some special characters need to be encoded if used in the `subject` field (e.g. &amp;amp; for & and &amp;lt; for <). | [optional] +**reply_request** | **Boolean** | If set to true, the reply message functionality will be implemented. The `from` field should not be present. | [optional] +**notify_url** | **String** | Contains a URL that will be called once your message has been processed. The status may be delivered, expired, deleted, etc. Please refer to the Delivery Status section for more information. If you are using a domain URL you must include the forward slash at the end of the URL (e.g. http://www.example.com/). | [optional] +**mms_content** | [**Array<MMSContent>**](MMSContent.md) | An array of content that will be sent in an MMS message. If this array is present it will cause the `body` element to be ignored, and the message will be sent as an MMS. | + +## Code Sample + +```ruby +require 'Telstra_Messaging' + +instance = Telstra_Messaging::SendMmsRequest.new(to: , + from: null, + subject: null, + reply_request: null, + notify_url: http://www.example.com/, + mms_content: null) +``` diff --git a/docs/SendSMSRequest.md b/docs/SendSMSRequest.md index 408fef9..9d2dbe9 100644 --- a/docs/SendSMSRequest.md +++ b/docs/SendSMSRequest.md @@ -1,15 +1,31 @@ # Telstra_Messaging::SendSMSRequest ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **to** | **String** | Phone number (in E.164 format) to send the SMS to. This number can be in international format `\"to\": \"+61412345678\"` or in national format. Can be an array of strings if sending to multiple numbers: `\"to\":[\"+61412345678\", \"+61418765432\"]` | **body** | **String** | The text body of the message. Messages longer than 160 characters will be counted as multiple messages. This field contains the message text, this can be up to 1900 (for a single recipient) or 500 (for multiple recipients) UTF-8 characters. As mobile devices rarely support the full range of UTF-8 characters, it is possible that some characters may not be translated correctly by the mobile device | -**from** | **String** | The Alphanumeric sender ID of up to 11 characters or phone number the SMS was sent from. If not present, the service will use the mobile number associated with the application (in E.164 format). This feature is only available on paid plans. | [optional] -**validity** | **Integer** | How long the platform should attempt to deliver the message for. This period is specified in minutes from the message. Normally if the message cannot be delivered immediately, it will be stored and delivery will be periodically reattempted. The network will attempt to send the message for up to seven days. It is possible to define a period smaller than 7 days by including this parameter and specifying the number of minutes that delivery should be attempted. eg: including `\"validity\": 60` will specify that if a message can't be delivered within the first 60 minutes them the network should stop. | [optional] -**scheduled_delivery** | **Integer** | How long the platform should wait before attempting to send the message - specified in minutes. e.g.: If `\"scheduledDelivery\": 120` is included, then the network will not attempt to start message delivery for two hours after the message has been submitted | [optional] -**notify_url** | **String** | Contains a URL that will be called once your message has been processed. The status may be delivered, expired, deleted, etc. It is possible for the network to make a call to a URL when the message has been delivered (or has expired), different URLs can be set per message. Please refer to the Delivery Notification section. | [optional] -**reply_request** | **BOOLEAN** | If set to true, the reply message functionality will be implemented and the to address will be ignored if present. If false or not present, then normal message handling is implemented. When set to true, network will use a temporary number to deliver this message. All messages sent by mobile to this temporary number will be stored against the same `messageId`. If a `notifyURL` is provided then user response will be delivered to the URL where `messageId` will be same as `messageId` in reponse to original API request. This field contains the message text, this can be up to 500 UTF-8 characters. As mobile devices rarely support the full range of UTF-8 characters, it is possible that some characters may not be translated correctly by the mobile device. | [optional] -**priority** | **BOOLEAN** | When messages are queued up for a number, then it is possible to set where a new message will be placed in the queue. If the priority is set to true then the new message will be placed ahead of all messages with a normal priority. If there are no messages queued for the number, then this parameter has no effect. | [optional] +**from** | **String** | This will be the source address that will be displayed on the receiving device. You can set an Alphanumeric sender ID of up to 11 characters that the SMS was sent from. Phone numbers in the `from` attribute will be blocked (400-error) to prevent number spoofing. Most standard ASCII characters are accepted in the alphanumeric `from` attribute, however there are some limitations. The following limitations and characters are allowed in the alphanumeric `from` attribute; any alphabetic character (e.g. `abc`), any number mixed with alphabetic characters (e.g. `123abc`), uppercase and lowercase characters (e.g. `aBc`), any of the following special characters mixed with alphabetic characters are allowed; `~!@#$%^&*()~_~+-={}|[];'?,./` (e.g. `abc~!@`), any combination of lowercase, uppercase, numeric or allowed special characters (e.g. `abc@#123DE`). All other characters, including spaces and extended ASCII characters, are not allowed (e.g. `<>:\"\\`). If attribute is not present, the service will use the mobile number associated with the application (in E.164 format). If `replyRequest` is set to true, then this field should not be present. This feature is only available on Telstra Account paid plans, not through Free Trials or credit card paid plans. *Please note that Alphanumeric sender ID works for domestic, i.e. Australian, destinations only.* | [optional] +**validity** | **Integer** | How long the platform should attempt to deliver the message for. This period is specified in minutes from the message. Normally if the message cannot be delivered immediately, it will be stored and delivery will be periodically reattempted. The network will attempt to send the message for up to seven days. It is possible to define a period smaller than 7 days by including this parameter and specifying the number of minutes that delivery should be attempted. e.g.: including `\"validity\": 60` will specify that if a message can't be delivered within the first 60 minutes then the network should stop. | [optional] +**scheduled_delivery** | **Integer** | How long the platform should wait before attempting to send the message - specified in minutes. e.g.: If `\"scheduledDelivery\": 120` is included, then the network will not attempt to start message delivery for two hours after the message has been submitted | [optional] +**notify_url** | **String** | Contains a URL that will be called once your message has been processed. The status may be delivered, expired, deleted, etc. Please refer to the Delivery Status section for more information. If you are using a domain URL you must include the forward slash at the end of the URL (e.g. http://www.example.com/). | [optional] +**reply_request** | **Boolean** | If set to true, the reply message functionality will be implemented. The `from` field should not be present. If false or not present, then normal message handling is implemented. When set to true, network will use a temporary number to deliver this message. All messages sent by a mobile to this temporary number will be stored against the same `messageId`. If a `notifyURL` is provided then user replies will be delivered to the URL where `messageId` will be same as `messageId` in the response to the original API request. This field contains the message text, this can be up to 500 UTF-8 characters. As mobile devices rarely support the full range of UTF-8 characters, it is possible that some characters may not be translated correctly by the mobile device. | [optional] +**priority** | **Boolean** | When messages are queued up for a number, then it is possible to set where a new message will be placed in the queue. If the priority is set to true then the new message will be placed ahead of all messages with a normal priority. If there are no messages queued for the number, then this parameter has no effect. | [optional] + +## Code Sample + +```ruby +require 'Telstra_Messaging' + +instance = Telstra_Messaging::SendSMSRequest.new(to: , + body: Test Message, + from: Foo_App, + validity: 5, + scheduled_delivery: 1, + notify_url: http://www.example.com/, + reply_request: false, + priority: true) +``` diff --git a/docs/SendSmsMultiRequest.md b/docs/SendSmsMultiRequest.md new file mode 100644 index 0000000..19ff622 --- /dev/null +++ b/docs/SendSmsMultiRequest.md @@ -0,0 +1,19 @@ +# Telstra_Messaging::SendSmsMultiRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**sms_multi** | [**Array<MessageMulti>**](MessageMulti.md) | Multiple SMS. Up to 10 messages can be sent in one API call. | [optional] +**notify_url** | **String** | Contains a URL that will be called once your message has been processed. The status may be delivered, expired, deleted, etc. Please refer to the Delivery Status section for more information. If you are using a domain URL you must include the forward slash at the end of the URL (e.g. http://www.example.com/). This is required when `\"receiptOff\"` is missing or `\"receiptOff\":\"false\"`. | [optional] + +## Code Sample + +```ruby +require 'Telstra_Messaging' + +instance = Telstra_Messaging::SendSmsMultiRequest.new(sms_multi: null, + notify_url: http://www.example.com/) +``` + + diff --git a/docs/Status.md b/docs/Status.md index dfabcc6..e4bd85e 100644 --- a/docs/Status.md +++ b/docs/Status.md @@ -1,7 +1,16 @@ # Telstra_Messaging::Status ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +## Code Sample + +```ruby +require 'Telstra_Messaging' + +instance = Telstra_Messaging::Status.new() +``` + diff --git a/lib/Telstra_Messaging.rb b/lib/Telstra_Messaging.rb index 2944a76..a4c881f 100644 --- a/lib/Telstra_Messaging.rb +++ b/lib/Telstra_Messaging.rb @@ -1,12 +1,12 @@ =begin #Telstra Messaging API -# # Introduction

Send and receive SMS and MMS messages globally using Telstra's enterprise grade Messaging API. It also allows your application to track the delivery status of both sent and received messages. Get your dedicated Australian number, and start sending and receiving messages today.

# Features The Telstra Messaging API provides the features below. | Feature | Description | | --- | --- | | `Dedicated Number` | Provision a mobile number for your account to be used as `from` address in the API | | `Send Messages` | Sending SMS or MMS messages | | `Receive Messages` | Telstra will deliver messages sent to a dedicated number or to the `notifyURL` defined by you | | `Broadcast Messages` | Invoke a single API call to send a message to a list of numbers provided in `to` | | `Delivery Status` | Query the delivery status of your messages | | `Callbacks` | Provide a notification URL and Telstra will notify your app when a message status changes | | `Alphanumeric Identifier` | Differentiate yourself by providing an alphanumeric string in `from`. This feature is only available on paid plans | | `Concatenation` | Send messages up to 1900 characters long and Telstra will automaticaly segment and reassemble them | | `Reply Request` | Create a chat session by associating `messageId` and `to` number to track responses received from a mobile number. We will store this association for 8 days | | `Character set` | Accepts all Unicode characters as part of UTF-8 | | `Bounce-back response` | See if your SMS hits an unreachable or unallocated number (Australia Only) | | `Queuing` | Messaging API will automatically queue and deliver each message at a compliant rate. | | `Emoji Encoding` | The API supports the encoding of the full range of emojis. Emojis in the reply messages will be in their UTF-8 format. | ## Delivery Notification or Callbacks The API provides several methods for notifying when a message has been delivered to the destination. 1. When you send a message there is an opportunity to specify a `notifyURL`. Once the message has been delivered the API will make a call to this URL to advise of the message status. 2. If you do not specify a URL you can always call the `GET /status` API to get the status of the message. # Getting Access to the API 1. Register at [https://dev.telstra.com](https://dev.telstra.com). 2. After registration, login to [https://dev.telstra.com](https://dev.telstra.com) and navigate to the **My apps** page. 3. Create your application by clicking the **Add new app** button 4. Select **API Free Trial** Product when configuring your application. This Product includes the Telstra Messaging API as well as other free trial APIs. Your application will be approved automatically. 5. There is a maximum of 1000 free messages per developer. Additional messages and features can be purchased from [https://dev.telstra.com](https://dev.telstra.com). 6. Note your `Client key` and `Client secret` as these will be needed to provision a number for your application and for authentication. Now head over to **Getting Started** where you can find a postman collection as well as some links to sample apps and SDKs to get you started. Happy Messaging! # Frequently Asked Questions **Q: Is creating a subscription via the Provisioning call a required step?** A. Yes. You will only be able to start sending messages if you have a provisioned dedicated number. Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: When trying to send an SMS I receive a `400 Bad Request` response. How can I fix this?** A. You need to make sure you have a provisioned dedicated number before you can send an SMS. If you do not have a provisioned dedicated number and you try to send a message via the API, you will get the error below in the response:
{   \"status\":\"400\",   \"code\":\"DELIVERY-IMPOSSIBLE\",   \"message\":\"Invalid \\'from\\' address specified\" }
Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: How long does my dedicated number stay active for?** A. When you provision a dedicated number, by default it will be active for 30 days. You can use the `activeDays` parameter during the provisioning call to increment or decrement the number of days your dedicated number will remain active. Note that Free Trial apps will have 30 days as the maximum `activeDays` they can add to their provisioned number. If the Provisioning call is made several times within that 30-Day period, it will return the `expiryDate` in the Unix format and will not add any activeDays until after that `expiryDate`. **Q: Can I send a broadcast message using the Telstra Messaging API?** A. Yes. Recipient numbers can be in the form of an array of strings if a broadcast message needs to be sent, allowing you to send to multiple mobile numbers in one API call. A sample request body for this will be: `{\"to\":[\"+61412345678\",\"+61487654321\"],\"body\":\"Test Message\"}` **Q: Can I send SMS and MMS to all countries?** A. You can send SMS and MMS to all countries EXCEPT to countries which are subject to global sanctions namely: Burma, Côte d'Ivoire, Cuba, Iran, North Korea, Syria. **Q: Can I use `Alphanumeric Identifier` from my paid plan via credit card?** A. `Alphanumeric Identifier` is only available on Telstra Account paid plans, not through credit card paid plans. **Q: What is the maximum sized MMS that I can send?** A. This will depend on the carrier that will receive the MMS. For Telstra it's up to 2MB, Optus up to 1.5MB and Vodafone only allows up to 500kB. You will need to check with international carriers for thier MMS size limits. **Q: How is the size of an MMS calculated?** A. Images are scaled up to approximately 4/3 when base64 encoded. Additionally, there is approximately 200 bytes of overhead on each MMS. Assuming the maximum MMS that can be sent on Telstra’s network is 2MB, then the maximum image size that can be sent will be approximately 1.378MB (1.378 x 1.34 + 200, without SOAP encapsulation). **Q: How is an MMS classified as Small or Large?** A. MMSes with size below 600kB are classed as Small whereas those that are bigger than 600kB are classed as Large. They will be charged accordingly. **Q: Are SMILs supported by the Messaging API?** A. While there will be no error if you send an MMS with a SMIL presentation, the actual layout or sequence defined in the SMIL may not display as expected because most of the new smartphone devices ignore the SMIL presentation layer. SMIL was used in feature phones which had limited capability and SMIL allowed a *powerpoint type* presentation to be provided. Smartphones now have the capability to display video which is the better option for presentations. It is recommended that MMS messages should just drop the SMIL. **Q: How do I assign a delivery notification or callback URL?** A. You can assign a delivery notification or callback URL by adding the `notifyURL` parameter in the body of the request when you send a message. Once the message has been delivered, a notification will then be posted to this callback URL. **Q: What is the difference between the `notifyURL` parameter in the Provisoning call versus the `notifyURL` parameter in the Send Message call?** A. The `notifyURL` in the Provisoning call will be the URL where replies to the provisioned number will be posted. On the other hand, the `notifyURL` in the Send Message call will be the URL where the delivery notification will be posted, e.g. when an SMS has already been delivered to the recipient. # Getting Started Below are the steps to get started with the Telstra Messaging API. 1. Generate an OAuth2 token using your `Client key` and `Client secret`. 2. Use the Provisioning call to create a subscription and receive a dedicated number. 3. Send a message to a specific mobile number. ## Run in Postman \"Run ## Sample Apps - [Perl Sample App](https://github.com/telstra/MessagingAPI-perl-sample-app) - [Happy Chat App](https://github.com/telstra/messaging-sample-code-happy-chat) - [PHP Sample App](https://github.com/developersteve/telstra-messaging-php) ## SDK Repos - [Messaging API - PHP SDK](https://github.com/telstra/MessagingAPI-SDK-php) - [Messaging API - Python SDK](https://github.com/telstra/MessagingAPI-SDK-python) - [Messaging API - Ruby SDK](https://github.com/telstra/MessagingAPI-SDK-ruby) - [Messaging API - NodeJS SDK](https://github.com/telstra/MessagingAPI-SDK-node) - [Messaging API - .Net2 SDK](https://github.com/telstra/MessagingAPI-SDK-dotnet) - [Messaging API - Java SDK](https://github.com/telstra/MessagingAPI-SDK-Java) ## Blog Posts For more information on the Messaging API, you can read these blog posts: - [Callbacks Part 1](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-1) - [Callbacks Part 2](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-2) +#The Telstra Messaging API specification -OpenAPI spec version: 2.2.9 +The version of the OpenAPI document: 2.2.9 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0 +OpenAPI Generator version: 4.2.3-SNAPSHOT =end @@ -18,17 +18,22 @@ # Models require 'Telstra_Messaging/models/delete_number_request' +require 'Telstra_Messaging/models/get_mms_response' require 'Telstra_Messaging/models/get_subscription_response' +require 'Telstra_Messaging/models/health_check_response' require 'Telstra_Messaging/models/inbound_poll_response' require 'Telstra_Messaging/models/mms_content' require 'Telstra_Messaging/models/message' -require 'Telstra_Messaging/models/message_sent_response' +require 'Telstra_Messaging/models/message_multi' +require 'Telstra_Messaging/models/message_sent_response_mms' +require 'Telstra_Messaging/models/message_sent_response_sms' require 'Telstra_Messaging/models/o_auth_response' require 'Telstra_Messaging/models/outbound_poll_response' require 'Telstra_Messaging/models/provision_number_request' require 'Telstra_Messaging/models/provision_number_response' require 'Telstra_Messaging/models/send_mms_request' require 'Telstra_Messaging/models/send_sms_request' +require 'Telstra_Messaging/models/send_sms_multi_request' require 'Telstra_Messaging/models/status' # APIs diff --git a/lib/Telstra_Messaging/api/authentication_api.rb b/lib/Telstra_Messaging/api/authentication_api.rb index fd0a306..10f0a56 100644 --- a/lib/Telstra_Messaging/api/authentication_api.rb +++ b/lib/Telstra_Messaging/api/authentication_api.rb @@ -1,16 +1,16 @@ =begin #Telstra Messaging API -# # Introduction

Send and receive SMS and MMS messages globally using Telstra's enterprise grade Messaging API. It also allows your application to track the delivery status of both sent and received messages. Get your dedicated Australian number, and start sending and receiving messages today.

# Features The Telstra Messaging API provides the features below. | Feature | Description | | --- | --- | | `Dedicated Number` | Provision a mobile number for your account to be used as `from` address in the API | | `Send Messages` | Sending SMS or MMS messages | | `Receive Messages` | Telstra will deliver messages sent to a dedicated number or to the `notifyURL` defined by you | | `Broadcast Messages` | Invoke a single API call to send a message to a list of numbers provided in `to` | | `Delivery Status` | Query the delivery status of your messages | | `Callbacks` | Provide a notification URL and Telstra will notify your app when a message status changes | | `Alphanumeric Identifier` | Differentiate yourself by providing an alphanumeric string in `from`. This feature is only available on paid plans | | `Concatenation` | Send messages up to 1900 characters long and Telstra will automaticaly segment and reassemble them | | `Reply Request` | Create a chat session by associating `messageId` and `to` number to track responses received from a mobile number. We will store this association for 8 days | | `Character set` | Accepts all Unicode characters as part of UTF-8 | | `Bounce-back response` | See if your SMS hits an unreachable or unallocated number (Australia Only) | | `Queuing` | Messaging API will automatically queue and deliver each message at a compliant rate. | | `Emoji Encoding` | The API supports the encoding of the full range of emojis. Emojis in the reply messages will be in their UTF-8 format. | ## Delivery Notification or Callbacks The API provides several methods for notifying when a message has been delivered to the destination. 1. When you send a message there is an opportunity to specify a `notifyURL`. Once the message has been delivered the API will make a call to this URL to advise of the message status. 2. If you do not specify a URL you can always call the `GET /status` API to get the status of the message. # Getting Access to the API 1. Register at [https://dev.telstra.com](https://dev.telstra.com). 2. After registration, login to [https://dev.telstra.com](https://dev.telstra.com) and navigate to the **My apps** page. 3. Create your application by clicking the **Add new app** button 4. Select **API Free Trial** Product when configuring your application. This Product includes the Telstra Messaging API as well as other free trial APIs. Your application will be approved automatically. 5. There is a maximum of 1000 free messages per developer. Additional messages and features can be purchased from [https://dev.telstra.com](https://dev.telstra.com). 6. Note your `Client key` and `Client secret` as these will be needed to provision a number for your application and for authentication. Now head over to **Getting Started** where you can find a postman collection as well as some links to sample apps and SDKs to get you started. Happy Messaging! # Frequently Asked Questions **Q: Is creating a subscription via the Provisioning call a required step?** A. Yes. You will only be able to start sending messages if you have a provisioned dedicated number. Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: When trying to send an SMS I receive a `400 Bad Request` response. How can I fix this?** A. You need to make sure you have a provisioned dedicated number before you can send an SMS. If you do not have a provisioned dedicated number and you try to send a message via the API, you will get the error below in the response:
{   \"status\":\"400\",   \"code\":\"DELIVERY-IMPOSSIBLE\",   \"message\":\"Invalid \\'from\\' address specified\" }
Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: How long does my dedicated number stay active for?** A. When you provision a dedicated number, by default it will be active for 30 days. You can use the `activeDays` parameter during the provisioning call to increment or decrement the number of days your dedicated number will remain active. Note that Free Trial apps will have 30 days as the maximum `activeDays` they can add to their provisioned number. If the Provisioning call is made several times within that 30-Day period, it will return the `expiryDate` in the Unix format and will not add any activeDays until after that `expiryDate`. **Q: Can I send a broadcast message using the Telstra Messaging API?** A. Yes. Recipient numbers can be in the form of an array of strings if a broadcast message needs to be sent, allowing you to send to multiple mobile numbers in one API call. A sample request body for this will be: `{\"to\":[\"+61412345678\",\"+61487654321\"],\"body\":\"Test Message\"}` **Q: Can I send SMS and MMS to all countries?** A. You can send SMS and MMS to all countries EXCEPT to countries which are subject to global sanctions namely: Burma, Côte d'Ivoire, Cuba, Iran, North Korea, Syria. **Q: Can I use `Alphanumeric Identifier` from my paid plan via credit card?** A. `Alphanumeric Identifier` is only available on Telstra Account paid plans, not through credit card paid plans. **Q: What is the maximum sized MMS that I can send?** A. This will depend on the carrier that will receive the MMS. For Telstra it's up to 2MB, Optus up to 1.5MB and Vodafone only allows up to 500kB. You will need to check with international carriers for thier MMS size limits. **Q: How is the size of an MMS calculated?** A. Images are scaled up to approximately 4/3 when base64 encoded. Additionally, there is approximately 200 bytes of overhead on each MMS. Assuming the maximum MMS that can be sent on Telstra’s network is 2MB, then the maximum image size that can be sent will be approximately 1.378MB (1.378 x 1.34 + 200, without SOAP encapsulation). **Q: How is an MMS classified as Small or Large?** A. MMSes with size below 600kB are classed as Small whereas those that are bigger than 600kB are classed as Large. They will be charged accordingly. **Q: Are SMILs supported by the Messaging API?** A. While there will be no error if you send an MMS with a SMIL presentation, the actual layout or sequence defined in the SMIL may not display as expected because most of the new smartphone devices ignore the SMIL presentation layer. SMIL was used in feature phones which had limited capability and SMIL allowed a *powerpoint type* presentation to be provided. Smartphones now have the capability to display video which is the better option for presentations. It is recommended that MMS messages should just drop the SMIL. **Q: How do I assign a delivery notification or callback URL?** A. You can assign a delivery notification or callback URL by adding the `notifyURL` parameter in the body of the request when you send a message. Once the message has been delivered, a notification will then be posted to this callback URL. **Q: What is the difference between the `notifyURL` parameter in the Provisoning call versus the `notifyURL` parameter in the Send Message call?** A. The `notifyURL` in the Provisoning call will be the URL where replies to the provisioned number will be posted. On the other hand, the `notifyURL` in the Send Message call will be the URL where the delivery notification will be posted, e.g. when an SMS has already been delivered to the recipient. # Getting Started Below are the steps to get started with the Telstra Messaging API. 1. Generate an OAuth2 token using your `Client key` and `Client secret`. 2. Use the Provisioning call to create a subscription and receive a dedicated number. 3. Send a message to a specific mobile number. ## Run in Postman \"Run ## Sample Apps - [Perl Sample App](https://github.com/telstra/MessagingAPI-perl-sample-app) - [Happy Chat App](https://github.com/telstra/messaging-sample-code-happy-chat) - [PHP Sample App](https://github.com/developersteve/telstra-messaging-php) ## SDK Repos - [Messaging API - PHP SDK](https://github.com/telstra/MessagingAPI-SDK-php) - [Messaging API - Python SDK](https://github.com/telstra/MessagingAPI-SDK-python) - [Messaging API - Ruby SDK](https://github.com/telstra/MessagingAPI-SDK-ruby) - [Messaging API - NodeJS SDK](https://github.com/telstra/MessagingAPI-SDK-node) - [Messaging API - .Net2 SDK](https://github.com/telstra/MessagingAPI-SDK-dotnet) - [Messaging API - Java SDK](https://github.com/telstra/MessagingAPI-SDK-Java) ## Blog Posts For more information on the Messaging API, you can read these blog posts: - [Callbacks Part 1](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-1) - [Callbacks Part 2](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-2) +#The Telstra Messaging API specification -OpenAPI spec version: 2.2.9 +The version of the OpenAPI document: 2.2.9 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0 +OpenAPI Generator version: 4.2.3-SNAPSHOT =end -require 'uri' +require 'cgi' module Telstra_Messaging class AuthenticationApi @@ -20,11 +20,12 @@ def initialize(api_client = ApiClient.default) @api_client = api_client end # Generate OAuth2 token - # To generate an OAuth2 Authentication token, pass through your `Client key` and `Client secret` that you received when you registered for the **API Free Trial** Product. The grant_type should be left as `client_credentials` and the scope as `NSMS`. The token will expire in one hour. - # @param client_id - # @param client_secret - # @param grant_type + # To generate an OAuth2 Authentication token, pass through your `Client key` and `Client secret` that you received when you registered for the **API Free Trial** Product. The grant_type should be left as `client_credentials` and the scope as `NSMS`. The token will expire in one hour. + # @param client_id [String] + # @param client_secret [String] + # @param grant_type [String] # @param [Hash] opts the optional parameters + # @option opts [String] :scope NSMS # @return [OAuthResponse] def auth_token(client_id, client_secret, grant_type, opts = {}) data, _status_code, _headers = auth_token_with_http_info(client_id, client_secret, grant_type, opts) @@ -32,12 +33,13 @@ def auth_token(client_id, client_secret, grant_type, opts = {}) end # Generate OAuth2 token - # To generate an OAuth2 Authentication token, pass through your `Client key` and `Client secret` that you received when you registered for the **API Free Trial** Product. The grant_type should be left as `client_credentials` and the scope as `NSMS`. The token will expire in one hour. - # @param client_id - # @param client_secret - # @param grant_type + # To generate an OAuth2 Authentication token, pass through your `Client key` and `Client secret` that you received when you registered for the **API Free Trial** Product. The grant_type should be left as `client_credentials` and the scope as `NSMS`. The token will expire in one hour. + # @param client_id [String] + # @param client_secret [String] + # @param grant_type [String] # @param [Hash] opts the optional parameters - # @return [Array<(OAuthResponse, Fixnum, Hash)>] OAuthResponse data, response status code and response headers + # @option opts [String] :scope NSMS + # @return [Array<(OAuthResponse, Integer, Hash)>] OAuthResponse data, response status code and response headers def auth_token_with_http_info(client_id, client_secret, grant_type, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AuthenticationApi.auth_token ...' @@ -58,31 +60,41 @@ def auth_token_with_http_info(client_id, client_secret, grant_type, opts = {}) local_var_path = '/oauth/token' # query parameters - query_params = {} + query_params = opts[:query_params] || {} # header parameters - header_params = {} + header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) # form parameters - form_params = {} + form_params = opts[:form_params] || {} form_params['client_id'] = client_id form_params['client_secret'] = client_secret form_params['grant_type'] = grant_type + form_params['scope'] = opts[:'scope'] if !opts[:'scope'].nil? # http body (model) - post_body = nil - auth_names = [] - data, status_code, headers = @api_client.call_api(:POST, local_var_path, + post_body = opts[:body] + + # return_type + return_type = opts[:return_type] || 'OAuthResponse' + + # auth_names + auth_names = opts[:auth_names] || [] + + new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, - :return_type => 'OAuthResponse') + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: AuthenticationApi#auth_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/lib/Telstra_Messaging/api/messaging_api.rb b/lib/Telstra_Messaging/api/messaging_api.rb index dd6e250..df5d0f1 100644 --- a/lib/Telstra_Messaging/api/messaging_api.rb +++ b/lib/Telstra_Messaging/api/messaging_api.rb @@ -1,16 +1,16 @@ =begin #Telstra Messaging API -# # Introduction

Send and receive SMS and MMS messages globally using Telstra's enterprise grade Messaging API. It also allows your application to track the delivery status of both sent and received messages. Get your dedicated Australian number, and start sending and receiving messages today.

# Features The Telstra Messaging API provides the features below. | Feature | Description | | --- | --- | | `Dedicated Number` | Provision a mobile number for your account to be used as `from` address in the API | | `Send Messages` | Sending SMS or MMS messages | | `Receive Messages` | Telstra will deliver messages sent to a dedicated number or to the `notifyURL` defined by you | | `Broadcast Messages` | Invoke a single API call to send a message to a list of numbers provided in `to` | | `Delivery Status` | Query the delivery status of your messages | | `Callbacks` | Provide a notification URL and Telstra will notify your app when a message status changes | | `Alphanumeric Identifier` | Differentiate yourself by providing an alphanumeric string in `from`. This feature is only available on paid plans | | `Concatenation` | Send messages up to 1900 characters long and Telstra will automaticaly segment and reassemble them | | `Reply Request` | Create a chat session by associating `messageId` and `to` number to track responses received from a mobile number. We will store this association for 8 days | | `Character set` | Accepts all Unicode characters as part of UTF-8 | | `Bounce-back response` | See if your SMS hits an unreachable or unallocated number (Australia Only) | | `Queuing` | Messaging API will automatically queue and deliver each message at a compliant rate. | | `Emoji Encoding` | The API supports the encoding of the full range of emojis. Emojis in the reply messages will be in their UTF-8 format. | ## Delivery Notification or Callbacks The API provides several methods for notifying when a message has been delivered to the destination. 1. When you send a message there is an opportunity to specify a `notifyURL`. Once the message has been delivered the API will make a call to this URL to advise of the message status. 2. If you do not specify a URL you can always call the `GET /status` API to get the status of the message. # Getting Access to the API 1. Register at [https://dev.telstra.com](https://dev.telstra.com). 2. After registration, login to [https://dev.telstra.com](https://dev.telstra.com) and navigate to the **My apps** page. 3. Create your application by clicking the **Add new app** button 4. Select **API Free Trial** Product when configuring your application. This Product includes the Telstra Messaging API as well as other free trial APIs. Your application will be approved automatically. 5. There is a maximum of 1000 free messages per developer. Additional messages and features can be purchased from [https://dev.telstra.com](https://dev.telstra.com). 6. Note your `Client key` and `Client secret` as these will be needed to provision a number for your application and for authentication. Now head over to **Getting Started** where you can find a postman collection as well as some links to sample apps and SDKs to get you started. Happy Messaging! # Frequently Asked Questions **Q: Is creating a subscription via the Provisioning call a required step?** A. Yes. You will only be able to start sending messages if you have a provisioned dedicated number. Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: When trying to send an SMS I receive a `400 Bad Request` response. How can I fix this?** A. You need to make sure you have a provisioned dedicated number before you can send an SMS. If you do not have a provisioned dedicated number and you try to send a message via the API, you will get the error below in the response:
{   \"status\":\"400\",   \"code\":\"DELIVERY-IMPOSSIBLE\",   \"message\":\"Invalid \\'from\\' address specified\" }
Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: How long does my dedicated number stay active for?** A. When you provision a dedicated number, by default it will be active for 30 days. You can use the `activeDays` parameter during the provisioning call to increment or decrement the number of days your dedicated number will remain active. Note that Free Trial apps will have 30 days as the maximum `activeDays` they can add to their provisioned number. If the Provisioning call is made several times within that 30-Day period, it will return the `expiryDate` in the Unix format and will not add any activeDays until after that `expiryDate`. **Q: Can I send a broadcast message using the Telstra Messaging API?** A. Yes. Recipient numbers can be in the form of an array of strings if a broadcast message needs to be sent, allowing you to send to multiple mobile numbers in one API call. A sample request body for this will be: `{\"to\":[\"+61412345678\",\"+61487654321\"],\"body\":\"Test Message\"}` **Q: Can I send SMS and MMS to all countries?** A. You can send SMS and MMS to all countries EXCEPT to countries which are subject to global sanctions namely: Burma, Côte d'Ivoire, Cuba, Iran, North Korea, Syria. **Q: Can I use `Alphanumeric Identifier` from my paid plan via credit card?** A. `Alphanumeric Identifier` is only available on Telstra Account paid plans, not through credit card paid plans. **Q: What is the maximum sized MMS that I can send?** A. This will depend on the carrier that will receive the MMS. For Telstra it's up to 2MB, Optus up to 1.5MB and Vodafone only allows up to 500kB. You will need to check with international carriers for thier MMS size limits. **Q: How is the size of an MMS calculated?** A. Images are scaled up to approximately 4/3 when base64 encoded. Additionally, there is approximately 200 bytes of overhead on each MMS. Assuming the maximum MMS that can be sent on Telstra’s network is 2MB, then the maximum image size that can be sent will be approximately 1.378MB (1.378 x 1.34 + 200, without SOAP encapsulation). **Q: How is an MMS classified as Small or Large?** A. MMSes with size below 600kB are classed as Small whereas those that are bigger than 600kB are classed as Large. They will be charged accordingly. **Q: Are SMILs supported by the Messaging API?** A. While there will be no error if you send an MMS with a SMIL presentation, the actual layout or sequence defined in the SMIL may not display as expected because most of the new smartphone devices ignore the SMIL presentation layer. SMIL was used in feature phones which had limited capability and SMIL allowed a *powerpoint type* presentation to be provided. Smartphones now have the capability to display video which is the better option for presentations. It is recommended that MMS messages should just drop the SMIL. **Q: How do I assign a delivery notification or callback URL?** A. You can assign a delivery notification or callback URL by adding the `notifyURL` parameter in the body of the request when you send a message. Once the message has been delivered, a notification will then be posted to this callback URL. **Q: What is the difference between the `notifyURL` parameter in the Provisoning call versus the `notifyURL` parameter in the Send Message call?** A. The `notifyURL` in the Provisoning call will be the URL where replies to the provisioned number will be posted. On the other hand, the `notifyURL` in the Send Message call will be the URL where the delivery notification will be posted, e.g. when an SMS has already been delivered to the recipient. # Getting Started Below are the steps to get started with the Telstra Messaging API. 1. Generate an OAuth2 token using your `Client key` and `Client secret`. 2. Use the Provisioning call to create a subscription and receive a dedicated number. 3. Send a message to a specific mobile number. ## Run in Postman \"Run ## Sample Apps - [Perl Sample App](https://github.com/telstra/MessagingAPI-perl-sample-app) - [Happy Chat App](https://github.com/telstra/messaging-sample-code-happy-chat) - [PHP Sample App](https://github.com/developersteve/telstra-messaging-php) ## SDK Repos - [Messaging API - PHP SDK](https://github.com/telstra/MessagingAPI-SDK-php) - [Messaging API - Python SDK](https://github.com/telstra/MessagingAPI-SDK-python) - [Messaging API - Ruby SDK](https://github.com/telstra/MessagingAPI-SDK-ruby) - [Messaging API - NodeJS SDK](https://github.com/telstra/MessagingAPI-SDK-node) - [Messaging API - .Net2 SDK](https://github.com/telstra/MessagingAPI-SDK-dotnet) - [Messaging API - Java SDK](https://github.com/telstra/MessagingAPI-SDK-Java) ## Blog Posts For more information on the Messaging API, you can read these blog posts: - [Callbacks Part 1](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-1) - [Callbacks Part 2](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-2) +#The Telstra Messaging API specification -OpenAPI spec version: 2.2.9 +The version of the OpenAPI document: 2.2.9 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0 +OpenAPI Generator version: 4.2.3-SNAPSHOT =end -require 'uri' +require 'cgi' module Telstra_Messaging class MessagingApi @@ -21,7 +21,7 @@ def initialize(api_client = ApiClient.default) end # Get MMS Status # Get MMS Status - # @param messageid Unique identifier of a message - it is the value returned from a previous POST call to https://api.telstra.com/v2/messages/mms + # @param messageid [String] Unique identifier of a message - it is the value returned from a previous POST call to https://tapi.telstra.com/v2/messages/mms # @param [Hash] opts the optional parameters # @return [Array] def get_mms_status(messageid, opts = {}) @@ -31,9 +31,9 @@ def get_mms_status(messageid, opts = {}) # Get MMS Status # Get MMS Status - # @param messageid Unique identifier of a message - it is the value returned from a previous POST call to https://api.telstra.com/v2/messages/mms + # @param messageid [String] Unique identifier of a message - it is the value returned from a previous POST call to https://tapi.telstra.com/v2/messages/mms # @param [Hash] opts the optional parameters - # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers + # @return [Array<(Array, Integer, Hash)>] Array data, response status code and response headers def get_mms_status_with_http_info(messageid, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MessagingApi.get_mms_status ...' @@ -43,37 +43,47 @@ def get_mms_status_with_http_info(messageid, opts = {}) fail ArgumentError, "Missing the required parameter 'messageid' when calling MessagingApi.get_mms_status" end # resource path - local_var_path = '/messages/mms/{messageid}/status'.sub('{' + 'messageid' + '}', messageid.to_s) + local_var_path = '/messages/mms/{messageid}/status'.sub('{' + 'messageid' + '}', CGI.escape(messageid.to_s)) # query parameters - query_params = {} + query_params = opts[:query_params] || {} # header parameters - header_params = {} + header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters - form_params = {} + form_params = opts[:form_params] || {} # http body (model) - post_body = nil - auth_names = ['auth'] - data, status_code, headers = @api_client.call_api(:GET, local_var_path, + post_body = opts[:body] + + # return_type + return_type = opts[:return_type] || 'Array' + + # auth_names + auth_names = opts[:auth_names] || ['auth'] + + new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, - :return_type => 'Array') + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: MessagingApi#get_mms_status\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end + # Get SMS Status - # If no notification URL has been specified, it is possible to poll for the message status. Note that the `MessageId` that appears in the URL must be URL encoded. Just copying the `MessageId` as it was supplied when submitting the message may not work. SMS Status with Notification URL --- When a message has reached its final state, the API will send a POST to the URL that has been previously specified.
{     to: '+61418123456'     sentTimestamp: '2017-03-17T10:05:22+10:00'     receivedTimestamp: '2017-03-17T10:05:23+10:00'     messageId: /cccb284200035236000000000ee9d074019e0301/1261418123456     deliveryStatus: DELIVRD   } 
The fields are:
Field Description
to The number the message was sent to.
receivedTimestamp Time the message was sent to the API.
sentTimestamp Time handling of the message ended.
deliveryStatus The final state of the message.
messageId The same reference that was returned when the original message was sent.
receivedTimestamp Time the message was sent to the API.
Upon receiving this call it is expected that your servers will give a 204 (No Content) response. Anything else will cause the API to reattempt the call 5 minutes later. - # @param message_id Unique identifier of a message - it is the value returned from a previous POST call to https://api.telstra.com/v2/messages/sms. + # If no notification URL has been specified, it is possible to poll for the message status. Note that the `MessageId` that appears in the URL must be URL encoded. Just copying the `MessageId` as it was supplied when submitting the message may not work. # SMS Status with Notification URL When a message has reached its final state, the API will send a POST to the URL that has been previously specified.
{     \"to\": \"+61418123456\",     \"sentTimestamp\": \"2017-03-17T10:05:22+10:00\",     \"receivedTimestamp\": \"2017-03-17T10:05:23+10:00\",     \"messageId\": \"1234567890ABCDEFGHIJKLNOPQRSTUVW\",     \"deliveryStatus\": \"DELIVRD\"   } 
The fields are: | Field | Description | | --- | ---| | `to` | The number the message was sent to. | | `receivedTimestamp` | Time the message was sent to the API. | | `sentTimestamp` | Time handling of the message ended. | | `deliveryStatus` | The final state of the message. | | `messageId` | The same reference that was returned when the original message was sent.| | `receivedTimestamp` | Time the message was sent to the API.| Upon receiving this call it is expected that your servers will give a 204 (No Content) response. + # @param message_id [String] Unique identifier of a message - it is the value returned from a previous POST call to https://tapi.telstra.com/v2/messages/sms. # @param [Hash] opts the optional parameters # @return [Array] def get_sms_status(message_id, opts = {}) @@ -82,10 +92,10 @@ def get_sms_status(message_id, opts = {}) end # Get SMS Status - # If no notification URL has been specified, it is possible to poll for the message status. Note that the `MessageId` that appears in the URL must be URL encoded. Just copying the `MessageId` as it was supplied when submitting the message may not work. SMS Status with Notification URL --- When a message has reached its final state, the API will send a POST to the URL that has been previously specified. <pre><code class=\"language-sh\">{ to: '+61418123456' sentTimestamp: '2017-03-17T10:05:22+10:00' receivedTimestamp: '2017-03-17T10:05:23+10:00' messageId: /cccb284200035236000000000ee9d074019e0301/1261418123456 deliveryStatus: DELIVRD } </code></pre> The fields are: <table> <thead> <tr> <th>Field</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><code>to</code></td> <td>The number the message was sent to.</td> </tr> <tr> <td><code>receivedTimestamp</code></td> <td>Time the message was sent to the API.</td> </tr> <tr> <td><code>sentTimestamp</code></td> <td>Time handling of the message ended.</td> </tr> <tr> <td><code>deliveryStatus</code></td> <td>The final state of the message.</td> </tr> <tr> <td><code>messageId</code></td> <td>The same reference that was returned when the original message was sent.</td> </tr> <tr> <td><code>receivedTimestamp</code></td> <td>Time the message was sent to the API.</td> </tr> </tbody> </table> Upon receiving this call it is expected that your servers will give a 204 (No Content) response. Anything else will cause the API to reattempt the call 5 minutes later. - # @param message_id Unique identifier of a message - it is the value returned from a previous POST call to https://api.telstra.com/v2/messages/sms. + # If no notification URL has been specified, it is possible to poll for the message status. Note that the `MessageId` that appears in the URL must be URL encoded. Just copying the `MessageId` as it was supplied when submitting the message may not work. # SMS Status with Notification URL When a message has reached its final state, the API will send a POST to the URL that has been previously specified. <pre><code class=\"language-sh\">{ \"to\": \"+61418123456\", \"sentTimestamp\": \"2017-03-17T10:05:22+10:00\", \"receivedTimestamp\": \"2017-03-17T10:05:23+10:00\", \"messageId\": \"1234567890ABCDEFGHIJKLNOPQRSTUVW\", \"deliveryStatus\": \"DELIVRD\" } </code></pre> The fields are: | Field | Description | | --- | ---| | `to` | The number the message was sent to. | | `receivedTimestamp` | Time the message was sent to the API. | | `sentTimestamp` | Time handling of the message ended. | | `deliveryStatus` | The final state of the message. | | `messageId` | The same reference that was returned when the original message was sent.| | `receivedTimestamp` | Time the message was sent to the API.| Upon receiving this call it is expected that your servers will give a 204 (No Content) response. + # @param message_id [String] Unique identifier of a message - it is the value returned from a previous POST call to https://tapi.telstra.com/v2/messages/sms. # @param [Hash] opts the optional parameters - # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers + # @return [Array<(Array, Integer, Hash)>] Array data, response status code and response headers def get_sms_status_with_http_info(message_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MessagingApi.get_sms_status ...' @@ -95,233 +105,454 @@ def get_sms_status_with_http_info(message_id, opts = {}) fail ArgumentError, "Missing the required parameter 'message_id' when calling MessagingApi.get_sms_status" end # resource path - local_var_path = '/messages/sms/{messageId}/status'.sub('{' + 'messageId' + '}', message_id.to_s) + local_var_path = '/messages/sms/{messageId}/status'.sub('{' + 'messageId' + '}', CGI.escape(message_id.to_s)) # query parameters - query_params = {} + query_params = opts[:query_params] || {} # header parameters - header_params = {} + header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters - form_params = {} + form_params = opts[:form_params] || {} # http body (model) - post_body = nil - auth_names = ['auth'] - data, status_code, headers = @api_client.call_api(:GET, local_var_path, + post_body = opts[:body] + + # return_type + return_type = opts[:return_type] || 'Array' + + # auth_names + auth_names = opts[:auth_names] || ['auth'] + + new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, - :return_type => 'Array') + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: MessagingApi#get_sms_status\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end - # Retrieve MMS Responses - # Messages are retrieved one at a time, starting with the earliest response. If the subscription has a `notifyURL`, response messages will be logged there instead. # Notification URL Format for MMS Replies
{   \"status\": \"RECEIVED\",   \"destinationAddress\": \"+61418123456\",   \"senderAddress\": \"+61421987654\",   \"subject\": \"Foo\",   \"sentTimestamp\": \"2018-03-23T12:15:45+10:00\",   \"envelope\": \"string\",   \"MMSContent\":     [       {         \"type\": \"text/plain\",         \"filename\": \"text_1.txt\",         \"payload\": \"string\"       },       {         \"type\": \"image/jpeg\",         \"filename\": \"sample.jpeg\",         \"payload\": \"string\"       }     ] }
The fields are: | Field | Description | | --- | --- | | `status` | The final state of the message. | | `destinationAddress` |The number the message was sent to. | | `senderAddress` | The number the message was sent from. | | `subject` | The subject assigned to the message. | | `sentTimestamp` | Time handling of the message ended. | | `envelope` | Information about about terminal type and originating operator. | | `MMSContent` | An array of the actual content of the reply message. | | `type` | The content type of the message. | | `filename` | The filename for the message content. | | `payload` | The content of the message. | + + # MMS Health Check + # Determine whether the MMS service is up or down. + # @param [Hash] opts the optional parameters + # @return [HealthCheckResponse] + def m_ms_health_check(opts = {}) + data, _status_code, _headers = m_ms_health_check_with_http_info(opts) + data + end + + # MMS Health Check + # Determine whether the MMS service is up or down. + # @param [Hash] opts the optional parameters + # @return [Array<(HealthCheckResponse, Integer, Hash)>] HealthCheckResponse data, response status code and response headers + def m_ms_health_check_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApi.m_ms_health_check ...' + end + # resource path + local_var_path = '/messages/mms/healthcheck' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:body] + + # return_type + return_type = opts[:return_type] || 'HealthCheckResponse' + + # auth_names + auth_names = opts[:auth_names] || [] + + new_options = opts.merge( + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApi#m_ms_health_check\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Retrieve MMS Replies + # Messages are retrieved one at a time, starting with the earliest reply. If the subscription has a `notifyURL`, reply messages will be logged there instead, i.e. `GET` and reply `notifyURL` are exclusive. # MMS Reply with Notification URL When a reply is received, the API will send a POST to the subscription URL that has been previously specified.
{   \"to\": \"+61418123456\",   \"from\": \"+61421987654\",   \"sentTimestamp\": \"2018-03-23T12:15:45+10:00\",   \"messageId\": \"XFRO1ApiA0000000111\",   \"subject\": \"Foo\",   \"envelope\": \"string\",   \"MMSContent\":     [       {         \"type\": \"text/plain\",         \"filename\": \"text_1.txt\",         \"payload\": \"string\"       },       {         \"type\": \"image/jpeg\",         \"filename\": \"sample.jpeg\",         \"payload\": \"string\"       }     ] }
The fields are: | Field | Description | | --- | --- | | `to` |The number the message was sent to. | | `from` | The number the message was sent from. | | `sentTimestamp` | Time handling of the message ended. | | `messageId` | Message Id assigned by the MMSC | | `subject` | The subject assigned to the message. | | `envelope` | Information about about terminal type and originating operator. | | `MMSContent` | An array of the actual content of the reply message. | | `type` | The content type of the message. | | `filename` | The filename for the message content. | | `payload` | The content of the message. | # @param [Hash] opts the optional parameters - # @return [Array] - def retrieve_mms_responses(opts = {}) - data, _status_code, _headers = retrieve_mms_responses_with_http_info(opts) + # @return [GetMmsResponse] + def retrieve_mms_replies(opts = {}) + data, _status_code, _headers = retrieve_mms_replies_with_http_info(opts) data end - # Retrieve MMS Responses - # Messages are retrieved one at a time, starting with the earliest response. If the subscription has a `notifyURL`, response messages will be logged there instead. # Notification URL Format for MMS Replies <pre><code class=\"language-sh\">{ \"status\": \"RECEIVED\", \"destinationAddress\": \"+61418123456\", \"senderAddress\": \"+61421987654\", \"subject\": \"Foo\", \"sentTimestamp\": \"2018-03-23T12:15:45+10:00\", \"envelope\": \"string\", \"MMSContent\": [ { \"type\": \"text/plain\", \"filename\": \"text_1.txt\", \"payload\": \"string\" }, { \"type\": \"image/jpeg\", \"filename\": \"sample.jpeg\", \"payload\": \"string\" } ] }</code></pre> The fields are: | Field | Description | | --- | --- | | `status` | The final state of the message. | | `destinationAddress` |The number the message was sent to. | | `senderAddress` | The number the message was sent from. | | `subject` | The subject assigned to the message. | | `sentTimestamp` | Time handling of the message ended. | | `envelope` | Information about about terminal type and originating operator. | | `MMSContent` | An array of the actual content of the reply message. | | `type` | The content type of the message. | | `filename` | The filename for the message content. | | `payload` | The content of the message. | + # Retrieve MMS Replies + # Messages are retrieved one at a time, starting with the earliest reply. If the subscription has a `notifyURL`, reply messages will be logged there instead, i.e. `GET` and reply `notifyURL` are exclusive. # MMS Reply with Notification URL When a reply is received, the API will send a POST to the subscription URL that has been previously specified. <pre><code class=\"language-sh\">{ \"to\": \"+61418123456\", \"from\": \"+61421987654\", \"sentTimestamp\": \"2018-03-23T12:15:45+10:00\", \"messageId\": \"XFRO1ApiA0000000111\", \"subject\": \"Foo\", \"envelope\": \"string\", \"MMSContent\": [ { \"type\": \"text/plain\", \"filename\": \"text_1.txt\", \"payload\": \"string\" }, { \"type\": \"image/jpeg\", \"filename\": \"sample.jpeg\", \"payload\": \"string\" } ] }</code></pre> The fields are: | Field | Description | | --- | --- | | `to` |The number the message was sent to. | | `from` | The number the message was sent from. | | `sentTimestamp` | Time handling of the message ended. | | `messageId` | Message Id assigned by the MMSC | | `subject` | The subject assigned to the message. | | `envelope` | Information about about terminal type and originating operator. | | `MMSContent` | An array of the actual content of the reply message. | | `type` | The content type of the message. | | `filename` | The filename for the message content. | | `payload` | The content of the message. | # @param [Hash] opts the optional parameters - # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers - def retrieve_mms_responses_with_http_info(opts = {}) + # @return [Array<(GetMmsResponse, Integer, Hash)>] GetMmsResponse data, response status code and response headers + def retrieve_mms_replies_with_http_info(opts = {}) if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: MessagingApi.retrieve_mms_responses ...' + @api_client.config.logger.debug 'Calling API: MessagingApi.retrieve_mms_replies ...' end # resource path local_var_path = '/messages/mms' # query parameters - query_params = {} + query_params = opts[:query_params] || {} # header parameters - header_params = {} + header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters - form_params = {} + form_params = opts[:form_params] || {} # http body (model) - post_body = nil - auth_names = ['auth'] - data, status_code, headers = @api_client.call_api(:GET, local_var_path, + post_body = opts[:body] + + # return_type + return_type = opts[:return_type] || 'GetMmsResponse' + + # auth_names + auth_names = opts[:auth_names] || ['auth'] + + new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, - :return_type => 'Array') + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging - @api_client.config.logger.debug "API called: MessagingApi#retrieve_mms_responses\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + @api_client.config.logger.debug "API called: MessagingApi#retrieve_mms_replies\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end - # Retrieve SMS Responses - # Messages are retrieved one at a time, starting with the earliest response. The API supports the encoding of the full range of emojis in the reply message. The emojis will be in their UTF-8 format. If the subscription has a `notifyURL`, response messages will be logged there instead. # Notification URL Format for SMS Response
{   \"to\":\"+61472880123\",   \"from\":\"+61412345678\",   \"body\":\"Foo4\",   \"sentTimestamp\":\"2018-04-20T14:24:35\",   \"messageId\":\"DMASApiA0000000146\" }
The fields are: | Field | Description | | --- |--- | | `to` | The number the message was sent to. | | `from` | The number the message was sent from. | | `body` | The content of the SMS response. | | `sentTimestamp` | Time handling of the message ended. | | `messageId` | The ID assigned to the message. | + + # Retrieve SMS Replies + # Messages are retrieved one at a time, starting with the earliest reply. The API supports the encoding of emojis in the reply message. The emojis will be in their UTF-8 format. If the subscription has a `notifyURL`, reply messages will be logged there instead. # SMS Reply with Notification URL When a reply is received, the API will send a POST to the subscription URL that has been previously specified.
{   \"to\":\"+61472880123\",   \"from\":\"+61412345678\",   \"body\":\"Foo4\",   \"sentTimestamp\":\"2018-04-20T14:24:35\",   \"messageId\":\"DMASApiA0000000146\" }
The fields are: | Field | Description | | --- |--- | | `to` | The number the message was sent to. | | `from` | The number the message was sent from. | | `body` | The content of the SMS response. | | `sentTimestamp` | Time handling of the message ended. | | `messageId` | The ID assigned to the message. | # @param [Hash] opts the optional parameters # @return [InboundPollResponse] - def retrieve_sms_responses(opts = {}) - data, _status_code, _headers = retrieve_sms_responses_with_http_info(opts) + def retrieve_sms_replies(opts = {}) + data, _status_code, _headers = retrieve_sms_replies_with_http_info(opts) data end - # Retrieve SMS Responses - # Messages are retrieved one at a time, starting with the earliest response. The API supports the encoding of the full range of emojis in the reply message. The emojis will be in their UTF-8 format. If the subscription has a `notifyURL`, response messages will be logged there instead. # Notification URL Format for SMS Response <pre><code class=\"language-sh\">{ \"to\":\"+61472880123\", \"from\":\"+61412345678\", \"body\":\"Foo4\", \"sentTimestamp\":\"2018-04-20T14:24:35\", \"messageId\":\"DMASApiA0000000146\" }</code></pre> The fields are: | Field | Description | | --- |--- | | `to` | The number the message was sent to. | | `from` | The number the message was sent from. | | `body` | The content of the SMS response. | | `sentTimestamp` | Time handling of the message ended. | | `messageId` | The ID assigned to the message. | + # Retrieve SMS Replies + # Messages are retrieved one at a time, starting with the earliest reply. The API supports the encoding of emojis in the reply message. The emojis will be in their UTF-8 format. If the subscription has a `notifyURL`, reply messages will be logged there instead. # SMS Reply with Notification URL When a reply is received, the API will send a POST to the subscription URL that has been previously specified. <pre><code class=\"language-sh\">{ \"to\":\"+61472880123\", \"from\":\"+61412345678\", \"body\":\"Foo4\", \"sentTimestamp\":\"2018-04-20T14:24:35\", \"messageId\":\"DMASApiA0000000146\" }</code></pre> The fields are: | Field | Description | | --- |--- | | `to` | The number the message was sent to. | | `from` | The number the message was sent from. | | `body` | The content of the SMS response. | | `sentTimestamp` | Time handling of the message ended. | | `messageId` | The ID assigned to the message. | # @param [Hash] opts the optional parameters - # @return [Array<(InboundPollResponse, Fixnum, Hash)>] InboundPollResponse data, response status code and response headers - def retrieve_sms_responses_with_http_info(opts = {}) + # @return [Array<(InboundPollResponse, Integer, Hash)>] InboundPollResponse data, response status code and response headers + def retrieve_sms_replies_with_http_info(opts = {}) if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: MessagingApi.retrieve_sms_responses ...' + @api_client.config.logger.debug 'Calling API: MessagingApi.retrieve_sms_replies ...' end # resource path local_var_path = '/messages/sms' # query parameters - query_params = {} + query_params = opts[:query_params] || {} # header parameters - header_params = {} + header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters - form_params = {} + form_params = opts[:form_params] || {} # http body (model) - post_body = nil - auth_names = ['auth'] - data, status_code, headers = @api_client.call_api(:GET, local_var_path, + post_body = opts[:body] + + # return_type + return_type = opts[:return_type] || 'InboundPollResponse' + + # auth_names + auth_names = opts[:auth_names] || ['auth'] + + new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, - :return_type => 'InboundPollResponse') + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging - @api_client.config.logger.debug "API called: MessagingApi#retrieve_sms_responses\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + @api_client.config.logger.debug "API called: MessagingApi#retrieve_sms_replies\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end - # Send MMS - # Send MMS - # @param send_mms_request A JSON or XML payload containing the recipient's phone number and MMS message. The recipient number should be in the format '04xxxxxxxx' where x is a digit. + # SMS Health Check + # Determine whether the SMS service is up or down. + # @param [Hash] opts the optional parameters + # @return [HealthCheckResponse] + def s_ms_health_check(opts = {}) + data, _status_code, _headers = s_ms_health_check_with_http_info(opts) + data + end + + # SMS Health Check + # Determine whether the SMS service is up or down. + # @param [Hash] opts the optional parameters + # @return [Array<(HealthCheckResponse, Integer, Hash)>] HealthCheckResponse data, response status code and response headers + def s_ms_health_check_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApi.s_ms_health_check ...' + end + # resource path + local_var_path = '/messages/sms/healthcheck' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:body] + + # return_type + return_type = opts[:return_type] || 'HealthCheckResponse' + + # auth_names + auth_names = opts[:auth_names] || [] + + new_options = opts.merge( + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApi#s_ms_health_check\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Send Multiple SMS + # Send multiple SMS in one API call. + # @param payload [SendSmsMultiRequest] A JSON payload containing the recipient's phone number and text message. This number can be in international format if preceeded by a '+' or in national format ('04xxxxxxxx') where x is a digit. # @param [Hash] opts the optional parameters - # @return [MessageSentResponse] - def send_mms(send_mms_request, opts = {}) - data, _status_code, _headers = send_mms_with_http_info(send_mms_request, opts) + # @return [MessageSentResponseSms] + def s_ms_multi(payload, opts = {}) + data, _status_code, _headers = s_ms_multi_with_http_info(payload, opts) data end + # Send Multiple SMS + # Send multiple SMS in one API call. + # @param payload [SendSmsMultiRequest] A JSON payload containing the recipient's phone number and text message. This number can be in international format if preceeded by a '+' or in national format ('04xxxxxxxx') where x is a digit. + # @param [Hash] opts the optional parameters + # @return [Array<(MessageSentResponseSms, Integer, Hash)>] MessageSentResponseSms data, response status code and response headers + def s_ms_multi_with_http_info(payload, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApi.s_ms_multi ...' + end + # verify the required parameter 'payload' is set + if @api_client.config.client_side_validation && payload.nil? + fail ArgumentError, "Missing the required parameter 'payload' when calling MessagingApi.s_ms_multi" + end + # resource path + local_var_path = '/messages/sms/multi' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:body] || @api_client.object_to_http_body(payload) + + # return_type + return_type = opts[:return_type] || 'MessageSentResponseSms' + + # auth_names + auth_names = opts[:auth_names] || ['auth'] + + new_options = opts.merge( + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApi#s_ms_multi\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Send MMS # Send MMS - # @param send_mms_request A JSON or XML payload containing the recipient's phone number and MMS message. The recipient number should be in the format '04xxxxxxxx' where x is a digit. + # @param body [SendMmsRequest] A JSON or XML payload containing the recipient's phone number and MMS message. The recipient number should be in the format '04xxxxxxxx' where x is a digit. + # @param [Hash] opts the optional parameters + # @return [MessageSentResponseMms] + def send_mms(body, opts = {}) + data, _status_code, _headers = send_mms_with_http_info(body, opts) + data + end + # Send MMS + # Send MMS + # @param body [SendMmsRequest] A JSON or XML payload containing the recipient's phone number and MMS message. The recipient number should be in the format '04xxxxxxxx' where x is a digit. # @param [Hash] opts the optional parameters - # @return [Array<(MessageSentResponse, Fixnum, Hash)>] MessageSentResponse data, response status code and response headers - def send_mms_with_http_info(send_mms_request, opts = {}) + # @return [Array<(MessageSentResponseMms, Integer, Hash)>] MessageSentResponseMms data, response status code and response headers + def send_mms_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MessagingApi.send_mms ...' end - # verify the required parameter 'send_mms_request' is set - if @api_client.config.client_side_validation && send_mms_request.nil? - fail ArgumentError, "Missing the required parameter 'send_mms_request' when calling MessagingApi.send_mms" + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling MessagingApi.send_mms" end # resource path local_var_path = '/messages/mms' # query parameters - query_params = {} + query_params = opts[:query_params] || {} # header parameters - header_params = {} + header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters - form_params = {} + form_params = opts[:form_params] || {} # http body (model) - post_body = @api_client.object_to_http_body(send_mms_request) - auth_names = ['auth'] - data, status_code, headers = @api_client.call_api(:POST, local_var_path, + post_body = opts[:body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:return_type] || 'MessageSentResponseMms' + + # auth_names + auth_names = opts[:auth_names] || ['auth'] + + new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, - :return_type => 'MessageSentResponse') + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: MessagingApi#send_mms\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end + # Send SMS # Send an SMS Message to a single or multiple mobile number/s. - # @param send_sms_request A JSON or XML payload containing the recipient's phone number and text message. This number can be in international format if preceeded by a '+' or in national format ('04xxxxxxxx') where x is a digit. - + # @param payload [SendSMSRequest] A JSON or XML payload containing the recipient's phone number and text message. This number can be in international format if preceeded by a '+' or in national format ('04xxxxxxxx') where x is a digit. # @param [Hash] opts the optional parameters - # @return [MessageSentResponse] - def send_sms(send_sms_request, opts = {}) - data, _status_code, _headers = send_sms_with_http_info(send_sms_request, opts) + # @return [MessageSentResponseSms] + def send_sms(payload, opts = {}) + data, _status_code, _headers = send_sms_with_http_info(payload, opts) data end # Send SMS # Send an SMS Message to a single or multiple mobile number/s. - # @param send_sms_request A JSON or XML payload containing the recipient's phone number and text message. This number can be in international format if preceeded by a '+' or in national format ('04xxxxxxxx') where x is a digit. - + # @param payload [SendSMSRequest] A JSON or XML payload containing the recipient's phone number and text message. This number can be in international format if preceeded by a '+' or in national format ('04xxxxxxxx') where x is a digit. # @param [Hash] opts the optional parameters - # @return [Array<(MessageSentResponse, Fixnum, Hash)>] MessageSentResponse data, response status code and response headers - def send_sms_with_http_info(send_sms_request, opts = {}) + # @return [Array<(MessageSentResponseSms, Integer, Hash)>] MessageSentResponseSms data, response status code and response headers + def send_sms_with_http_info(payload, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MessagingApi.send_sms ...' end - # verify the required parameter 'send_sms_request' is set - if @api_client.config.client_side_validation && send_sms_request.nil? - fail ArgumentError, "Missing the required parameter 'send_sms_request' when calling MessagingApi.send_sms" + # verify the required parameter 'payload' is set + if @api_client.config.client_side_validation && payload.nil? + fail ArgumentError, "Missing the required parameter 'payload' when calling MessagingApi.send_sms" end # resource path local_var_path = '/messages/sms' # query parameters - query_params = {} + query_params = opts[:query_params] || {} # header parameters - header_params = {} + header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters - form_params = {} + form_params = opts[:form_params] || {} # http body (model) - post_body = @api_client.object_to_http_body(send_sms_request) - auth_names = ['auth'] - data, status_code, headers = @api_client.call_api(:POST, local_var_path, + post_body = opts[:body] || @api_client.object_to_http_body(payload) + + # return_type + return_type = opts[:return_type] || 'MessageSentResponseSms' + + # auth_names + auth_names = opts[:auth_names] || ['auth'] + + new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, - :return_type => 'MessageSentResponse') + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: MessagingApi#send_sms\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/lib/Telstra_Messaging/api/provisioning_api.rb b/lib/Telstra_Messaging/api/provisioning_api.rb index a5e014b..068c264 100644 --- a/lib/Telstra_Messaging/api/provisioning_api.rb +++ b/lib/Telstra_Messaging/api/provisioning_api.rb @@ -1,16 +1,16 @@ =begin #Telstra Messaging API -# # Introduction

Send and receive SMS and MMS messages globally using Telstra's enterprise grade Messaging API. It also allows your application to track the delivery status of both sent and received messages. Get your dedicated Australian number, and start sending and receiving messages today.

# Features The Telstra Messaging API provides the features below. | Feature | Description | | --- | --- | | `Dedicated Number` | Provision a mobile number for your account to be used as `from` address in the API | | `Send Messages` | Sending SMS or MMS messages | | `Receive Messages` | Telstra will deliver messages sent to a dedicated number or to the `notifyURL` defined by you | | `Broadcast Messages` | Invoke a single API call to send a message to a list of numbers provided in `to` | | `Delivery Status` | Query the delivery status of your messages | | `Callbacks` | Provide a notification URL and Telstra will notify your app when a message status changes | | `Alphanumeric Identifier` | Differentiate yourself by providing an alphanumeric string in `from`. This feature is only available on paid plans | | `Concatenation` | Send messages up to 1900 characters long and Telstra will automaticaly segment and reassemble them | | `Reply Request` | Create a chat session by associating `messageId` and `to` number to track responses received from a mobile number. We will store this association for 8 days | | `Character set` | Accepts all Unicode characters as part of UTF-8 | | `Bounce-back response` | See if your SMS hits an unreachable or unallocated number (Australia Only) | | `Queuing` | Messaging API will automatically queue and deliver each message at a compliant rate. | | `Emoji Encoding` | The API supports the encoding of the full range of emojis. Emojis in the reply messages will be in their UTF-8 format. | ## Delivery Notification or Callbacks The API provides several methods for notifying when a message has been delivered to the destination. 1. When you send a message there is an opportunity to specify a `notifyURL`. Once the message has been delivered the API will make a call to this URL to advise of the message status. 2. If you do not specify a URL you can always call the `GET /status` API to get the status of the message. # Getting Access to the API 1. Register at [https://dev.telstra.com](https://dev.telstra.com). 2. After registration, login to [https://dev.telstra.com](https://dev.telstra.com) and navigate to the **My apps** page. 3. Create your application by clicking the **Add new app** button 4. Select **API Free Trial** Product when configuring your application. This Product includes the Telstra Messaging API as well as other free trial APIs. Your application will be approved automatically. 5. There is a maximum of 1000 free messages per developer. Additional messages and features can be purchased from [https://dev.telstra.com](https://dev.telstra.com). 6. Note your `Client key` and `Client secret` as these will be needed to provision a number for your application and for authentication. Now head over to **Getting Started** where you can find a postman collection as well as some links to sample apps and SDKs to get you started. Happy Messaging! # Frequently Asked Questions **Q: Is creating a subscription via the Provisioning call a required step?** A. Yes. You will only be able to start sending messages if you have a provisioned dedicated number. Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: When trying to send an SMS I receive a `400 Bad Request` response. How can I fix this?** A. You need to make sure you have a provisioned dedicated number before you can send an SMS. If you do not have a provisioned dedicated number and you try to send a message via the API, you will get the error below in the response:
{   \"status\":\"400\",   \"code\":\"DELIVERY-IMPOSSIBLE\",   \"message\":\"Invalid \\'from\\' address specified\" }
Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: How long does my dedicated number stay active for?** A. When you provision a dedicated number, by default it will be active for 30 days. You can use the `activeDays` parameter during the provisioning call to increment or decrement the number of days your dedicated number will remain active. Note that Free Trial apps will have 30 days as the maximum `activeDays` they can add to their provisioned number. If the Provisioning call is made several times within that 30-Day period, it will return the `expiryDate` in the Unix format and will not add any activeDays until after that `expiryDate`. **Q: Can I send a broadcast message using the Telstra Messaging API?** A. Yes. Recipient numbers can be in the form of an array of strings if a broadcast message needs to be sent, allowing you to send to multiple mobile numbers in one API call. A sample request body for this will be: `{\"to\":[\"+61412345678\",\"+61487654321\"],\"body\":\"Test Message\"}` **Q: Can I send SMS and MMS to all countries?** A. You can send SMS and MMS to all countries EXCEPT to countries which are subject to global sanctions namely: Burma, Côte d'Ivoire, Cuba, Iran, North Korea, Syria. **Q: Can I use `Alphanumeric Identifier` from my paid plan via credit card?** A. `Alphanumeric Identifier` is only available on Telstra Account paid plans, not through credit card paid plans. **Q: What is the maximum sized MMS that I can send?** A. This will depend on the carrier that will receive the MMS. For Telstra it's up to 2MB, Optus up to 1.5MB and Vodafone only allows up to 500kB. You will need to check with international carriers for thier MMS size limits. **Q: How is the size of an MMS calculated?** A. Images are scaled up to approximately 4/3 when base64 encoded. Additionally, there is approximately 200 bytes of overhead on each MMS. Assuming the maximum MMS that can be sent on Telstra’s network is 2MB, then the maximum image size that can be sent will be approximately 1.378MB (1.378 x 1.34 + 200, without SOAP encapsulation). **Q: How is an MMS classified as Small or Large?** A. MMSes with size below 600kB are classed as Small whereas those that are bigger than 600kB are classed as Large. They will be charged accordingly. **Q: Are SMILs supported by the Messaging API?** A. While there will be no error if you send an MMS with a SMIL presentation, the actual layout or sequence defined in the SMIL may not display as expected because most of the new smartphone devices ignore the SMIL presentation layer. SMIL was used in feature phones which had limited capability and SMIL allowed a *powerpoint type* presentation to be provided. Smartphones now have the capability to display video which is the better option for presentations. It is recommended that MMS messages should just drop the SMIL. **Q: How do I assign a delivery notification or callback URL?** A. You can assign a delivery notification or callback URL by adding the `notifyURL` parameter in the body of the request when you send a message. Once the message has been delivered, a notification will then be posted to this callback URL. **Q: What is the difference between the `notifyURL` parameter in the Provisoning call versus the `notifyURL` parameter in the Send Message call?** A. The `notifyURL` in the Provisoning call will be the URL where replies to the provisioned number will be posted. On the other hand, the `notifyURL` in the Send Message call will be the URL where the delivery notification will be posted, e.g. when an SMS has already been delivered to the recipient. # Getting Started Below are the steps to get started with the Telstra Messaging API. 1. Generate an OAuth2 token using your `Client key` and `Client secret`. 2. Use the Provisioning call to create a subscription and receive a dedicated number. 3. Send a message to a specific mobile number. ## Run in Postman \"Run ## Sample Apps - [Perl Sample App](https://github.com/telstra/MessagingAPI-perl-sample-app) - [Happy Chat App](https://github.com/telstra/messaging-sample-code-happy-chat) - [PHP Sample App](https://github.com/developersteve/telstra-messaging-php) ## SDK Repos - [Messaging API - PHP SDK](https://github.com/telstra/MessagingAPI-SDK-php) - [Messaging API - Python SDK](https://github.com/telstra/MessagingAPI-SDK-python) - [Messaging API - Ruby SDK](https://github.com/telstra/MessagingAPI-SDK-ruby) - [Messaging API - NodeJS SDK](https://github.com/telstra/MessagingAPI-SDK-node) - [Messaging API - .Net2 SDK](https://github.com/telstra/MessagingAPI-SDK-dotnet) - [Messaging API - Java SDK](https://github.com/telstra/MessagingAPI-SDK-Java) ## Blog Posts For more information on the Messaging API, you can read these blog posts: - [Callbacks Part 1](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-1) - [Callbacks Part 2](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-2) +#The Telstra Messaging API specification -OpenAPI spec version: 2.2.9 +The version of the OpenAPI document: 2.2.9 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0 +OpenAPI Generator version: 4.2.3-SNAPSHOT =end -require 'uri' +require 'cgi' module Telstra_Messaging class ProvisioningApi @@ -20,110 +20,131 @@ def initialize(api_client = ApiClient.default) @api_client = api_client end # Create Subscription - # Invoke the provisioning API to get a dedicated mobile number for an account or application. Note that Free Trial apps will have a 30-Day Limit for their provisioned number. If the Provisioning call is made several times within that 30-Day period, it will return the `expiryDate` in the Unix format and will not add any activeDays until after that `expiryDate`. For paid apps, a provisioned number can be allotted for a maximum of 5 years. If a Provisioning call is made which will result to activeDays > 1830, the response body will indicate that the provisioned number is already valid for more than 5 years. - # @param provision_number_request A JSON payload containing the required attributes + # Invoke the provisioning API to get a dedicated mobile number for an account or application. Note that Free Trial apps will have a 30-Day Limit for their provisioned number. If the Provisioning call is made several times within that 30-Day period, it will return the `expiryDate` in the Unix format and will not add any activeDays until after that `expiryDate`. After the `expiryDate`, you may make another Provisioning call to extend the activeDays by another 30-Days. For paid apps, a provisioned number can be allotted for a maximum of 5 years. If a Provisioning call is made which will result to activeDays > 1825, a 409 `Active Days Max` response will be returned to indicate that the provisioned number is already valid for more than 5 years and that no update to activeDays has been made. + # @param body [ProvisionNumberRequest] A JSON payload containing the required attributes # @param [Hash] opts the optional parameters # @return [ProvisionNumberResponse] - def create_subscription(provision_number_request, opts = {}) - data, _status_code, _headers = create_subscription_with_http_info(provision_number_request, opts) + def create_subscription(body, opts = {}) + data, _status_code, _headers = create_subscription_with_http_info(body, opts) data end # Create Subscription - # Invoke the provisioning API to get a dedicated mobile number for an account or application. Note that Free Trial apps will have a 30-Day Limit for their provisioned number. If the Provisioning call is made several times within that 30-Day period, it will return the `expiryDate` in the Unix format and will not add any activeDays until after that `expiryDate`. For paid apps, a provisioned number can be allotted for a maximum of 5 years. If a Provisioning call is made which will result to activeDays > 1830, the response body will indicate that the provisioned number is already valid for more than 5 years. - # @param provision_number_request A JSON payload containing the required attributes + # Invoke the provisioning API to get a dedicated mobile number for an account or application. Note that Free Trial apps will have a 30-Day Limit for their provisioned number. If the Provisioning call is made several times within that 30-Day period, it will return the `expiryDate` in the Unix format and will not add any activeDays until after that `expiryDate`. After the `expiryDate`, you may make another Provisioning call to extend the activeDays by another 30-Days. For paid apps, a provisioned number can be allotted for a maximum of 5 years. If a Provisioning call is made which will result to activeDays > 1825, a 409 `Active Days Max` response will be returned to indicate that the provisioned number is already valid for more than 5 years and that no update to activeDays has been made. + # @param body [ProvisionNumberRequest] A JSON payload containing the required attributes # @param [Hash] opts the optional parameters - # @return [Array<(ProvisionNumberResponse, Fixnum, Hash)>] ProvisionNumberResponse data, response status code and response headers - def create_subscription_with_http_info(provision_number_request, opts = {}) + # @return [Array<(ProvisionNumberResponse, Integer, Hash)>] ProvisionNumberResponse data, response status code and response headers + def create_subscription_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProvisioningApi.create_subscription ...' end - # verify the required parameter 'provision_number_request' is set - if @api_client.config.client_side_validation && provision_number_request.nil? - fail ArgumentError, "Missing the required parameter 'provision_number_request' when calling ProvisioningApi.create_subscription" + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling ProvisioningApi.create_subscription" end # resource path local_var_path = '/messages/provisioning/subscriptions' # query parameters - query_params = {} + query_params = opts[:query_params] || {} # header parameters - header_params = {} + header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters - form_params = {} + form_params = opts[:form_params] || {} # http body (model) - post_body = @api_client.object_to_http_body(provision_number_request) - auth_names = ['auth'] - data, status_code, headers = @api_client.call_api(:POST, local_var_path, + post_body = opts[:body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:return_type] || 'ProvisionNumberResponse' + + # auth_names + auth_names = opts[:auth_names] || ['auth'] + + new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, - :return_type => 'ProvisionNumberResponse') + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: ProvisioningApi#create_subscription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end + # Delete Subscription # Delete a mobile number subscription from an account - # @param delete_number_request EmptyArr + # @param body [DeleteNumberRequest] EmptyArr # @param [Hash] opts the optional parameters # @return [nil] - def delete_subscription(delete_number_request, opts = {}) - delete_subscription_with_http_info(delete_number_request, opts) + def delete_subscription(body, opts = {}) + delete_subscription_with_http_info(body, opts) nil end # Delete Subscription # Delete a mobile number subscription from an account - # @param delete_number_request EmptyArr + # @param body [DeleteNumberRequest] EmptyArr # @param [Hash] opts the optional parameters - # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers - def delete_subscription_with_http_info(delete_number_request, opts = {}) + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def delete_subscription_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProvisioningApi.delete_subscription ...' end - # verify the required parameter 'delete_number_request' is set - if @api_client.config.client_side_validation && delete_number_request.nil? - fail ArgumentError, "Missing the required parameter 'delete_number_request' when calling ProvisioningApi.delete_subscription" + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling ProvisioningApi.delete_subscription" end # resource path local_var_path = '/messages/provisioning/subscriptions' # query parameters - query_params = {} + query_params = opts[:query_params] || {} # header parameters - header_params = {} + header_params = opts[:header_params] || {} # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters - form_params = {} + form_params = opts[:form_params] || {} # http body (model) - post_body = @api_client.object_to_http_body(delete_number_request) - auth_names = ['auth'] - data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, + post_body = opts[:body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:return_type] + + # auth_names + auth_names = opts[:auth_names] || ['auth'] + + new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, - :auth_names => auth_names) + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: ProvisioningApi#delete_subscription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end + # Get Subscription # Get mobile number subscription for an account # @param [Hash] opts the optional parameters @@ -136,7 +157,7 @@ def get_subscription(opts = {}) # Get Subscription # Get mobile number subscription for an account # @param [Hash] opts the optional parameters - # @return [Array<(GetSubscriptionResponse, Fixnum, Hash)>] GetSubscriptionResponse data, response status code and response headers + # @return [Array<(GetSubscriptionResponse, Integer, Hash)>] GetSubscriptionResponse data, response status code and response headers def get_subscription_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProvisioningApi.get_subscription ...' @@ -145,26 +166,35 @@ def get_subscription_with_http_info(opts = {}) local_var_path = '/messages/provisioning/subscriptions' # query parameters - query_params = {} + query_params = opts[:query_params] || {} # header parameters - header_params = {} + header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters - form_params = {} + form_params = opts[:form_params] || {} # http body (model) - post_body = nil - auth_names = ['auth'] - data, status_code, headers = @api_client.call_api(:GET, local_var_path, + post_body = opts[:body] + + # return_type + return_type = opts[:return_type] || 'GetSubscriptionResponse' + + # auth_names + auth_names = opts[:auth_names] || ['auth'] + + new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, - :return_type => 'GetSubscriptionResponse') + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: ProvisioningApi#get_subscription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/lib/Telstra_Messaging/api_client.rb b/lib/Telstra_Messaging/api_client.rb index 9daf589..2ce6d28 100644 --- a/lib/Telstra_Messaging/api_client.rb +++ b/lib/Telstra_Messaging/api_client.rb @@ -1,12 +1,12 @@ =begin #Telstra Messaging API -# # Introduction

Send and receive SMS and MMS messages globally using Telstra's enterprise grade Messaging API. It also allows your application to track the delivery status of both sent and received messages. Get your dedicated Australian number, and start sending and receiving messages today.

# Features The Telstra Messaging API provides the features below. | Feature | Description | | --- | --- | | `Dedicated Number` | Provision a mobile number for your account to be used as `from` address in the API | | `Send Messages` | Sending SMS or MMS messages | | `Receive Messages` | Telstra will deliver messages sent to a dedicated number or to the `notifyURL` defined by you | | `Broadcast Messages` | Invoke a single API call to send a message to a list of numbers provided in `to` | | `Delivery Status` | Query the delivery status of your messages | | `Callbacks` | Provide a notification URL and Telstra will notify your app when a message status changes | | `Alphanumeric Identifier` | Differentiate yourself by providing an alphanumeric string in `from`. This feature is only available on paid plans | | `Concatenation` | Send messages up to 1900 characters long and Telstra will automaticaly segment and reassemble them | | `Reply Request` | Create a chat session by associating `messageId` and `to` number to track responses received from a mobile number. We will store this association for 8 days | | `Character set` | Accepts all Unicode characters as part of UTF-8 | | `Bounce-back response` | See if your SMS hits an unreachable or unallocated number (Australia Only) | | `Queuing` | Messaging API will automatically queue and deliver each message at a compliant rate. | | `Emoji Encoding` | The API supports the encoding of the full range of emojis. Emojis in the reply messages will be in their UTF-8 format. | ## Delivery Notification or Callbacks The API provides several methods for notifying when a message has been delivered to the destination. 1. When you send a message there is an opportunity to specify a `notifyURL`. Once the message has been delivered the API will make a call to this URL to advise of the message status. 2. If you do not specify a URL you can always call the `GET /status` API to get the status of the message. # Getting Access to the API 1. Register at [https://dev.telstra.com](https://dev.telstra.com). 2. After registration, login to [https://dev.telstra.com](https://dev.telstra.com) and navigate to the **My apps** page. 3. Create your application by clicking the **Add new app** button 4. Select **API Free Trial** Product when configuring your application. This Product includes the Telstra Messaging API as well as other free trial APIs. Your application will be approved automatically. 5. There is a maximum of 1000 free messages per developer. Additional messages and features can be purchased from [https://dev.telstra.com](https://dev.telstra.com). 6. Note your `Client key` and `Client secret` as these will be needed to provision a number for your application and for authentication. Now head over to **Getting Started** where you can find a postman collection as well as some links to sample apps and SDKs to get you started. Happy Messaging! # Frequently Asked Questions **Q: Is creating a subscription via the Provisioning call a required step?** A. Yes. You will only be able to start sending messages if you have a provisioned dedicated number. Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: When trying to send an SMS I receive a `400 Bad Request` response. How can I fix this?** A. You need to make sure you have a provisioned dedicated number before you can send an SMS. If you do not have a provisioned dedicated number and you try to send a message via the API, you will get the error below in the response:
{   \"status\":\"400\",   \"code\":\"DELIVERY-IMPOSSIBLE\",   \"message\":\"Invalid \\'from\\' address specified\" }
Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: How long does my dedicated number stay active for?** A. When you provision a dedicated number, by default it will be active for 30 days. You can use the `activeDays` parameter during the provisioning call to increment or decrement the number of days your dedicated number will remain active. Note that Free Trial apps will have 30 days as the maximum `activeDays` they can add to their provisioned number. If the Provisioning call is made several times within that 30-Day period, it will return the `expiryDate` in the Unix format and will not add any activeDays until after that `expiryDate`. **Q: Can I send a broadcast message using the Telstra Messaging API?** A. Yes. Recipient numbers can be in the form of an array of strings if a broadcast message needs to be sent, allowing you to send to multiple mobile numbers in one API call. A sample request body for this will be: `{\"to\":[\"+61412345678\",\"+61487654321\"],\"body\":\"Test Message\"}` **Q: Can I send SMS and MMS to all countries?** A. You can send SMS and MMS to all countries EXCEPT to countries which are subject to global sanctions namely: Burma, Côte d'Ivoire, Cuba, Iran, North Korea, Syria. **Q: Can I use `Alphanumeric Identifier` from my paid plan via credit card?** A. `Alphanumeric Identifier` is only available on Telstra Account paid plans, not through credit card paid plans. **Q: What is the maximum sized MMS that I can send?** A. This will depend on the carrier that will receive the MMS. For Telstra it's up to 2MB, Optus up to 1.5MB and Vodafone only allows up to 500kB. You will need to check with international carriers for thier MMS size limits. **Q: How is the size of an MMS calculated?** A. Images are scaled up to approximately 4/3 when base64 encoded. Additionally, there is approximately 200 bytes of overhead on each MMS. Assuming the maximum MMS that can be sent on Telstra’s network is 2MB, then the maximum image size that can be sent will be approximately 1.378MB (1.378 x 1.34 + 200, without SOAP encapsulation). **Q: How is an MMS classified as Small or Large?** A. MMSes with size below 600kB are classed as Small whereas those that are bigger than 600kB are classed as Large. They will be charged accordingly. **Q: Are SMILs supported by the Messaging API?** A. While there will be no error if you send an MMS with a SMIL presentation, the actual layout or sequence defined in the SMIL may not display as expected because most of the new smartphone devices ignore the SMIL presentation layer. SMIL was used in feature phones which had limited capability and SMIL allowed a *powerpoint type* presentation to be provided. Smartphones now have the capability to display video which is the better option for presentations. It is recommended that MMS messages should just drop the SMIL. **Q: How do I assign a delivery notification or callback URL?** A. You can assign a delivery notification or callback URL by adding the `notifyURL` parameter in the body of the request when you send a message. Once the message has been delivered, a notification will then be posted to this callback URL. **Q: What is the difference between the `notifyURL` parameter in the Provisoning call versus the `notifyURL` parameter in the Send Message call?** A. The `notifyURL` in the Provisoning call will be the URL where replies to the provisioned number will be posted. On the other hand, the `notifyURL` in the Send Message call will be the URL where the delivery notification will be posted, e.g. when an SMS has already been delivered to the recipient. # Getting Started Below are the steps to get started with the Telstra Messaging API. 1. Generate an OAuth2 token using your `Client key` and `Client secret`. 2. Use the Provisioning call to create a subscription and receive a dedicated number. 3. Send a message to a specific mobile number. ## Run in Postman \"Run ## Sample Apps - [Perl Sample App](https://github.com/telstra/MessagingAPI-perl-sample-app) - [Happy Chat App](https://github.com/telstra/messaging-sample-code-happy-chat) - [PHP Sample App](https://github.com/developersteve/telstra-messaging-php) ## SDK Repos - [Messaging API - PHP SDK](https://github.com/telstra/MessagingAPI-SDK-php) - [Messaging API - Python SDK](https://github.com/telstra/MessagingAPI-SDK-python) - [Messaging API - Ruby SDK](https://github.com/telstra/MessagingAPI-SDK-ruby) - [Messaging API - NodeJS SDK](https://github.com/telstra/MessagingAPI-SDK-node) - [Messaging API - .Net2 SDK](https://github.com/telstra/MessagingAPI-SDK-dotnet) - [Messaging API - Java SDK](https://github.com/telstra/MessagingAPI-SDK-Java) ## Blog Posts For more information on the Messaging API, you can read these blog posts: - [Callbacks Part 1](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-1) - [Callbacks Part 2](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-2) +#The Telstra Messaging API specification -OpenAPI spec version: 2.2.9 +The version of the OpenAPI document: 2.2.9 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0 +OpenAPI Generator version: 4.2.3-SNAPSHOT =end @@ -15,7 +15,6 @@ require 'logger' require 'tempfile' require 'typhoeus' -require 'uri' module Telstra_Messaging class ApiClient @@ -44,7 +43,7 @@ def self.default # Call an API with given options. # - # @return [Array<(Object, Fixnum, Hash)>] an array of 3 elements: + # @return [Array<(Object, Integer, Hash)>] an array of 3 elements: # the data deserialized from response body (could be nil), response status code and response headers. def call_api(http_method, path, opts = {}) request = build_request(http_method, path, opts) @@ -128,6 +127,34 @@ def build_request(http_method, path, opts = {}) request end + # Builds the HTTP request body + # + # @param [Hash] header_params Header parameters + # @param [Hash] form_params Query parameters + # @param [Object] body HTTP body (JSON/XML) + # @return [String] HTTP body data in the form of string + def build_request_body(header_params, form_params, body) + # http form + if header_params['Content-Type'] == 'application/x-www-form-urlencoded' || + header_params['Content-Type'] == 'multipart/form-data' + data = {} + form_params.each do |key, value| + case value + when ::File, ::Array, nil + # let typhoeus handle File, Array and nil parameters + data[key] = value + else + data[key] = value.to_s + end + end + elsif body + data = body.is_a?(String) ? body : body.to_json + else + data = nil + end + data + end + # Check if the given MIME is a JSON MIME. # JSON MIME examples: # application/json @@ -143,7 +170,7 @@ def json_mime?(mime) # Deserialize the response to the given return type. # # @param [Response] response HTTP response - # @param [String] return_type some examples: "User", "Array[User]", "Hash[String,Integer]" + # @param [String] return_type some examples: "User", "Array", "Hash" def deserialize(response, return_type) body = response.body @@ -187,7 +214,7 @@ def convert_to_type(data, return_type) data.to_i when 'Float' data.to_f - when 'BOOLEAN' + when 'Boolean' data == true when 'DateTime' # parse date time (expecting ISO 8601 format) @@ -210,9 +237,7 @@ def convert_to_type(data, return_type) end else # models, e.g. Pet - Telstra_Messaging.const_get(return_type).new.tap do |model| - model.build_from_hash data - end + Telstra_Messaging.const_get(return_type).build_from_hash(data) end end @@ -264,35 +289,7 @@ def sanitize_filename(filename) def build_request_url(path) # Add leading and trailing slashes to path path = "/#{path}".gsub(/\/+/, '/') - URI.encode(@config.base_url + path) - end - - # Builds the HTTP request body - # - # @param [Hash] header_params Header parameters - # @param [Hash] form_params Query parameters - # @param [Object] body HTTP body (JSON/XML) - # @return [String] HTTP body data in the form of string - def build_request_body(header_params, form_params, body) - # http form - if header_params['Content-Type'] == 'application/x-www-form-urlencoded' || - header_params['Content-Type'] == 'multipart/form-data' - data = {} - form_params.each do |key, value| - case value - when ::File, ::Array, nil - # let typhoeus handle File, Array and nil parameters - data[key] = value - else - data[key] = value.to_s - end - end - elsif body - data = body.is_a?(String) ? body : body.to_json - else - data = nil - end - data + @config.base_url + path end # Update hearder and query params based on authentication settings. diff --git a/lib/Telstra_Messaging/api_error.rb b/lib/Telstra_Messaging/api_error.rb index 34926ae..673bca2 100644 --- a/lib/Telstra_Messaging/api_error.rb +++ b/lib/Telstra_Messaging/api_error.rb @@ -1,12 +1,12 @@ =begin #Telstra Messaging API -# # Introduction

Send and receive SMS and MMS messages globally using Telstra's enterprise grade Messaging API. It also allows your application to track the delivery status of both sent and received messages. Get your dedicated Australian number, and start sending and receiving messages today.

# Features The Telstra Messaging API provides the features below. | Feature | Description | | --- | --- | | `Dedicated Number` | Provision a mobile number for your account to be used as `from` address in the API | | `Send Messages` | Sending SMS or MMS messages | | `Receive Messages` | Telstra will deliver messages sent to a dedicated number or to the `notifyURL` defined by you | | `Broadcast Messages` | Invoke a single API call to send a message to a list of numbers provided in `to` | | `Delivery Status` | Query the delivery status of your messages | | `Callbacks` | Provide a notification URL and Telstra will notify your app when a message status changes | | `Alphanumeric Identifier` | Differentiate yourself by providing an alphanumeric string in `from`. This feature is only available on paid plans | | `Concatenation` | Send messages up to 1900 characters long and Telstra will automaticaly segment and reassemble them | | `Reply Request` | Create a chat session by associating `messageId` and `to` number to track responses received from a mobile number. We will store this association for 8 days | | `Character set` | Accepts all Unicode characters as part of UTF-8 | | `Bounce-back response` | See if your SMS hits an unreachable or unallocated number (Australia Only) | | `Queuing` | Messaging API will automatically queue and deliver each message at a compliant rate. | | `Emoji Encoding` | The API supports the encoding of the full range of emojis. Emojis in the reply messages will be in their UTF-8 format. | ## Delivery Notification or Callbacks The API provides several methods for notifying when a message has been delivered to the destination. 1. When you send a message there is an opportunity to specify a `notifyURL`. Once the message has been delivered the API will make a call to this URL to advise of the message status. 2. If you do not specify a URL you can always call the `GET /status` API to get the status of the message. # Getting Access to the API 1. Register at [https://dev.telstra.com](https://dev.telstra.com). 2. After registration, login to [https://dev.telstra.com](https://dev.telstra.com) and navigate to the **My apps** page. 3. Create your application by clicking the **Add new app** button 4. Select **API Free Trial** Product when configuring your application. This Product includes the Telstra Messaging API as well as other free trial APIs. Your application will be approved automatically. 5. There is a maximum of 1000 free messages per developer. Additional messages and features can be purchased from [https://dev.telstra.com](https://dev.telstra.com). 6. Note your `Client key` and `Client secret` as these will be needed to provision a number for your application and for authentication. Now head over to **Getting Started** where you can find a postman collection as well as some links to sample apps and SDKs to get you started. Happy Messaging! # Frequently Asked Questions **Q: Is creating a subscription via the Provisioning call a required step?** A. Yes. You will only be able to start sending messages if you have a provisioned dedicated number. Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: When trying to send an SMS I receive a `400 Bad Request` response. How can I fix this?** A. You need to make sure you have a provisioned dedicated number before you can send an SMS. If you do not have a provisioned dedicated number and you try to send a message via the API, you will get the error below in the response:
{   \"status\":\"400\",   \"code\":\"DELIVERY-IMPOSSIBLE\",   \"message\":\"Invalid \\'from\\' address specified\" }
Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: How long does my dedicated number stay active for?** A. When you provision a dedicated number, by default it will be active for 30 days. You can use the `activeDays` parameter during the provisioning call to increment or decrement the number of days your dedicated number will remain active. Note that Free Trial apps will have 30 days as the maximum `activeDays` they can add to their provisioned number. If the Provisioning call is made several times within that 30-Day period, it will return the `expiryDate` in the Unix format and will not add any activeDays until after that `expiryDate`. **Q: Can I send a broadcast message using the Telstra Messaging API?** A. Yes. Recipient numbers can be in the form of an array of strings if a broadcast message needs to be sent, allowing you to send to multiple mobile numbers in one API call. A sample request body for this will be: `{\"to\":[\"+61412345678\",\"+61487654321\"],\"body\":\"Test Message\"}` **Q: Can I send SMS and MMS to all countries?** A. You can send SMS and MMS to all countries EXCEPT to countries which are subject to global sanctions namely: Burma, Côte d'Ivoire, Cuba, Iran, North Korea, Syria. **Q: Can I use `Alphanumeric Identifier` from my paid plan via credit card?** A. `Alphanumeric Identifier` is only available on Telstra Account paid plans, not through credit card paid plans. **Q: What is the maximum sized MMS that I can send?** A. This will depend on the carrier that will receive the MMS. For Telstra it's up to 2MB, Optus up to 1.5MB and Vodafone only allows up to 500kB. You will need to check with international carriers for thier MMS size limits. **Q: How is the size of an MMS calculated?** A. Images are scaled up to approximately 4/3 when base64 encoded. Additionally, there is approximately 200 bytes of overhead on each MMS. Assuming the maximum MMS that can be sent on Telstra’s network is 2MB, then the maximum image size that can be sent will be approximately 1.378MB (1.378 x 1.34 + 200, without SOAP encapsulation). **Q: How is an MMS classified as Small or Large?** A. MMSes with size below 600kB are classed as Small whereas those that are bigger than 600kB are classed as Large. They will be charged accordingly. **Q: Are SMILs supported by the Messaging API?** A. While there will be no error if you send an MMS with a SMIL presentation, the actual layout or sequence defined in the SMIL may not display as expected because most of the new smartphone devices ignore the SMIL presentation layer. SMIL was used in feature phones which had limited capability and SMIL allowed a *powerpoint type* presentation to be provided. Smartphones now have the capability to display video which is the better option for presentations. It is recommended that MMS messages should just drop the SMIL. **Q: How do I assign a delivery notification or callback URL?** A. You can assign a delivery notification or callback URL by adding the `notifyURL` parameter in the body of the request when you send a message. Once the message has been delivered, a notification will then be posted to this callback URL. **Q: What is the difference between the `notifyURL` parameter in the Provisoning call versus the `notifyURL` parameter in the Send Message call?** A. The `notifyURL` in the Provisoning call will be the URL where replies to the provisioned number will be posted. On the other hand, the `notifyURL` in the Send Message call will be the URL where the delivery notification will be posted, e.g. when an SMS has already been delivered to the recipient. # Getting Started Below are the steps to get started with the Telstra Messaging API. 1. Generate an OAuth2 token using your `Client key` and `Client secret`. 2. Use the Provisioning call to create a subscription and receive a dedicated number. 3. Send a message to a specific mobile number. ## Run in Postman \"Run ## Sample Apps - [Perl Sample App](https://github.com/telstra/MessagingAPI-perl-sample-app) - [Happy Chat App](https://github.com/telstra/messaging-sample-code-happy-chat) - [PHP Sample App](https://github.com/developersteve/telstra-messaging-php) ## SDK Repos - [Messaging API - PHP SDK](https://github.com/telstra/MessagingAPI-SDK-php) - [Messaging API - Python SDK](https://github.com/telstra/MessagingAPI-SDK-python) - [Messaging API - Ruby SDK](https://github.com/telstra/MessagingAPI-SDK-ruby) - [Messaging API - NodeJS SDK](https://github.com/telstra/MessagingAPI-SDK-node) - [Messaging API - .Net2 SDK](https://github.com/telstra/MessagingAPI-SDK-dotnet) - [Messaging API - Java SDK](https://github.com/telstra/MessagingAPI-SDK-Java) ## Blog Posts For more information on the Messaging API, you can read these blog posts: - [Callbacks Part 1](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-1) - [Callbacks Part 2](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-2) +#The Telstra Messaging API specification -OpenAPI spec version: 2.2.9 +The version of the OpenAPI document: 2.2.9 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0 +OpenAPI Generator version: 4.2.3-SNAPSHOT =end @@ -34,5 +34,24 @@ def initialize(arg = nil) super arg end end + + # Override to_s to display a friendly error message + def to_s + message + end + + def message + if @message.nil? + msg = "Error message: the server returns an error" + else + msg = @message + end + + msg += "\nHTTP status code: #{code}" if code + msg += "\nResponse headers: #{response_headers}" if response_headers + msg += "\nResponse body: #{response_body}" if response_body + + msg + end end end diff --git a/lib/Telstra_Messaging/configuration.rb b/lib/Telstra_Messaging/configuration.rb index a46b561..19d7034 100644 --- a/lib/Telstra_Messaging/configuration.rb +++ b/lib/Telstra_Messaging/configuration.rb @@ -1,17 +1,15 @@ =begin #Telstra Messaging API -# # Introduction

Send and receive SMS and MMS messages globally using Telstra's enterprise grade Messaging API. It also allows your application to track the delivery status of both sent and received messages. Get your dedicated Australian number, and start sending and receiving messages today.

# Features The Telstra Messaging API provides the features below. | Feature | Description | | --- | --- | | `Dedicated Number` | Provision a mobile number for your account to be used as `from` address in the API | | `Send Messages` | Sending SMS or MMS messages | | `Receive Messages` | Telstra will deliver messages sent to a dedicated number or to the `notifyURL` defined by you | | `Broadcast Messages` | Invoke a single API call to send a message to a list of numbers provided in `to` | | `Delivery Status` | Query the delivery status of your messages | | `Callbacks` | Provide a notification URL and Telstra will notify your app when a message status changes | | `Alphanumeric Identifier` | Differentiate yourself by providing an alphanumeric string in `from`. This feature is only available on paid plans | | `Concatenation` | Send messages up to 1900 characters long and Telstra will automaticaly segment and reassemble them | | `Reply Request` | Create a chat session by associating `messageId` and `to` number to track responses received from a mobile number. We will store this association for 8 days | | `Character set` | Accepts all Unicode characters as part of UTF-8 | | `Bounce-back response` | See if your SMS hits an unreachable or unallocated number (Australia Only) | | `Queuing` | Messaging API will automatically queue and deliver each message at a compliant rate. | | `Emoji Encoding` | The API supports the encoding of the full range of emojis. Emojis in the reply messages will be in their UTF-8 format. | ## Delivery Notification or Callbacks The API provides several methods for notifying when a message has been delivered to the destination. 1. When you send a message there is an opportunity to specify a `notifyURL`. Once the message has been delivered the API will make a call to this URL to advise of the message status. 2. If you do not specify a URL you can always call the `GET /status` API to get the status of the message. # Getting Access to the API 1. Register at [https://dev.telstra.com](https://dev.telstra.com). 2. After registration, login to [https://dev.telstra.com](https://dev.telstra.com) and navigate to the **My apps** page. 3. Create your application by clicking the **Add new app** button 4. Select **API Free Trial** Product when configuring your application. This Product includes the Telstra Messaging API as well as other free trial APIs. Your application will be approved automatically. 5. There is a maximum of 1000 free messages per developer. Additional messages and features can be purchased from [https://dev.telstra.com](https://dev.telstra.com). 6. Note your `Client key` and `Client secret` as these will be needed to provision a number for your application and for authentication. Now head over to **Getting Started** where you can find a postman collection as well as some links to sample apps and SDKs to get you started. Happy Messaging! # Frequently Asked Questions **Q: Is creating a subscription via the Provisioning call a required step?** A. Yes. You will only be able to start sending messages if you have a provisioned dedicated number. Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: When trying to send an SMS I receive a `400 Bad Request` response. How can I fix this?** A. You need to make sure you have a provisioned dedicated number before you can send an SMS. If you do not have a provisioned dedicated number and you try to send a message via the API, you will get the error below in the response:
{   \"status\":\"400\",   \"code\":\"DELIVERY-IMPOSSIBLE\",   \"message\":\"Invalid \\'from\\' address specified\" }
Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: How long does my dedicated number stay active for?** A. When you provision a dedicated number, by default it will be active for 30 days. You can use the `activeDays` parameter during the provisioning call to increment or decrement the number of days your dedicated number will remain active. Note that Free Trial apps will have 30 days as the maximum `activeDays` they can add to their provisioned number. If the Provisioning call is made several times within that 30-Day period, it will return the `expiryDate` in the Unix format and will not add any activeDays until after that `expiryDate`. **Q: Can I send a broadcast message using the Telstra Messaging API?** A. Yes. Recipient numbers can be in the form of an array of strings if a broadcast message needs to be sent, allowing you to send to multiple mobile numbers in one API call. A sample request body for this will be: `{\"to\":[\"+61412345678\",\"+61487654321\"],\"body\":\"Test Message\"}` **Q: Can I send SMS and MMS to all countries?** A. You can send SMS and MMS to all countries EXCEPT to countries which are subject to global sanctions namely: Burma, Côte d'Ivoire, Cuba, Iran, North Korea, Syria. **Q: Can I use `Alphanumeric Identifier` from my paid plan via credit card?** A. `Alphanumeric Identifier` is only available on Telstra Account paid plans, not through credit card paid plans. **Q: What is the maximum sized MMS that I can send?** A. This will depend on the carrier that will receive the MMS. For Telstra it's up to 2MB, Optus up to 1.5MB and Vodafone only allows up to 500kB. You will need to check with international carriers for thier MMS size limits. **Q: How is the size of an MMS calculated?** A. Images are scaled up to approximately 4/3 when base64 encoded. Additionally, there is approximately 200 bytes of overhead on each MMS. Assuming the maximum MMS that can be sent on Telstra’s network is 2MB, then the maximum image size that can be sent will be approximately 1.378MB (1.378 x 1.34 + 200, without SOAP encapsulation). **Q: How is an MMS classified as Small or Large?** A. MMSes with size below 600kB are classed as Small whereas those that are bigger than 600kB are classed as Large. They will be charged accordingly. **Q: Are SMILs supported by the Messaging API?** A. While there will be no error if you send an MMS with a SMIL presentation, the actual layout or sequence defined in the SMIL may not display as expected because most of the new smartphone devices ignore the SMIL presentation layer. SMIL was used in feature phones which had limited capability and SMIL allowed a *powerpoint type* presentation to be provided. Smartphones now have the capability to display video which is the better option for presentations. It is recommended that MMS messages should just drop the SMIL. **Q: How do I assign a delivery notification or callback URL?** A. You can assign a delivery notification or callback URL by adding the `notifyURL` parameter in the body of the request when you send a message. Once the message has been delivered, a notification will then be posted to this callback URL. **Q: What is the difference between the `notifyURL` parameter in the Provisoning call versus the `notifyURL` parameter in the Send Message call?** A. The `notifyURL` in the Provisoning call will be the URL where replies to the provisioned number will be posted. On the other hand, the `notifyURL` in the Send Message call will be the URL where the delivery notification will be posted, e.g. when an SMS has already been delivered to the recipient. # Getting Started Below are the steps to get started with the Telstra Messaging API. 1. Generate an OAuth2 token using your `Client key` and `Client secret`. 2. Use the Provisioning call to create a subscription and receive a dedicated number. 3. Send a message to a specific mobile number. ## Run in Postman \"Run ## Sample Apps - [Perl Sample App](https://github.com/telstra/MessagingAPI-perl-sample-app) - [Happy Chat App](https://github.com/telstra/messaging-sample-code-happy-chat) - [PHP Sample App](https://github.com/developersteve/telstra-messaging-php) ## SDK Repos - [Messaging API - PHP SDK](https://github.com/telstra/MessagingAPI-SDK-php) - [Messaging API - Python SDK](https://github.com/telstra/MessagingAPI-SDK-python) - [Messaging API - Ruby SDK](https://github.com/telstra/MessagingAPI-SDK-ruby) - [Messaging API - NodeJS SDK](https://github.com/telstra/MessagingAPI-SDK-node) - [Messaging API - .Net2 SDK](https://github.com/telstra/MessagingAPI-SDK-dotnet) - [Messaging API - Java SDK](https://github.com/telstra/MessagingAPI-SDK-Java) ## Blog Posts For more information on the Messaging API, you can read these blog posts: - [Callbacks Part 1](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-1) - [Callbacks Part 2](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-2) +#The Telstra Messaging API specification -OpenAPI spec version: 2.2.9 +The version of the OpenAPI document: 2.2.9 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0 +OpenAPI Generator version: 4.2.3-SNAPSHOT =end -require 'uri' - module Telstra_Messaging class Configuration # Defines url scheme @@ -174,8 +172,7 @@ def base_path=(base_path) end def base_url - url = "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') - URI.encode(url) + "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') end # Gets API key (with prefix if set). @@ -205,5 +202,47 @@ def auth_settings }, } end + + # Returns an array of Server setting + def server_settings + [ + { + url: "https://tapi.telstra.com/v2", + description: "No description provided", + } + ] + end + + # Returns URL based on server settings + # + # @param index array index of the server settings + # @param variables hash of variable and the corresponding value + def server_url(index, variables = {}) + servers = server_settings + + # check array index out of bound + if (index < 0 || index >= servers.size) + fail ArgumentError, "Invalid index #{index} when selecting the server. Must be less than #{servers.size}" + end + + server = servers[index] + url = server[:url] + + # go through variable and assign a value + server[:variables].each do |name, variable| + if variables.key?(name) + if (server[:variables][name][:enum_values].include? variables[name]) + url.gsub! "{" + name.to_s + "}", variables[name] + else + fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}." + end + else + # use default value + url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value] + end + end + + url + end end end diff --git a/lib/Telstra_Messaging/models/delete_number_request.rb b/lib/Telstra_Messaging/models/delete_number_request.rb index f02d1dd..0a1ff4a 100644 --- a/lib/Telstra_Messaging/models/delete_number_request.rb +++ b/lib/Telstra_Messaging/models/delete_number_request.rb @@ -1,12 +1,12 @@ =begin #Telstra Messaging API -# # Introduction

Send and receive SMS and MMS messages globally using Telstra's enterprise grade Messaging API. It also allows your application to track the delivery status of both sent and received messages. Get your dedicated Australian number, and start sending and receiving messages today.

# Features The Telstra Messaging API provides the features below. | Feature | Description | | --- | --- | | `Dedicated Number` | Provision a mobile number for your account to be used as `from` address in the API | | `Send Messages` | Sending SMS or MMS messages | | `Receive Messages` | Telstra will deliver messages sent to a dedicated number or to the `notifyURL` defined by you | | `Broadcast Messages` | Invoke a single API call to send a message to a list of numbers provided in `to` | | `Delivery Status` | Query the delivery status of your messages | | `Callbacks` | Provide a notification URL and Telstra will notify your app when a message status changes | | `Alphanumeric Identifier` | Differentiate yourself by providing an alphanumeric string in `from`. This feature is only available on paid plans | | `Concatenation` | Send messages up to 1900 characters long and Telstra will automaticaly segment and reassemble them | | `Reply Request` | Create a chat session by associating `messageId` and `to` number to track responses received from a mobile number. We will store this association for 8 days | | `Character set` | Accepts all Unicode characters as part of UTF-8 | | `Bounce-back response` | See if your SMS hits an unreachable or unallocated number (Australia Only) | | `Queuing` | Messaging API will automatically queue and deliver each message at a compliant rate. | | `Emoji Encoding` | The API supports the encoding of the full range of emojis. Emojis in the reply messages will be in their UTF-8 format. | ## Delivery Notification or Callbacks The API provides several methods for notifying when a message has been delivered to the destination. 1. When you send a message there is an opportunity to specify a `notifyURL`. Once the message has been delivered the API will make a call to this URL to advise of the message status. 2. If you do not specify a URL you can always call the `GET /status` API to get the status of the message. # Getting Access to the API 1. Register at [https://dev.telstra.com](https://dev.telstra.com). 2. After registration, login to [https://dev.telstra.com](https://dev.telstra.com) and navigate to the **My apps** page. 3. Create your application by clicking the **Add new app** button 4. Select **API Free Trial** Product when configuring your application. This Product includes the Telstra Messaging API as well as other free trial APIs. Your application will be approved automatically. 5. There is a maximum of 1000 free messages per developer. Additional messages and features can be purchased from [https://dev.telstra.com](https://dev.telstra.com). 6. Note your `Client key` and `Client secret` as these will be needed to provision a number for your application and for authentication. Now head over to **Getting Started** where you can find a postman collection as well as some links to sample apps and SDKs to get you started. Happy Messaging! # Frequently Asked Questions **Q: Is creating a subscription via the Provisioning call a required step?** A. Yes. You will only be able to start sending messages if you have a provisioned dedicated number. Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: When trying to send an SMS I receive a `400 Bad Request` response. How can I fix this?** A. You need to make sure you have a provisioned dedicated number before you can send an SMS. If you do not have a provisioned dedicated number and you try to send a message via the API, you will get the error below in the response:
{   \"status\":\"400\",   \"code\":\"DELIVERY-IMPOSSIBLE\",   \"message\":\"Invalid \\'from\\' address specified\" }
Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: How long does my dedicated number stay active for?** A. When you provision a dedicated number, by default it will be active for 30 days. You can use the `activeDays` parameter during the provisioning call to increment or decrement the number of days your dedicated number will remain active. Note that Free Trial apps will have 30 days as the maximum `activeDays` they can add to their provisioned number. If the Provisioning call is made several times within that 30-Day period, it will return the `expiryDate` in the Unix format and will not add any activeDays until after that `expiryDate`. **Q: Can I send a broadcast message using the Telstra Messaging API?** A. Yes. Recipient numbers can be in the form of an array of strings if a broadcast message needs to be sent, allowing you to send to multiple mobile numbers in one API call. A sample request body for this will be: `{\"to\":[\"+61412345678\",\"+61487654321\"],\"body\":\"Test Message\"}` **Q: Can I send SMS and MMS to all countries?** A. You can send SMS and MMS to all countries EXCEPT to countries which are subject to global sanctions namely: Burma, Côte d'Ivoire, Cuba, Iran, North Korea, Syria. **Q: Can I use `Alphanumeric Identifier` from my paid plan via credit card?** A. `Alphanumeric Identifier` is only available on Telstra Account paid plans, not through credit card paid plans. **Q: What is the maximum sized MMS that I can send?** A. This will depend on the carrier that will receive the MMS. For Telstra it's up to 2MB, Optus up to 1.5MB and Vodafone only allows up to 500kB. You will need to check with international carriers for thier MMS size limits. **Q: How is the size of an MMS calculated?** A. Images are scaled up to approximately 4/3 when base64 encoded. Additionally, there is approximately 200 bytes of overhead on each MMS. Assuming the maximum MMS that can be sent on Telstra’s network is 2MB, then the maximum image size that can be sent will be approximately 1.378MB (1.378 x 1.34 + 200, without SOAP encapsulation). **Q: How is an MMS classified as Small or Large?** A. MMSes with size below 600kB are classed as Small whereas those that are bigger than 600kB are classed as Large. They will be charged accordingly. **Q: Are SMILs supported by the Messaging API?** A. While there will be no error if you send an MMS with a SMIL presentation, the actual layout or sequence defined in the SMIL may not display as expected because most of the new smartphone devices ignore the SMIL presentation layer. SMIL was used in feature phones which had limited capability and SMIL allowed a *powerpoint type* presentation to be provided. Smartphones now have the capability to display video which is the better option for presentations. It is recommended that MMS messages should just drop the SMIL. **Q: How do I assign a delivery notification or callback URL?** A. You can assign a delivery notification or callback URL by adding the `notifyURL` parameter in the body of the request when you send a message. Once the message has been delivered, a notification will then be posted to this callback URL. **Q: What is the difference between the `notifyURL` parameter in the Provisoning call versus the `notifyURL` parameter in the Send Message call?** A. The `notifyURL` in the Provisoning call will be the URL where replies to the provisioned number will be posted. On the other hand, the `notifyURL` in the Send Message call will be the URL where the delivery notification will be posted, e.g. when an SMS has already been delivered to the recipient. # Getting Started Below are the steps to get started with the Telstra Messaging API. 1. Generate an OAuth2 token using your `Client key` and `Client secret`. 2. Use the Provisioning call to create a subscription and receive a dedicated number. 3. Send a message to a specific mobile number. ## Run in Postman \"Run ## Sample Apps - [Perl Sample App](https://github.com/telstra/MessagingAPI-perl-sample-app) - [Happy Chat App](https://github.com/telstra/messaging-sample-code-happy-chat) - [PHP Sample App](https://github.com/developersteve/telstra-messaging-php) ## SDK Repos - [Messaging API - PHP SDK](https://github.com/telstra/MessagingAPI-SDK-php) - [Messaging API - Python SDK](https://github.com/telstra/MessagingAPI-SDK-python) - [Messaging API - Ruby SDK](https://github.com/telstra/MessagingAPI-SDK-ruby) - [Messaging API - NodeJS SDK](https://github.com/telstra/MessagingAPI-SDK-node) - [Messaging API - .Net2 SDK](https://github.com/telstra/MessagingAPI-SDK-dotnet) - [Messaging API - Java SDK](https://github.com/telstra/MessagingAPI-SDK-Java) ## Blog Posts For more information on the Messaging API, you can read these blog posts: - [Callbacks Part 1](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-1) - [Callbacks Part 2](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-2) +#The Telstra Messaging API specification -OpenAPI spec version: 2.2.9 +The version of the OpenAPI document: 2.2.9 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0 +OpenAPI Generator version: 4.2.3-SNAPSHOT =end @@ -31,16 +31,29 @@ def self.openapi_types } end + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - return unless attributes.is_a?(Hash) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Telstra_Messaging::DeleteNumberRequest` initialize method" + end - # convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Telstra_Messaging::DeleteNumberRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } - if attributes.has_key?(:'emptyArr') - self.empty_arr = attributes[:'emptyArr'] + if attributes.key?(:'empty_arr') + self.empty_arr = attributes[:'empty_arr'] else self.empty_arr = 0 end @@ -74,11 +87,18 @@ def eql?(o) end # Calculates hash code according to all attributes. - # @return [Fixnum] Hash code + # @return [Integer] Hash code def hash [empty_arr].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -86,7 +106,7 @@ def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.openapi_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the the attribute + # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) @@ -115,7 +135,7 @@ def _deserialize(type, value) value.to_i when :Float value.to_f - when :BOOLEAN + when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else @@ -136,8 +156,7 @@ def _deserialize(type, value) end end else # model - temp_model = Telstra_Messaging.const_get(type).new - temp_model.build_from_hash(value) + Telstra_Messaging.const_get(type).build_from_hash(value) end end @@ -159,7 +178,11 @@ def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) - next if value.nil? + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + hash[param] = _to_hash(value) end hash diff --git a/lib/Telstra_Messaging/models/get_mms_response.rb b/lib/Telstra_Messaging/models/get_mms_response.rb new file mode 100644 index 0000000..094eb8d --- /dev/null +++ b/lib/Telstra_Messaging/models/get_mms_response.rb @@ -0,0 +1,304 @@ +=begin +#Telstra Messaging API + +#The Telstra Messaging API specification + +The version of the OpenAPI document: 2.2.9 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 4.2.3-SNAPSHOT + +=end + +require 'date' + +module Telstra_Messaging + class GetMmsResponse + # The final state of the message. + attr_accessor :status + + # The number the message was sent to. + attr_accessor :destination_address + + # The number the message was sent from. + attr_accessor :sender_address + + # The subject assigned to the message. + attr_accessor :subject + + # Message Id assigned by the MMSC. + attr_accessor :message_id + + # Message Id assigned by the API. + attr_accessor :api_msg_id + + # Time handling of the message ended. + attr_accessor :sent_timestamp + + # An array of content that was received in an MMS message. + attr_accessor :mms_content + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'status' => :'status', + :'destination_address' => :'destinationAddress', + :'sender_address' => :'senderAddress', + :'subject' => :'subject', + :'message_id' => :'messageId', + :'api_msg_id' => :'apiMsgId', + :'sent_timestamp' => :'sentTimestamp', + :'mms_content' => :'MMSContent' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'status' => :'String', + :'destination_address' => :'String', + :'sender_address' => :'String', + :'subject' => :'String', + :'message_id' => :'String', + :'api_msg_id' => :'String', + :'sent_timestamp' => :'String', + :'mms_content' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Telstra_Messaging::GetMmsResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Telstra_Messaging::GetMmsResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'destination_address') + self.destination_address = attributes[:'destination_address'] + end + + if attributes.key?(:'sender_address') + self.sender_address = attributes[:'sender_address'] + end + + if attributes.key?(:'subject') + self.subject = attributes[:'subject'] + end + + if attributes.key?(:'message_id') + self.message_id = attributes[:'message_id'] + end + + if attributes.key?(:'api_msg_id') + self.api_msg_id = attributes[:'api_msg_id'] + end + + if attributes.key?(:'sent_timestamp') + self.sent_timestamp = attributes[:'sent_timestamp'] + end + + if attributes.key?(:'mms_content') + if (value = attributes[:'mms_content']).is_a?(Array) + self.mms_content = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @status.nil? + invalid_properties.push('invalid value for "status", status cannot be nil.') + end + + if @destination_address.nil? + invalid_properties.push('invalid value for "destination_address", destination_address cannot be nil.') + end + + if @sender_address.nil? + invalid_properties.push('invalid value for "sender_address", sender_address cannot be nil.') + end + + if @sent_timestamp.nil? + invalid_properties.push('invalid value for "sent_timestamp", sent_timestamp cannot be nil.') + end + + if @mms_content.nil? + invalid_properties.push('invalid value for "mms_content", mms_content cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @status.nil? + return false if @destination_address.nil? + return false if @sender_address.nil? + return false if @sent_timestamp.nil? + return false if @mms_content.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + status == o.status && + destination_address == o.destination_address && + sender_address == o.sender_address && + subject == o.subject && + message_id == o.message_id && + api_msg_id == o.api_msg_id && + sent_timestamp == o.sent_timestamp && + mms_content == o.mms_content + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [status, destination_address, sender_address, subject, message_id, api_msg_id, sent_timestamp, mms_content].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + Telstra_Messaging.const_get(type).build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/lib/Telstra_Messaging/models/get_subscription_response.rb b/lib/Telstra_Messaging/models/get_subscription_response.rb index 6858c49..5aef86a 100644 --- a/lib/Telstra_Messaging/models/get_subscription_response.rb +++ b/lib/Telstra_Messaging/models/get_subscription_response.rb @@ -1,12 +1,12 @@ =begin #Telstra Messaging API -# # Introduction

Send and receive SMS and MMS messages globally using Telstra's enterprise grade Messaging API. It also allows your application to track the delivery status of both sent and received messages. Get your dedicated Australian number, and start sending and receiving messages today.

# Features The Telstra Messaging API provides the features below. | Feature | Description | | --- | --- | | `Dedicated Number` | Provision a mobile number for your account to be used as `from` address in the API | | `Send Messages` | Sending SMS or MMS messages | | `Receive Messages` | Telstra will deliver messages sent to a dedicated number or to the `notifyURL` defined by you | | `Broadcast Messages` | Invoke a single API call to send a message to a list of numbers provided in `to` | | `Delivery Status` | Query the delivery status of your messages | | `Callbacks` | Provide a notification URL and Telstra will notify your app when a message status changes | | `Alphanumeric Identifier` | Differentiate yourself by providing an alphanumeric string in `from`. This feature is only available on paid plans | | `Concatenation` | Send messages up to 1900 characters long and Telstra will automaticaly segment and reassemble them | | `Reply Request` | Create a chat session by associating `messageId` and `to` number to track responses received from a mobile number. We will store this association for 8 days | | `Character set` | Accepts all Unicode characters as part of UTF-8 | | `Bounce-back response` | See if your SMS hits an unreachable or unallocated number (Australia Only) | | `Queuing` | Messaging API will automatically queue and deliver each message at a compliant rate. | | `Emoji Encoding` | The API supports the encoding of the full range of emojis. Emojis in the reply messages will be in their UTF-8 format. | ## Delivery Notification or Callbacks The API provides several methods for notifying when a message has been delivered to the destination. 1. When you send a message there is an opportunity to specify a `notifyURL`. Once the message has been delivered the API will make a call to this URL to advise of the message status. 2. If you do not specify a URL you can always call the `GET /status` API to get the status of the message. # Getting Access to the API 1. Register at [https://dev.telstra.com](https://dev.telstra.com). 2. After registration, login to [https://dev.telstra.com](https://dev.telstra.com) and navigate to the **My apps** page. 3. Create your application by clicking the **Add new app** button 4. Select **API Free Trial** Product when configuring your application. This Product includes the Telstra Messaging API as well as other free trial APIs. Your application will be approved automatically. 5. There is a maximum of 1000 free messages per developer. Additional messages and features can be purchased from [https://dev.telstra.com](https://dev.telstra.com). 6. Note your `Client key` and `Client secret` as these will be needed to provision a number for your application and for authentication. Now head over to **Getting Started** where you can find a postman collection as well as some links to sample apps and SDKs to get you started. Happy Messaging! # Frequently Asked Questions **Q: Is creating a subscription via the Provisioning call a required step?** A. Yes. You will only be able to start sending messages if you have a provisioned dedicated number. Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: When trying to send an SMS I receive a `400 Bad Request` response. How can I fix this?** A. You need to make sure you have a provisioned dedicated number before you can send an SMS. If you do not have a provisioned dedicated number and you try to send a message via the API, you will get the error below in the response:
{   \"status\":\"400\",   \"code\":\"DELIVERY-IMPOSSIBLE\",   \"message\":\"Invalid \\'from\\' address specified\" }
Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: How long does my dedicated number stay active for?** A. When you provision a dedicated number, by default it will be active for 30 days. You can use the `activeDays` parameter during the provisioning call to increment or decrement the number of days your dedicated number will remain active. Note that Free Trial apps will have 30 days as the maximum `activeDays` they can add to their provisioned number. If the Provisioning call is made several times within that 30-Day period, it will return the `expiryDate` in the Unix format and will not add any activeDays until after that `expiryDate`. **Q: Can I send a broadcast message using the Telstra Messaging API?** A. Yes. Recipient numbers can be in the form of an array of strings if a broadcast message needs to be sent, allowing you to send to multiple mobile numbers in one API call. A sample request body for this will be: `{\"to\":[\"+61412345678\",\"+61487654321\"],\"body\":\"Test Message\"}` **Q: Can I send SMS and MMS to all countries?** A. You can send SMS and MMS to all countries EXCEPT to countries which are subject to global sanctions namely: Burma, Côte d'Ivoire, Cuba, Iran, North Korea, Syria. **Q: Can I use `Alphanumeric Identifier` from my paid plan via credit card?** A. `Alphanumeric Identifier` is only available on Telstra Account paid plans, not through credit card paid plans. **Q: What is the maximum sized MMS that I can send?** A. This will depend on the carrier that will receive the MMS. For Telstra it's up to 2MB, Optus up to 1.5MB and Vodafone only allows up to 500kB. You will need to check with international carriers for thier MMS size limits. **Q: How is the size of an MMS calculated?** A. Images are scaled up to approximately 4/3 when base64 encoded. Additionally, there is approximately 200 bytes of overhead on each MMS. Assuming the maximum MMS that can be sent on Telstra’s network is 2MB, then the maximum image size that can be sent will be approximately 1.378MB (1.378 x 1.34 + 200, without SOAP encapsulation). **Q: How is an MMS classified as Small or Large?** A. MMSes with size below 600kB are classed as Small whereas those that are bigger than 600kB are classed as Large. They will be charged accordingly. **Q: Are SMILs supported by the Messaging API?** A. While there will be no error if you send an MMS with a SMIL presentation, the actual layout or sequence defined in the SMIL may not display as expected because most of the new smartphone devices ignore the SMIL presentation layer. SMIL was used in feature phones which had limited capability and SMIL allowed a *powerpoint type* presentation to be provided. Smartphones now have the capability to display video which is the better option for presentations. It is recommended that MMS messages should just drop the SMIL. **Q: How do I assign a delivery notification or callback URL?** A. You can assign a delivery notification or callback URL by adding the `notifyURL` parameter in the body of the request when you send a message. Once the message has been delivered, a notification will then be posted to this callback URL. **Q: What is the difference between the `notifyURL` parameter in the Provisoning call versus the `notifyURL` parameter in the Send Message call?** A. The `notifyURL` in the Provisoning call will be the URL where replies to the provisioned number will be posted. On the other hand, the `notifyURL` in the Send Message call will be the URL where the delivery notification will be posted, e.g. when an SMS has already been delivered to the recipient. # Getting Started Below are the steps to get started with the Telstra Messaging API. 1. Generate an OAuth2 token using your `Client key` and `Client secret`. 2. Use the Provisioning call to create a subscription and receive a dedicated number. 3. Send a message to a specific mobile number. ## Run in Postman \"Run ## Sample Apps - [Perl Sample App](https://github.com/telstra/MessagingAPI-perl-sample-app) - [Happy Chat App](https://github.com/telstra/messaging-sample-code-happy-chat) - [PHP Sample App](https://github.com/developersteve/telstra-messaging-php) ## SDK Repos - [Messaging API - PHP SDK](https://github.com/telstra/MessagingAPI-SDK-php) - [Messaging API - Python SDK](https://github.com/telstra/MessagingAPI-SDK-python) - [Messaging API - Ruby SDK](https://github.com/telstra/MessagingAPI-SDK-ruby) - [Messaging API - NodeJS SDK](https://github.com/telstra/MessagingAPI-SDK-node) - [Messaging API - .Net2 SDK](https://github.com/telstra/MessagingAPI-SDK-dotnet) - [Messaging API - Java SDK](https://github.com/telstra/MessagingAPI-SDK-Java) ## Blog Posts For more information on the Messaging API, you can read these blog posts: - [Callbacks Part 1](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-1) - [Callbacks Part 2](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-2) +#The Telstra Messaging API specification -OpenAPI spec version: 2.2.9 +The version of the OpenAPI document: 2.2.9 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0 +OpenAPI Generator version: 4.2.3-SNAPSHOT =end @@ -41,24 +41,37 @@ def self.openapi_types } end + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - return unless attributes.is_a?(Hash) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Telstra_Messaging::GetSubscriptionResponse` initialize method" + end - # convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Telstra_Messaging::GetSubscriptionResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } - if attributes.has_key?(:'activeDays') - self.active_days = attributes[:'activeDays'] + if attributes.key?(:'active_days') + self.active_days = attributes[:'active_days'] end - if attributes.has_key?(:'notifyURL') - self.notify_url = attributes[:'notifyURL'] + if attributes.key?(:'notify_url') + self.notify_url = attributes[:'notify_url'] end - if attributes.has_key?(:'destinationAddress') - self.destination_address = attributes[:'destinationAddress'] + if attributes.key?(:'destination_address') + self.destination_address = attributes[:'destination_address'] end end @@ -92,11 +105,18 @@ def eql?(o) end # Calculates hash code according to all attributes. - # @return [Fixnum] Hash code + # @return [Integer] Hash code def hash [active_days, notify_url, destination_address].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -104,7 +124,7 @@ def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.openapi_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the the attribute + # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) @@ -133,7 +153,7 @@ def _deserialize(type, value) value.to_i when :Float value.to_f - when :BOOLEAN + when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else @@ -154,8 +174,7 @@ def _deserialize(type, value) end end else # model - temp_model = Telstra_Messaging.const_get(type).new - temp_model.build_from_hash(value) + Telstra_Messaging.const_get(type).build_from_hash(value) end end @@ -177,7 +196,11 @@ def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) - next if value.nil? + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + hash[param] = _to_hash(value) end hash diff --git a/lib/Telstra_Messaging/models/health_check_response.rb b/lib/Telstra_Messaging/models/health_check_response.rb new file mode 100644 index 0000000..0c6c63b --- /dev/null +++ b/lib/Telstra_Messaging/models/health_check_response.rb @@ -0,0 +1,208 @@ +=begin +#Telstra Messaging API + +#The Telstra Messaging API specification + +The version of the OpenAPI document: 2.2.9 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 4.2.3-SNAPSHOT + +=end + +require 'date' + +module Telstra_Messaging + # Information regarding service being up or down. + class HealthCheckResponse + # message status + attr_accessor :status + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'status' => :'status' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'status' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Telstra_Messaging::HealthCheckResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Telstra_Messaging::HealthCheckResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + status == o.status + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [status].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + Telstra_Messaging.const_get(type).build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/lib/Telstra_Messaging/models/inbound_poll_response.rb b/lib/Telstra_Messaging/models/inbound_poll_response.rb index 3121102..93054d5 100644 --- a/lib/Telstra_Messaging/models/inbound_poll_response.rb +++ b/lib/Telstra_Messaging/models/inbound_poll_response.rb @@ -1,12 +1,12 @@ =begin #Telstra Messaging API -# # Introduction

Send and receive SMS and MMS messages globally using Telstra's enterprise grade Messaging API. It also allows your application to track the delivery status of both sent and received messages. Get your dedicated Australian number, and start sending and receiving messages today.

# Features The Telstra Messaging API provides the features below. | Feature | Description | | --- | --- | | `Dedicated Number` | Provision a mobile number for your account to be used as `from` address in the API | | `Send Messages` | Sending SMS or MMS messages | | `Receive Messages` | Telstra will deliver messages sent to a dedicated number or to the `notifyURL` defined by you | | `Broadcast Messages` | Invoke a single API call to send a message to a list of numbers provided in `to` | | `Delivery Status` | Query the delivery status of your messages | | `Callbacks` | Provide a notification URL and Telstra will notify your app when a message status changes | | `Alphanumeric Identifier` | Differentiate yourself by providing an alphanumeric string in `from`. This feature is only available on paid plans | | `Concatenation` | Send messages up to 1900 characters long and Telstra will automaticaly segment and reassemble them | | `Reply Request` | Create a chat session by associating `messageId` and `to` number to track responses received from a mobile number. We will store this association for 8 days | | `Character set` | Accepts all Unicode characters as part of UTF-8 | | `Bounce-back response` | See if your SMS hits an unreachable or unallocated number (Australia Only) | | `Queuing` | Messaging API will automatically queue and deliver each message at a compliant rate. | | `Emoji Encoding` | The API supports the encoding of the full range of emojis. Emojis in the reply messages will be in their UTF-8 format. | ## Delivery Notification or Callbacks The API provides several methods for notifying when a message has been delivered to the destination. 1. When you send a message there is an opportunity to specify a `notifyURL`. Once the message has been delivered the API will make a call to this URL to advise of the message status. 2. If you do not specify a URL you can always call the `GET /status` API to get the status of the message. # Getting Access to the API 1. Register at [https://dev.telstra.com](https://dev.telstra.com). 2. After registration, login to [https://dev.telstra.com](https://dev.telstra.com) and navigate to the **My apps** page. 3. Create your application by clicking the **Add new app** button 4. Select **API Free Trial** Product when configuring your application. This Product includes the Telstra Messaging API as well as other free trial APIs. Your application will be approved automatically. 5. There is a maximum of 1000 free messages per developer. Additional messages and features can be purchased from [https://dev.telstra.com](https://dev.telstra.com). 6. Note your `Client key` and `Client secret` as these will be needed to provision a number for your application and for authentication. Now head over to **Getting Started** where you can find a postman collection as well as some links to sample apps and SDKs to get you started. Happy Messaging! # Frequently Asked Questions **Q: Is creating a subscription via the Provisioning call a required step?** A. Yes. You will only be able to start sending messages if you have a provisioned dedicated number. Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: When trying to send an SMS I receive a `400 Bad Request` response. How can I fix this?** A. You need to make sure you have a provisioned dedicated number before you can send an SMS. If you do not have a provisioned dedicated number and you try to send a message via the API, you will get the error below in the response:
{   \"status\":\"400\",   \"code\":\"DELIVERY-IMPOSSIBLE\",   \"message\":\"Invalid \\'from\\' address specified\" }
Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: How long does my dedicated number stay active for?** A. When you provision a dedicated number, by default it will be active for 30 days. You can use the `activeDays` parameter during the provisioning call to increment or decrement the number of days your dedicated number will remain active. Note that Free Trial apps will have 30 days as the maximum `activeDays` they can add to their provisioned number. If the Provisioning call is made several times within that 30-Day period, it will return the `expiryDate` in the Unix format and will not add any activeDays until after that `expiryDate`. **Q: Can I send a broadcast message using the Telstra Messaging API?** A. Yes. Recipient numbers can be in the form of an array of strings if a broadcast message needs to be sent, allowing you to send to multiple mobile numbers in one API call. A sample request body for this will be: `{\"to\":[\"+61412345678\",\"+61487654321\"],\"body\":\"Test Message\"}` **Q: Can I send SMS and MMS to all countries?** A. You can send SMS and MMS to all countries EXCEPT to countries which are subject to global sanctions namely: Burma, Côte d'Ivoire, Cuba, Iran, North Korea, Syria. **Q: Can I use `Alphanumeric Identifier` from my paid plan via credit card?** A. `Alphanumeric Identifier` is only available on Telstra Account paid plans, not through credit card paid plans. **Q: What is the maximum sized MMS that I can send?** A. This will depend on the carrier that will receive the MMS. For Telstra it's up to 2MB, Optus up to 1.5MB and Vodafone only allows up to 500kB. You will need to check with international carriers for thier MMS size limits. **Q: How is the size of an MMS calculated?** A. Images are scaled up to approximately 4/3 when base64 encoded. Additionally, there is approximately 200 bytes of overhead on each MMS. Assuming the maximum MMS that can be sent on Telstra’s network is 2MB, then the maximum image size that can be sent will be approximately 1.378MB (1.378 x 1.34 + 200, without SOAP encapsulation). **Q: How is an MMS classified as Small or Large?** A. MMSes with size below 600kB are classed as Small whereas those that are bigger than 600kB are classed as Large. They will be charged accordingly. **Q: Are SMILs supported by the Messaging API?** A. While there will be no error if you send an MMS with a SMIL presentation, the actual layout or sequence defined in the SMIL may not display as expected because most of the new smartphone devices ignore the SMIL presentation layer. SMIL was used in feature phones which had limited capability and SMIL allowed a *powerpoint type* presentation to be provided. Smartphones now have the capability to display video which is the better option for presentations. It is recommended that MMS messages should just drop the SMIL. **Q: How do I assign a delivery notification or callback URL?** A. You can assign a delivery notification or callback URL by adding the `notifyURL` parameter in the body of the request when you send a message. Once the message has been delivered, a notification will then be posted to this callback URL. **Q: What is the difference between the `notifyURL` parameter in the Provisoning call versus the `notifyURL` parameter in the Send Message call?** A. The `notifyURL` in the Provisoning call will be the URL where replies to the provisioned number will be posted. On the other hand, the `notifyURL` in the Send Message call will be the URL where the delivery notification will be posted, e.g. when an SMS has already been delivered to the recipient. # Getting Started Below are the steps to get started with the Telstra Messaging API. 1. Generate an OAuth2 token using your `Client key` and `Client secret`. 2. Use the Provisioning call to create a subscription and receive a dedicated number. 3. Send a message to a specific mobile number. ## Run in Postman \"Run ## Sample Apps - [Perl Sample App](https://github.com/telstra/MessagingAPI-perl-sample-app) - [Happy Chat App](https://github.com/telstra/messaging-sample-code-happy-chat) - [PHP Sample App](https://github.com/developersteve/telstra-messaging-php) ## SDK Repos - [Messaging API - PHP SDK](https://github.com/telstra/MessagingAPI-SDK-php) - [Messaging API - Python SDK](https://github.com/telstra/MessagingAPI-SDK-python) - [Messaging API - Ruby SDK](https://github.com/telstra/MessagingAPI-SDK-ruby) - [Messaging API - NodeJS SDK](https://github.com/telstra/MessagingAPI-SDK-node) - [Messaging API - .Net2 SDK](https://github.com/telstra/MessagingAPI-SDK-dotnet) - [Messaging API - Java SDK](https://github.com/telstra/MessagingAPI-SDK-Java) ## Blog Posts For more information on the Messaging API, you can read these blog posts: - [Callbacks Part 1](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-1) - [Callbacks Part 2](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-2) +#The Telstra Messaging API specification -OpenAPI spec version: 2.2.9 +The version of the OpenAPI document: 2.2.9 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0 +OpenAPI Generator version: 4.2.3-SNAPSHOT =end @@ -57,36 +57,49 @@ def self.openapi_types } end + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - return unless attributes.is_a?(Hash) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Telstra_Messaging::InboundPollResponse` initialize method" + end - # convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Telstra_Messaging::InboundPollResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } - if attributes.has_key?(:'status') + if attributes.key?(:'status') self.status = attributes[:'status'] end - if attributes.has_key?(:'destinationAddress') - self.destination_address = attributes[:'destinationAddress'] + if attributes.key?(:'destination_address') + self.destination_address = attributes[:'destination_address'] end - if attributes.has_key?(:'senderAddress') - self.sender_address = attributes[:'senderAddress'] + if attributes.key?(:'sender_address') + self.sender_address = attributes[:'sender_address'] end - if attributes.has_key?(:'message') + if attributes.key?(:'message') self.message = attributes[:'message'] end - if attributes.has_key?(:'messageId') - self.message_id = attributes[:'messageId'] + if attributes.key?(:'message_id') + self.message_id = attributes[:'message_id'] end - if attributes.has_key?(:'sentTimestamp') - self.sent_timestamp = attributes[:'sentTimestamp'] + if attributes.key?(:'sent_timestamp') + self.sent_timestamp = attributes[:'sent_timestamp'] end end @@ -123,11 +136,18 @@ def eql?(o) end # Calculates hash code according to all attributes. - # @return [Fixnum] Hash code + # @return [Integer] Hash code def hash [status, destination_address, sender_address, message, message_id, sent_timestamp].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -135,7 +155,7 @@ def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.openapi_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the the attribute + # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) @@ -164,7 +184,7 @@ def _deserialize(type, value) value.to_i when :Float value.to_f - when :BOOLEAN + when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else @@ -185,8 +205,7 @@ def _deserialize(type, value) end end else # model - temp_model = Telstra_Messaging.const_get(type).new - temp_model.build_from_hash(value) + Telstra_Messaging.const_get(type).build_from_hash(value) end end @@ -208,7 +227,11 @@ def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) - next if value.nil? + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + hash[param] = _to_hash(value) end hash diff --git a/lib/Telstra_Messaging/models/message.rb b/lib/Telstra_Messaging/models/message.rb index 76aad6d..f019e4c 100644 --- a/lib/Telstra_Messaging/models/message.rb +++ b/lib/Telstra_Messaging/models/message.rb @@ -1,12 +1,12 @@ =begin #Telstra Messaging API -# # Introduction

Send and receive SMS and MMS messages globally using Telstra's enterprise grade Messaging API. It also allows your application to track the delivery status of both sent and received messages. Get your dedicated Australian number, and start sending and receiving messages today.

# Features The Telstra Messaging API provides the features below. | Feature | Description | | --- | --- | | `Dedicated Number` | Provision a mobile number for your account to be used as `from` address in the API | | `Send Messages` | Sending SMS or MMS messages | | `Receive Messages` | Telstra will deliver messages sent to a dedicated number or to the `notifyURL` defined by you | | `Broadcast Messages` | Invoke a single API call to send a message to a list of numbers provided in `to` | | `Delivery Status` | Query the delivery status of your messages | | `Callbacks` | Provide a notification URL and Telstra will notify your app when a message status changes | | `Alphanumeric Identifier` | Differentiate yourself by providing an alphanumeric string in `from`. This feature is only available on paid plans | | `Concatenation` | Send messages up to 1900 characters long and Telstra will automaticaly segment and reassemble them | | `Reply Request` | Create a chat session by associating `messageId` and `to` number to track responses received from a mobile number. We will store this association for 8 days | | `Character set` | Accepts all Unicode characters as part of UTF-8 | | `Bounce-back response` | See if your SMS hits an unreachable or unallocated number (Australia Only) | | `Queuing` | Messaging API will automatically queue and deliver each message at a compliant rate. | | `Emoji Encoding` | The API supports the encoding of the full range of emojis. Emojis in the reply messages will be in their UTF-8 format. | ## Delivery Notification or Callbacks The API provides several methods for notifying when a message has been delivered to the destination. 1. When you send a message there is an opportunity to specify a `notifyURL`. Once the message has been delivered the API will make a call to this URL to advise of the message status. 2. If you do not specify a URL you can always call the `GET /status` API to get the status of the message. # Getting Access to the API 1. Register at [https://dev.telstra.com](https://dev.telstra.com). 2. After registration, login to [https://dev.telstra.com](https://dev.telstra.com) and navigate to the **My apps** page. 3. Create your application by clicking the **Add new app** button 4. Select **API Free Trial** Product when configuring your application. This Product includes the Telstra Messaging API as well as other free trial APIs. Your application will be approved automatically. 5. There is a maximum of 1000 free messages per developer. Additional messages and features can be purchased from [https://dev.telstra.com](https://dev.telstra.com). 6. Note your `Client key` and `Client secret` as these will be needed to provision a number for your application and for authentication. Now head over to **Getting Started** where you can find a postman collection as well as some links to sample apps and SDKs to get you started. Happy Messaging! # Frequently Asked Questions **Q: Is creating a subscription via the Provisioning call a required step?** A. Yes. You will only be able to start sending messages if you have a provisioned dedicated number. Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: When trying to send an SMS I receive a `400 Bad Request` response. How can I fix this?** A. You need to make sure you have a provisioned dedicated number before you can send an SMS. If you do not have a provisioned dedicated number and you try to send a message via the API, you will get the error below in the response:
{   \"status\":\"400\",   \"code\":\"DELIVERY-IMPOSSIBLE\",   \"message\":\"Invalid \\'from\\' address specified\" }
Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: How long does my dedicated number stay active for?** A. When you provision a dedicated number, by default it will be active for 30 days. You can use the `activeDays` parameter during the provisioning call to increment or decrement the number of days your dedicated number will remain active. Note that Free Trial apps will have 30 days as the maximum `activeDays` they can add to their provisioned number. If the Provisioning call is made several times within that 30-Day period, it will return the `expiryDate` in the Unix format and will not add any activeDays until after that `expiryDate`. **Q: Can I send a broadcast message using the Telstra Messaging API?** A. Yes. Recipient numbers can be in the form of an array of strings if a broadcast message needs to be sent, allowing you to send to multiple mobile numbers in one API call. A sample request body for this will be: `{\"to\":[\"+61412345678\",\"+61487654321\"],\"body\":\"Test Message\"}` **Q: Can I send SMS and MMS to all countries?** A. You can send SMS and MMS to all countries EXCEPT to countries which are subject to global sanctions namely: Burma, Côte d'Ivoire, Cuba, Iran, North Korea, Syria. **Q: Can I use `Alphanumeric Identifier` from my paid plan via credit card?** A. `Alphanumeric Identifier` is only available on Telstra Account paid plans, not through credit card paid plans. **Q: What is the maximum sized MMS that I can send?** A. This will depend on the carrier that will receive the MMS. For Telstra it's up to 2MB, Optus up to 1.5MB and Vodafone only allows up to 500kB. You will need to check with international carriers for thier MMS size limits. **Q: How is the size of an MMS calculated?** A. Images are scaled up to approximately 4/3 when base64 encoded. Additionally, there is approximately 200 bytes of overhead on each MMS. Assuming the maximum MMS that can be sent on Telstra’s network is 2MB, then the maximum image size that can be sent will be approximately 1.378MB (1.378 x 1.34 + 200, without SOAP encapsulation). **Q: How is an MMS classified as Small or Large?** A. MMSes with size below 600kB are classed as Small whereas those that are bigger than 600kB are classed as Large. They will be charged accordingly. **Q: Are SMILs supported by the Messaging API?** A. While there will be no error if you send an MMS with a SMIL presentation, the actual layout or sequence defined in the SMIL may not display as expected because most of the new smartphone devices ignore the SMIL presentation layer. SMIL was used in feature phones which had limited capability and SMIL allowed a *powerpoint type* presentation to be provided. Smartphones now have the capability to display video which is the better option for presentations. It is recommended that MMS messages should just drop the SMIL. **Q: How do I assign a delivery notification or callback URL?** A. You can assign a delivery notification or callback URL by adding the `notifyURL` parameter in the body of the request when you send a message. Once the message has been delivered, a notification will then be posted to this callback URL. **Q: What is the difference between the `notifyURL` parameter in the Provisoning call versus the `notifyURL` parameter in the Send Message call?** A. The `notifyURL` in the Provisoning call will be the URL where replies to the provisioned number will be posted. On the other hand, the `notifyURL` in the Send Message call will be the URL where the delivery notification will be posted, e.g. when an SMS has already been delivered to the recipient. # Getting Started Below are the steps to get started with the Telstra Messaging API. 1. Generate an OAuth2 token using your `Client key` and `Client secret`. 2. Use the Provisioning call to create a subscription and receive a dedicated number. 3. Send a message to a specific mobile number. ## Run in Postman \"Run ## Sample Apps - [Perl Sample App](https://github.com/telstra/MessagingAPI-perl-sample-app) - [Happy Chat App](https://github.com/telstra/messaging-sample-code-happy-chat) - [PHP Sample App](https://github.com/developersteve/telstra-messaging-php) ## SDK Repos - [Messaging API - PHP SDK](https://github.com/telstra/MessagingAPI-SDK-php) - [Messaging API - Python SDK](https://github.com/telstra/MessagingAPI-SDK-python) - [Messaging API - Ruby SDK](https://github.com/telstra/MessagingAPI-SDK-ruby) - [Messaging API - NodeJS SDK](https://github.com/telstra/MessagingAPI-SDK-node) - [Messaging API - .Net2 SDK](https://github.com/telstra/MessagingAPI-SDK-dotnet) - [Messaging API - Java SDK](https://github.com/telstra/MessagingAPI-SDK-Java) ## Blog Posts For more information on the Messaging API, you can read these blog posts: - [Callbacks Part 1](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-1) - [Callbacks Part 2](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-2) +#The Telstra Messaging API specification -OpenAPI spec version: 2.2.9 +The version of the OpenAPI document: 2.2.9 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0 +OpenAPI Generator version: 4.2.3-SNAPSHOT =end @@ -17,13 +17,13 @@ class Message # Just a copy of the number the message is sent to. attr_accessor :to - # Gives an indication if the message has been accepted for delivery. The description field contains information on why a message may have been rejected. + # Gives an indication if the message has been accepted for delivery. The description field contains information on why a message may have been rejected. attr_accessor :delivery_status - # For an accepted message, ths will be a unique reference that can be used to check the messages status. Please refer to the Delivery Notification section. Note that `messageId` will be different for each number that the message was sent to. + # For an accepted message, ths will be a unique reference that can be used to check the messages status. Please refer to the Delivery Notification section. Note that `messageId` will be different for each number that the message was sent to. attr_accessor :message_id - # For an accepted message, ths will be the URL that can be used to check the messages status. Please refer to the Delivery Notification section. + # For an accepted message, ths will be the URL that can be used to check the messages status. Please refer to the Delivery Notification section. attr_accessor :message_status_url # Attribute mapping from ruby-style variable name to JSON key. @@ -46,28 +46,41 @@ def self.openapi_types } end + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - return unless attributes.is_a?(Hash) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Telstra_Messaging::Message` initialize method" + end - # convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Telstra_Messaging::Message`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } - if attributes.has_key?(:'to') + if attributes.key?(:'to') self.to = attributes[:'to'] end - if attributes.has_key?(:'deliveryStatus') - self.delivery_status = attributes[:'deliveryStatus'] + if attributes.key?(:'delivery_status') + self.delivery_status = attributes[:'delivery_status'] end - if attributes.has_key?(:'messageId') - self.message_id = attributes[:'messageId'] + if attributes.key?(:'message_id') + self.message_id = attributes[:'message_id'] end - if attributes.has_key?(:'messageStatusURL') - self.message_status_url = attributes[:'messageStatusURL'] + if attributes.key?(:'message_status_url') + self.message_status_url = attributes[:'message_status_url'] end end @@ -117,11 +130,18 @@ def eql?(o) end # Calculates hash code according to all attributes. - # @return [Fixnum] Hash code + # @return [Integer] Hash code def hash [to, delivery_status, message_id, message_status_url].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -129,7 +149,7 @@ def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.openapi_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the the attribute + # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) @@ -158,7 +178,7 @@ def _deserialize(type, value) value.to_i when :Float value.to_f - when :BOOLEAN + when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else @@ -179,8 +199,7 @@ def _deserialize(type, value) end end else # model - temp_model = Telstra_Messaging.const_get(type).new - temp_model.build_from_hash(value) + Telstra_Messaging.const_get(type).build_from_hash(value) end end @@ -202,7 +221,11 @@ def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) - next if value.nil? + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + hash[param] = _to_hash(value) end hash diff --git a/lib/Telstra_Messaging/models/message_multi.rb b/lib/Telstra_Messaging/models/message_multi.rb new file mode 100644 index 0000000..5b4c998 --- /dev/null +++ b/lib/Telstra_Messaging/models/message_multi.rb @@ -0,0 +1,227 @@ +=begin +#Telstra Messaging API + +#The Telstra Messaging API specification + +The version of the OpenAPI document: 2.2.9 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 4.2.3-SNAPSHOT + +=end + +require 'date' + +module Telstra_Messaging + class MessageMulti + # Phone number (in E.164 format) to send the SMS to. This number can be in international format `\"to\": \"+61412345678\"` or in national format. + attr_accessor :to + + # The text body of the message. Messages longer than 160 characters will be counted as multiple messages. This field contains the message text, this can be up to 1900 (for a single recipient) or 500 (for multiple recipients) UTF-8 characters. As mobile devices rarely support the full range of UTF-8 characters, it is possible that some characters may not be translated correctly by the mobile device + attr_accessor :body + + # Whether Delivery Receipt will be sent back or not. Setting this field to `true` will disable Delivery Receipts. The `notifyURL` field will be ignored, if there is one in the payload. An \"OLD-NONEXISTANT-MESSAGE-ID\" 400 error will also be returned upon Polling for the SMS Status. + attr_accessor :receipt_off + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'to' => :'to', + :'body' => :'body', + :'receipt_off' => :'receiptOff' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'to' => :'String', + :'body' => :'String', + :'receipt_off' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Telstra_Messaging::MessageMulti` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Telstra_Messaging::MessageMulti`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'to') + self.to = attributes[:'to'] + end + + if attributes.key?(:'body') + self.body = attributes[:'body'] + end + + if attributes.key?(:'receipt_off') + self.receipt_off = attributes[:'receipt_off'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + to == o.to && + body == o.body && + receipt_off == o.receipt_off + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [to, body, receipt_off].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + Telstra_Messaging.const_get(type).build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/lib/Telstra_Messaging/models/message_sent_response.rb b/lib/Telstra_Messaging/models/message_sent_response.rb deleted file mode 100644 index 1c914fe..0000000 --- a/lib/Telstra_Messaging/models/message_sent_response.rb +++ /dev/null @@ -1,233 +0,0 @@ -=begin -#Telstra Messaging API - -# # Introduction

Send and receive SMS and MMS messages globally using Telstra's enterprise grade Messaging API. It also allows your application to track the delivery status of both sent and received messages. Get your dedicated Australian number, and start sending and receiving messages today.

# Features The Telstra Messaging API provides the features below. | Feature | Description | | --- | --- | | `Dedicated Number` | Provision a mobile number for your account to be used as `from` address in the API | | `Send Messages` | Sending SMS or MMS messages | | `Receive Messages` | Telstra will deliver messages sent to a dedicated number or to the `notifyURL` defined by you | | `Broadcast Messages` | Invoke a single API call to send a message to a list of numbers provided in `to` | | `Delivery Status` | Query the delivery status of your messages | | `Callbacks` | Provide a notification URL and Telstra will notify your app when a message status changes | | `Alphanumeric Identifier` | Differentiate yourself by providing an alphanumeric string in `from`. This feature is only available on paid plans | | `Concatenation` | Send messages up to 1900 characters long and Telstra will automaticaly segment and reassemble them | | `Reply Request` | Create a chat session by associating `messageId` and `to` number to track responses received from a mobile number. We will store this association for 8 days | | `Character set` | Accepts all Unicode characters as part of UTF-8 | | `Bounce-back response` | See if your SMS hits an unreachable or unallocated number (Australia Only) | | `Queuing` | Messaging API will automatically queue and deliver each message at a compliant rate. | | `Emoji Encoding` | The API supports the encoding of the full range of emojis. Emojis in the reply messages will be in their UTF-8 format. | ## Delivery Notification or Callbacks The API provides several methods for notifying when a message has been delivered to the destination. 1. When you send a message there is an opportunity to specify a `notifyURL`. Once the message has been delivered the API will make a call to this URL to advise of the message status. 2. If you do not specify a URL you can always call the `GET /status` API to get the status of the message. # Getting Access to the API 1. Register at [https://dev.telstra.com](https://dev.telstra.com). 2. After registration, login to [https://dev.telstra.com](https://dev.telstra.com) and navigate to the **My apps** page. 3. Create your application by clicking the **Add new app** button 4. Select **API Free Trial** Product when configuring your application. This Product includes the Telstra Messaging API as well as other free trial APIs. Your application will be approved automatically. 5. There is a maximum of 1000 free messages per developer. Additional messages and features can be purchased from [https://dev.telstra.com](https://dev.telstra.com). 6. Note your `Client key` and `Client secret` as these will be needed to provision a number for your application and for authentication. Now head over to **Getting Started** where you can find a postman collection as well as some links to sample apps and SDKs to get you started. Happy Messaging! # Frequently Asked Questions **Q: Is creating a subscription via the Provisioning call a required step?** A. Yes. You will only be able to start sending messages if you have a provisioned dedicated number. Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: When trying to send an SMS I receive a `400 Bad Request` response. How can I fix this?** A. You need to make sure you have a provisioned dedicated number before you can send an SMS. If you do not have a provisioned dedicated number and you try to send a message via the API, you will get the error below in the response:
{   \"status\":\"400\",   \"code\":\"DELIVERY-IMPOSSIBLE\",   \"message\":\"Invalid \\'from\\' address specified\" }
Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: How long does my dedicated number stay active for?** A. When you provision a dedicated number, by default it will be active for 30 days. You can use the `activeDays` parameter during the provisioning call to increment or decrement the number of days your dedicated number will remain active. Note that Free Trial apps will have 30 days as the maximum `activeDays` they can add to their provisioned number. If the Provisioning call is made several times within that 30-Day period, it will return the `expiryDate` in the Unix format and will not add any activeDays until after that `expiryDate`. **Q: Can I send a broadcast message using the Telstra Messaging API?** A. Yes. Recipient numbers can be in the form of an array of strings if a broadcast message needs to be sent, allowing you to send to multiple mobile numbers in one API call. A sample request body for this will be: `{\"to\":[\"+61412345678\",\"+61487654321\"],\"body\":\"Test Message\"}` **Q: Can I send SMS and MMS to all countries?** A. You can send SMS and MMS to all countries EXCEPT to countries which are subject to global sanctions namely: Burma, Côte d'Ivoire, Cuba, Iran, North Korea, Syria. **Q: Can I use `Alphanumeric Identifier` from my paid plan via credit card?** A. `Alphanumeric Identifier` is only available on Telstra Account paid plans, not through credit card paid plans. **Q: What is the maximum sized MMS that I can send?** A. This will depend on the carrier that will receive the MMS. For Telstra it's up to 2MB, Optus up to 1.5MB and Vodafone only allows up to 500kB. You will need to check with international carriers for thier MMS size limits. **Q: How is the size of an MMS calculated?** A. Images are scaled up to approximately 4/3 when base64 encoded. Additionally, there is approximately 200 bytes of overhead on each MMS. Assuming the maximum MMS that can be sent on Telstra’s network is 2MB, then the maximum image size that can be sent will be approximately 1.378MB (1.378 x 1.34 + 200, without SOAP encapsulation). **Q: How is an MMS classified as Small or Large?** A. MMSes with size below 600kB are classed as Small whereas those that are bigger than 600kB are classed as Large. They will be charged accordingly. **Q: Are SMILs supported by the Messaging API?** A. While there will be no error if you send an MMS with a SMIL presentation, the actual layout or sequence defined in the SMIL may not display as expected because most of the new smartphone devices ignore the SMIL presentation layer. SMIL was used in feature phones which had limited capability and SMIL allowed a *powerpoint type* presentation to be provided. Smartphones now have the capability to display video which is the better option for presentations. It is recommended that MMS messages should just drop the SMIL. **Q: How do I assign a delivery notification or callback URL?** A. You can assign a delivery notification or callback URL by adding the `notifyURL` parameter in the body of the request when you send a message. Once the message has been delivered, a notification will then be posted to this callback URL. **Q: What is the difference between the `notifyURL` parameter in the Provisoning call versus the `notifyURL` parameter in the Send Message call?** A. The `notifyURL` in the Provisoning call will be the URL where replies to the provisioned number will be posted. On the other hand, the `notifyURL` in the Send Message call will be the URL where the delivery notification will be posted, e.g. when an SMS has already been delivered to the recipient. # Getting Started Below are the steps to get started with the Telstra Messaging API. 1. Generate an OAuth2 token using your `Client key` and `Client secret`. 2. Use the Provisioning call to create a subscription and receive a dedicated number. 3. Send a message to a specific mobile number. ## Run in Postman \"Run ## Sample Apps - [Perl Sample App](https://github.com/telstra/MessagingAPI-perl-sample-app) - [Happy Chat App](https://github.com/telstra/messaging-sample-code-happy-chat) - [PHP Sample App](https://github.com/developersteve/telstra-messaging-php) ## SDK Repos - [Messaging API - PHP SDK](https://github.com/telstra/MessagingAPI-SDK-php) - [Messaging API - Python SDK](https://github.com/telstra/MessagingAPI-SDK-python) - [Messaging API - Ruby SDK](https://github.com/telstra/MessagingAPI-SDK-ruby) - [Messaging API - NodeJS SDK](https://github.com/telstra/MessagingAPI-SDK-node) - [Messaging API - .Net2 SDK](https://github.com/telstra/MessagingAPI-SDK-dotnet) - [Messaging API - Java SDK](https://github.com/telstra/MessagingAPI-SDK-Java) ## Blog Posts For more information on the Messaging API, you can read these blog posts: - [Callbacks Part 1](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-1) - [Callbacks Part 2](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-2) - -OpenAPI spec version: 2.2.9 - -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0 - -=end - -require 'date' - -module Telstra_Messaging - class MessageSentResponse - # An array of messages. - attr_accessor :messages - - # An array of the countries to which the destination MSISDNs belong. - attr_accessor :country - - # This returns whether the message sent was a SMS or MMS. - attr_accessor :message_type - - # For SMS messages only, the value indicates the number of 160 character message segments sent. - attr_accessor :number_segments - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'messages' => :'messages', - :'country' => :'Country', - :'message_type' => :'messageType', - :'number_segments' => :'numberSegments' - } - end - - # Attribute type mapping. - def self.openapi_types - { - :'messages' => :'Array', - :'country' => :'Array', - :'message_type' => :'String', - :'number_segments' => :'Integer' - } - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - return unless attributes.is_a?(Hash) - - # convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } - - if attributes.has_key?(:'messages') - if (value = attributes[:'messages']).is_a?(Array) - self.messages = value - end - end - - if attributes.has_key?(:'Country') - if (value = attributes[:'Country']).is_a?(Array) - self.country = value - end - end - - if attributes.has_key?(:'messageType') - self.message_type = attributes[:'messageType'] - end - - if attributes.has_key?(:'numberSegments') - self.number_segments = attributes[:'numberSegments'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - invalid_properties = Array.new - if @messages.nil? - invalid_properties.push('invalid value for "messages", messages cannot be nil.') - end - - if @message_type.nil? - invalid_properties.push('invalid value for "message_type", message_type cannot be nil.') - end - - if @number_segments.nil? - invalid_properties.push('invalid value for "number_segments", number_segments cannot be nil.') - end - - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - return false if @messages.nil? - return false if @message_type.nil? - return false if @number_segments.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - messages == o.messages && - country == o.country && - message_type == o.message_type && - number_segments == o.number_segments - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Fixnum] Hash code - def hash - [messages, country, message_type, number_segments].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - self.class.openapi_types.each_pair do |key, type| - if type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the the attribute - # is documented as an array but the input is not - if attributes[self.class.attribute_map[key]].is_a?(Array) - self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) - end - elsif !attributes[self.class.attribute_map[key]].nil? - self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) - end # or else data not found in attributes(hash), not an issue as the data can be optional - end - - self - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def _deserialize(type, value) - case type.to_sym - when :DateTime - DateTime.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :BOOLEAN - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - temp_model = Telstra_Messaging.const_get(type).new - temp_model.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - next if value.nil? - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end -end diff --git a/lib/Telstra_Messaging/models/message_sent_response_mms.rb b/lib/Telstra_Messaging/models/message_sent_response_mms.rb new file mode 100644 index 0000000..8bb88dc --- /dev/null +++ b/lib/Telstra_Messaging/models/message_sent_response_mms.rb @@ -0,0 +1,266 @@ +=begin +#Telstra Messaging API + +#The Telstra Messaging API specification + +The version of the OpenAPI document: 2.2.9 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 4.2.3-SNAPSHOT + +=end + +require 'date' + +module Telstra_Messaging + class MessageSentResponseMms + # An array of messages. + attr_accessor :messages + + # Indicates the message size in kB of the MMS sent. + attr_accessor :mms_media_kb + + # An array of the countries to which the destination MSISDNs belong. + attr_accessor :country + + # This returns whether the message sent was a SMS or MMS. + attr_accessor :message_type + + # MMS with numberSegments below 600 are classed as Small whereas those that are bigger than 600 are classed as Large. They will be charged accordingly. + attr_accessor :number_segments + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'messages' => :'messages', + :'mms_media_kb' => :'MmsMediaKB', + :'country' => :'Country', + :'message_type' => :'messageType', + :'number_segments' => :'numberSegments' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'messages' => :'Array', + :'mms_media_kb' => :'Integer', + :'country' => :'Array', + :'message_type' => :'String', + :'number_segments' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Telstra_Messaging::MessageSentResponseMms` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Telstra_Messaging::MessageSentResponseMms`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'messages') + if (value = attributes[:'messages']).is_a?(Array) + self.messages = value + end + end + + if attributes.key?(:'mms_media_kb') + self.mms_media_kb = attributes[:'mms_media_kb'] + end + + if attributes.key?(:'country') + if (value = attributes[:'country']).is_a?(Array) + self.country = value + end + end + + if attributes.key?(:'message_type') + self.message_type = attributes[:'message_type'] + end + + if attributes.key?(:'number_segments') + self.number_segments = attributes[:'number_segments'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @messages.nil? + invalid_properties.push('invalid value for "messages", messages cannot be nil.') + end + + if @message_type.nil? + invalid_properties.push('invalid value for "message_type", message_type cannot be nil.') + end + + if @number_segments.nil? + invalid_properties.push('invalid value for "number_segments", number_segments cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @messages.nil? + return false if @message_type.nil? + return false if @number_segments.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + messages == o.messages && + mms_media_kb == o.mms_media_kb && + country == o.country && + message_type == o.message_type && + number_segments == o.number_segments + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [messages, mms_media_kb, country, message_type, number_segments].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + Telstra_Messaging.const_get(type).build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/lib/Telstra_Messaging/models/message_sent_response_sms.rb b/lib/Telstra_Messaging/models/message_sent_response_sms.rb new file mode 100644 index 0000000..cff1035 --- /dev/null +++ b/lib/Telstra_Messaging/models/message_sent_response_sms.rb @@ -0,0 +1,256 @@ +=begin +#Telstra Messaging API + +#The Telstra Messaging API specification + +The version of the OpenAPI document: 2.2.9 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 4.2.3-SNAPSHOT + +=end + +require 'date' + +module Telstra_Messaging + class MessageSentResponseSms + # An array of messages. + attr_accessor :messages + + # An array of the countries to which the destination MSISDNs belong. + attr_accessor :country + + # This returns whether the message sent was a SMS or MMS. + attr_accessor :message_type + + # A message which has 160 GSM-7 characters or less will have numberSegments=1. Note that multi-part messages which are over 160 GSM-7 characters will include the User Data Header as part of the numberSegments. The User Data Header is being used for the re-assembly of the messages. + attr_accessor :number_segments + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'messages' => :'messages', + :'country' => :'Country', + :'message_type' => :'messageType', + :'number_segments' => :'numberSegments' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'messages' => :'Array', + :'country' => :'Array', + :'message_type' => :'String', + :'number_segments' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Telstra_Messaging::MessageSentResponseSms` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Telstra_Messaging::MessageSentResponseSms`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'messages') + if (value = attributes[:'messages']).is_a?(Array) + self.messages = value + end + end + + if attributes.key?(:'country') + if (value = attributes[:'country']).is_a?(Array) + self.country = value + end + end + + if attributes.key?(:'message_type') + self.message_type = attributes[:'message_type'] + end + + if attributes.key?(:'number_segments') + self.number_segments = attributes[:'number_segments'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @messages.nil? + invalid_properties.push('invalid value for "messages", messages cannot be nil.') + end + + if @message_type.nil? + invalid_properties.push('invalid value for "message_type", message_type cannot be nil.') + end + + if @number_segments.nil? + invalid_properties.push('invalid value for "number_segments", number_segments cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @messages.nil? + return false if @message_type.nil? + return false if @number_segments.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + messages == o.messages && + country == o.country && + message_type == o.message_type && + number_segments == o.number_segments + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [messages, country, message_type, number_segments].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + Telstra_Messaging.const_get(type).build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/lib/Telstra_Messaging/models/mms_content.rb b/lib/Telstra_Messaging/models/mms_content.rb index 2ea3db0..6e12e0f 100644 --- a/lib/Telstra_Messaging/models/mms_content.rb +++ b/lib/Telstra_Messaging/models/mms_content.rb @@ -1,12 +1,12 @@ =begin #Telstra Messaging API -# # Introduction

Send and receive SMS and MMS messages globally using Telstra's enterprise grade Messaging API. It also allows your application to track the delivery status of both sent and received messages. Get your dedicated Australian number, and start sending and receiving messages today.

# Features The Telstra Messaging API provides the features below. | Feature | Description | | --- | --- | | `Dedicated Number` | Provision a mobile number for your account to be used as `from` address in the API | | `Send Messages` | Sending SMS or MMS messages | | `Receive Messages` | Telstra will deliver messages sent to a dedicated number or to the `notifyURL` defined by you | | `Broadcast Messages` | Invoke a single API call to send a message to a list of numbers provided in `to` | | `Delivery Status` | Query the delivery status of your messages | | `Callbacks` | Provide a notification URL and Telstra will notify your app when a message status changes | | `Alphanumeric Identifier` | Differentiate yourself by providing an alphanumeric string in `from`. This feature is only available on paid plans | | `Concatenation` | Send messages up to 1900 characters long and Telstra will automaticaly segment and reassemble them | | `Reply Request` | Create a chat session by associating `messageId` and `to` number to track responses received from a mobile number. We will store this association for 8 days | | `Character set` | Accepts all Unicode characters as part of UTF-8 | | `Bounce-back response` | See if your SMS hits an unreachable or unallocated number (Australia Only) | | `Queuing` | Messaging API will automatically queue and deliver each message at a compliant rate. | | `Emoji Encoding` | The API supports the encoding of the full range of emojis. Emojis in the reply messages will be in their UTF-8 format. | ## Delivery Notification or Callbacks The API provides several methods for notifying when a message has been delivered to the destination. 1. When you send a message there is an opportunity to specify a `notifyURL`. Once the message has been delivered the API will make a call to this URL to advise of the message status. 2. If you do not specify a URL you can always call the `GET /status` API to get the status of the message. # Getting Access to the API 1. Register at [https://dev.telstra.com](https://dev.telstra.com). 2. After registration, login to [https://dev.telstra.com](https://dev.telstra.com) and navigate to the **My apps** page. 3. Create your application by clicking the **Add new app** button 4. Select **API Free Trial** Product when configuring your application. This Product includes the Telstra Messaging API as well as other free trial APIs. Your application will be approved automatically. 5. There is a maximum of 1000 free messages per developer. Additional messages and features can be purchased from [https://dev.telstra.com](https://dev.telstra.com). 6. Note your `Client key` and `Client secret` as these will be needed to provision a number for your application and for authentication. Now head over to **Getting Started** where you can find a postman collection as well as some links to sample apps and SDKs to get you started. Happy Messaging! # Frequently Asked Questions **Q: Is creating a subscription via the Provisioning call a required step?** A. Yes. You will only be able to start sending messages if you have a provisioned dedicated number. Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: When trying to send an SMS I receive a `400 Bad Request` response. How can I fix this?** A. You need to make sure you have a provisioned dedicated number before you can send an SMS. If you do not have a provisioned dedicated number and you try to send a message via the API, you will get the error below in the response:
{   \"status\":\"400\",   \"code\":\"DELIVERY-IMPOSSIBLE\",   \"message\":\"Invalid \\'from\\' address specified\" }
Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: How long does my dedicated number stay active for?** A. When you provision a dedicated number, by default it will be active for 30 days. You can use the `activeDays` parameter during the provisioning call to increment or decrement the number of days your dedicated number will remain active. Note that Free Trial apps will have 30 days as the maximum `activeDays` they can add to their provisioned number. If the Provisioning call is made several times within that 30-Day period, it will return the `expiryDate` in the Unix format and will not add any activeDays until after that `expiryDate`. **Q: Can I send a broadcast message using the Telstra Messaging API?** A. Yes. Recipient numbers can be in the form of an array of strings if a broadcast message needs to be sent, allowing you to send to multiple mobile numbers in one API call. A sample request body for this will be: `{\"to\":[\"+61412345678\",\"+61487654321\"],\"body\":\"Test Message\"}` **Q: Can I send SMS and MMS to all countries?** A. You can send SMS and MMS to all countries EXCEPT to countries which are subject to global sanctions namely: Burma, Côte d'Ivoire, Cuba, Iran, North Korea, Syria. **Q: Can I use `Alphanumeric Identifier` from my paid plan via credit card?** A. `Alphanumeric Identifier` is only available on Telstra Account paid plans, not through credit card paid plans. **Q: What is the maximum sized MMS that I can send?** A. This will depend on the carrier that will receive the MMS. For Telstra it's up to 2MB, Optus up to 1.5MB and Vodafone only allows up to 500kB. You will need to check with international carriers for thier MMS size limits. **Q: How is the size of an MMS calculated?** A. Images are scaled up to approximately 4/3 when base64 encoded. Additionally, there is approximately 200 bytes of overhead on each MMS. Assuming the maximum MMS that can be sent on Telstra’s network is 2MB, then the maximum image size that can be sent will be approximately 1.378MB (1.378 x 1.34 + 200, without SOAP encapsulation). **Q: How is an MMS classified as Small or Large?** A. MMSes with size below 600kB are classed as Small whereas those that are bigger than 600kB are classed as Large. They will be charged accordingly. **Q: Are SMILs supported by the Messaging API?** A. While there will be no error if you send an MMS with a SMIL presentation, the actual layout or sequence defined in the SMIL may not display as expected because most of the new smartphone devices ignore the SMIL presentation layer. SMIL was used in feature phones which had limited capability and SMIL allowed a *powerpoint type* presentation to be provided. Smartphones now have the capability to display video which is the better option for presentations. It is recommended that MMS messages should just drop the SMIL. **Q: How do I assign a delivery notification or callback URL?** A. You can assign a delivery notification or callback URL by adding the `notifyURL` parameter in the body of the request when you send a message. Once the message has been delivered, a notification will then be posted to this callback URL. **Q: What is the difference between the `notifyURL` parameter in the Provisoning call versus the `notifyURL` parameter in the Send Message call?** A. The `notifyURL` in the Provisoning call will be the URL where replies to the provisioned number will be posted. On the other hand, the `notifyURL` in the Send Message call will be the URL where the delivery notification will be posted, e.g. when an SMS has already been delivered to the recipient. # Getting Started Below are the steps to get started with the Telstra Messaging API. 1. Generate an OAuth2 token using your `Client key` and `Client secret`. 2. Use the Provisioning call to create a subscription and receive a dedicated number. 3. Send a message to a specific mobile number. ## Run in Postman \"Run ## Sample Apps - [Perl Sample App](https://github.com/telstra/MessagingAPI-perl-sample-app) - [Happy Chat App](https://github.com/telstra/messaging-sample-code-happy-chat) - [PHP Sample App](https://github.com/developersteve/telstra-messaging-php) ## SDK Repos - [Messaging API - PHP SDK](https://github.com/telstra/MessagingAPI-SDK-php) - [Messaging API - Python SDK](https://github.com/telstra/MessagingAPI-SDK-python) - [Messaging API - Ruby SDK](https://github.com/telstra/MessagingAPI-SDK-ruby) - [Messaging API - NodeJS SDK](https://github.com/telstra/MessagingAPI-SDK-node) - [Messaging API - .Net2 SDK](https://github.com/telstra/MessagingAPI-SDK-dotnet) - [Messaging API - Java SDK](https://github.com/telstra/MessagingAPI-SDK-Java) ## Blog Posts For more information on the Messaging API, you can read these blog posts: - [Callbacks Part 1](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-1) - [Callbacks Part 2](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-2) +#The Telstra Messaging API specification -OpenAPI spec version: 2.2.9 +The version of the OpenAPI document: 2.2.9 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0 +OpenAPI Generator version: 4.2.3-SNAPSHOT =end @@ -14,13 +14,13 @@ module Telstra_Messaging class MMSContent - # The following types are supported audio/amr audio/aac audio/mp3 audio/mpeg3 audio/mpeg audio/mpg audio/wav audio/3gpp audio/mp4 image/gif image/jpeg image/jpg image/png image/bmp video/mpeg4 video/mp4 video/mpeg video/3gpp video/3gp video/h263 text/plain text/x-vCard text/x-vCalendar\" + # The following types are supported audio/amr audio/aac audio/mp3 audio/mpeg3 audio/mpeg audio/mpg audio/wav audio/3gpp audio/mp4 image/gif image/jpeg image/jpg image/png image/bmp video/mpeg4 video/mp4 video/mpeg video/3gpp video/3gp video/h263 text/plain text/x-vCard text/x-vCalendar attr_accessor :type - # The file name to be associated with the content. Some devices will display this file name with a placeholder for the content. + # The file name to be associated with the content. Some devices will display this file name with a placeholder for the content. attr_accessor :filename - # + # Base64 encoded message content. attr_accessor :payload # Attribute mapping from ruby-style variable name to JSON key. @@ -41,23 +41,36 @@ def self.openapi_types } end + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - return unless attributes.is_a?(Hash) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Telstra_Messaging::MMSContent` initialize method" + end - # convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Telstra_Messaging::MMSContent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } - if attributes.has_key?(:'type') + if attributes.key?(:'type') self.type = attributes[:'type'] end - if attributes.has_key?(:'filename') + if attributes.key?(:'filename') self.filename = attributes[:'filename'] end - if attributes.has_key?(:'payload') + if attributes.key?(:'payload') self.payload = attributes[:'payload'] end end @@ -107,11 +120,18 @@ def eql?(o) end # Calculates hash code according to all attributes. - # @return [Fixnum] Hash code + # @return [Integer] Hash code def hash [type, filename, payload].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -119,7 +139,7 @@ def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.openapi_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the the attribute + # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) @@ -148,7 +168,7 @@ def _deserialize(type, value) value.to_i when :Float value.to_f - when :BOOLEAN + when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else @@ -169,8 +189,7 @@ def _deserialize(type, value) end end else # model - temp_model = Telstra_Messaging.const_get(type).new - temp_model.build_from_hash(value) + Telstra_Messaging.const_get(type).build_from_hash(value) end end @@ -192,7 +211,11 @@ def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) - next if value.nil? + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + hash[param] = _to_hash(value) end hash diff --git a/lib/Telstra_Messaging/models/o_auth_response.rb b/lib/Telstra_Messaging/models/o_auth_response.rb index ba6d869..dda8c3d 100644 --- a/lib/Telstra_Messaging/models/o_auth_response.rb +++ b/lib/Telstra_Messaging/models/o_auth_response.rb @@ -1,12 +1,12 @@ =begin #Telstra Messaging API -# # Introduction

Send and receive SMS and MMS messages globally using Telstra's enterprise grade Messaging API. It also allows your application to track the delivery status of both sent and received messages. Get your dedicated Australian number, and start sending and receiving messages today.

# Features The Telstra Messaging API provides the features below. | Feature | Description | | --- | --- | | `Dedicated Number` | Provision a mobile number for your account to be used as `from` address in the API | | `Send Messages` | Sending SMS or MMS messages | | `Receive Messages` | Telstra will deliver messages sent to a dedicated number or to the `notifyURL` defined by you | | `Broadcast Messages` | Invoke a single API call to send a message to a list of numbers provided in `to` | | `Delivery Status` | Query the delivery status of your messages | | `Callbacks` | Provide a notification URL and Telstra will notify your app when a message status changes | | `Alphanumeric Identifier` | Differentiate yourself by providing an alphanumeric string in `from`. This feature is only available on paid plans | | `Concatenation` | Send messages up to 1900 characters long and Telstra will automaticaly segment and reassemble them | | `Reply Request` | Create a chat session by associating `messageId` and `to` number to track responses received from a mobile number. We will store this association for 8 days | | `Character set` | Accepts all Unicode characters as part of UTF-8 | | `Bounce-back response` | See if your SMS hits an unreachable or unallocated number (Australia Only) | | `Queuing` | Messaging API will automatically queue and deliver each message at a compliant rate. | | `Emoji Encoding` | The API supports the encoding of the full range of emojis. Emojis in the reply messages will be in their UTF-8 format. | ## Delivery Notification or Callbacks The API provides several methods for notifying when a message has been delivered to the destination. 1. When you send a message there is an opportunity to specify a `notifyURL`. Once the message has been delivered the API will make a call to this URL to advise of the message status. 2. If you do not specify a URL you can always call the `GET /status` API to get the status of the message. # Getting Access to the API 1. Register at [https://dev.telstra.com](https://dev.telstra.com). 2. After registration, login to [https://dev.telstra.com](https://dev.telstra.com) and navigate to the **My apps** page. 3. Create your application by clicking the **Add new app** button 4. Select **API Free Trial** Product when configuring your application. This Product includes the Telstra Messaging API as well as other free trial APIs. Your application will be approved automatically. 5. There is a maximum of 1000 free messages per developer. Additional messages and features can be purchased from [https://dev.telstra.com](https://dev.telstra.com). 6. Note your `Client key` and `Client secret` as these will be needed to provision a number for your application and for authentication. Now head over to **Getting Started** where you can find a postman collection as well as some links to sample apps and SDKs to get you started. Happy Messaging! # Frequently Asked Questions **Q: Is creating a subscription via the Provisioning call a required step?** A. Yes. You will only be able to start sending messages if you have a provisioned dedicated number. Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: When trying to send an SMS I receive a `400 Bad Request` response. How can I fix this?** A. You need to make sure you have a provisioned dedicated number before you can send an SMS. If you do not have a provisioned dedicated number and you try to send a message via the API, you will get the error below in the response:
{   \"status\":\"400\",   \"code\":\"DELIVERY-IMPOSSIBLE\",   \"message\":\"Invalid \\'from\\' address specified\" }
Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: How long does my dedicated number stay active for?** A. When you provision a dedicated number, by default it will be active for 30 days. You can use the `activeDays` parameter during the provisioning call to increment or decrement the number of days your dedicated number will remain active. Note that Free Trial apps will have 30 days as the maximum `activeDays` they can add to their provisioned number. If the Provisioning call is made several times within that 30-Day period, it will return the `expiryDate` in the Unix format and will not add any activeDays until after that `expiryDate`. **Q: Can I send a broadcast message using the Telstra Messaging API?** A. Yes. Recipient numbers can be in the form of an array of strings if a broadcast message needs to be sent, allowing you to send to multiple mobile numbers in one API call. A sample request body for this will be: `{\"to\":[\"+61412345678\",\"+61487654321\"],\"body\":\"Test Message\"}` **Q: Can I send SMS and MMS to all countries?** A. You can send SMS and MMS to all countries EXCEPT to countries which are subject to global sanctions namely: Burma, Côte d'Ivoire, Cuba, Iran, North Korea, Syria. **Q: Can I use `Alphanumeric Identifier` from my paid plan via credit card?** A. `Alphanumeric Identifier` is only available on Telstra Account paid plans, not through credit card paid plans. **Q: What is the maximum sized MMS that I can send?** A. This will depend on the carrier that will receive the MMS. For Telstra it's up to 2MB, Optus up to 1.5MB and Vodafone only allows up to 500kB. You will need to check with international carriers for thier MMS size limits. **Q: How is the size of an MMS calculated?** A. Images are scaled up to approximately 4/3 when base64 encoded. Additionally, there is approximately 200 bytes of overhead on each MMS. Assuming the maximum MMS that can be sent on Telstra’s network is 2MB, then the maximum image size that can be sent will be approximately 1.378MB (1.378 x 1.34 + 200, without SOAP encapsulation). **Q: How is an MMS classified as Small or Large?** A. MMSes with size below 600kB are classed as Small whereas those that are bigger than 600kB are classed as Large. They will be charged accordingly. **Q: Are SMILs supported by the Messaging API?** A. While there will be no error if you send an MMS with a SMIL presentation, the actual layout or sequence defined in the SMIL may not display as expected because most of the new smartphone devices ignore the SMIL presentation layer. SMIL was used in feature phones which had limited capability and SMIL allowed a *powerpoint type* presentation to be provided. Smartphones now have the capability to display video which is the better option for presentations. It is recommended that MMS messages should just drop the SMIL. **Q: How do I assign a delivery notification or callback URL?** A. You can assign a delivery notification or callback URL by adding the `notifyURL` parameter in the body of the request when you send a message. Once the message has been delivered, a notification will then be posted to this callback URL. **Q: What is the difference between the `notifyURL` parameter in the Provisoning call versus the `notifyURL` parameter in the Send Message call?** A. The `notifyURL` in the Provisoning call will be the URL where replies to the provisioned number will be posted. On the other hand, the `notifyURL` in the Send Message call will be the URL where the delivery notification will be posted, e.g. when an SMS has already been delivered to the recipient. # Getting Started Below are the steps to get started with the Telstra Messaging API. 1. Generate an OAuth2 token using your `Client key` and `Client secret`. 2. Use the Provisioning call to create a subscription and receive a dedicated number. 3. Send a message to a specific mobile number. ## Run in Postman \"Run ## Sample Apps - [Perl Sample App](https://github.com/telstra/MessagingAPI-perl-sample-app) - [Happy Chat App](https://github.com/telstra/messaging-sample-code-happy-chat) - [PHP Sample App](https://github.com/developersteve/telstra-messaging-php) ## SDK Repos - [Messaging API - PHP SDK](https://github.com/telstra/MessagingAPI-SDK-php) - [Messaging API - Python SDK](https://github.com/telstra/MessagingAPI-SDK-python) - [Messaging API - Ruby SDK](https://github.com/telstra/MessagingAPI-SDK-ruby) - [Messaging API - NodeJS SDK](https://github.com/telstra/MessagingAPI-SDK-node) - [Messaging API - .Net2 SDK](https://github.com/telstra/MessagingAPI-SDK-dotnet) - [Messaging API - Java SDK](https://github.com/telstra/MessagingAPI-SDK-Java) ## Blog Posts For more information on the Messaging API, you can read these blog posts: - [Callbacks Part 1](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-1) - [Callbacks Part 2](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-2) +#The Telstra Messaging API specification -OpenAPI spec version: 2.2.9 +The version of the OpenAPI document: 2.2.9 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0 +OpenAPI Generator version: 4.2.3-SNAPSHOT =end @@ -41,23 +41,36 @@ def self.openapi_types } end + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - return unless attributes.is_a?(Hash) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Telstra_Messaging::OAuthResponse` initialize method" + end - # convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Telstra_Messaging::OAuthResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } - if attributes.has_key?(:'access_token') + if attributes.key?(:'access_token') self.access_token = attributes[:'access_token'] end - if attributes.has_key?(:'token_type') + if attributes.key?(:'token_type') self.token_type = attributes[:'token_type'] end - if attributes.has_key?(:'expires_in') + if attributes.key?(:'expires_in') self.expires_in = attributes[:'expires_in'] end end @@ -92,11 +105,18 @@ def eql?(o) end # Calculates hash code according to all attributes. - # @return [Fixnum] Hash code + # @return [Integer] Hash code def hash [access_token, token_type, expires_in].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -104,7 +124,7 @@ def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.openapi_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the the attribute + # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) @@ -133,7 +153,7 @@ def _deserialize(type, value) value.to_i when :Float value.to_f - when :BOOLEAN + when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else @@ -154,8 +174,7 @@ def _deserialize(type, value) end end else # model - temp_model = Telstra_Messaging.const_get(type).new - temp_model.build_from_hash(value) + Telstra_Messaging.const_get(type).build_from_hash(value) end end @@ -177,7 +196,11 @@ def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) - next if value.nil? + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + hash[param] = _to_hash(value) end hash diff --git a/lib/Telstra_Messaging/models/outbound_poll_response.rb b/lib/Telstra_Messaging/models/outbound_poll_response.rb index 0be04f8..c3333d0 100644 --- a/lib/Telstra_Messaging/models/outbound_poll_response.rb +++ b/lib/Telstra_Messaging/models/outbound_poll_response.rb @@ -1,12 +1,12 @@ =begin #Telstra Messaging API -# # Introduction

Send and receive SMS and MMS messages globally using Telstra's enterprise grade Messaging API. It also allows your application to track the delivery status of both sent and received messages. Get your dedicated Australian number, and start sending and receiving messages today.

# Features The Telstra Messaging API provides the features below. | Feature | Description | | --- | --- | | `Dedicated Number` | Provision a mobile number for your account to be used as `from` address in the API | | `Send Messages` | Sending SMS or MMS messages | | `Receive Messages` | Telstra will deliver messages sent to a dedicated number or to the `notifyURL` defined by you | | `Broadcast Messages` | Invoke a single API call to send a message to a list of numbers provided in `to` | | `Delivery Status` | Query the delivery status of your messages | | `Callbacks` | Provide a notification URL and Telstra will notify your app when a message status changes | | `Alphanumeric Identifier` | Differentiate yourself by providing an alphanumeric string in `from`. This feature is only available on paid plans | | `Concatenation` | Send messages up to 1900 characters long and Telstra will automaticaly segment and reassemble them | | `Reply Request` | Create a chat session by associating `messageId` and `to` number to track responses received from a mobile number. We will store this association for 8 days | | `Character set` | Accepts all Unicode characters as part of UTF-8 | | `Bounce-back response` | See if your SMS hits an unreachable or unallocated number (Australia Only) | | `Queuing` | Messaging API will automatically queue and deliver each message at a compliant rate. | | `Emoji Encoding` | The API supports the encoding of the full range of emojis. Emojis in the reply messages will be in their UTF-8 format. | ## Delivery Notification or Callbacks The API provides several methods for notifying when a message has been delivered to the destination. 1. When you send a message there is an opportunity to specify a `notifyURL`. Once the message has been delivered the API will make a call to this URL to advise of the message status. 2. If you do not specify a URL you can always call the `GET /status` API to get the status of the message. # Getting Access to the API 1. Register at [https://dev.telstra.com](https://dev.telstra.com). 2. After registration, login to [https://dev.telstra.com](https://dev.telstra.com) and navigate to the **My apps** page. 3. Create your application by clicking the **Add new app** button 4. Select **API Free Trial** Product when configuring your application. This Product includes the Telstra Messaging API as well as other free trial APIs. Your application will be approved automatically. 5. There is a maximum of 1000 free messages per developer. Additional messages and features can be purchased from [https://dev.telstra.com](https://dev.telstra.com). 6. Note your `Client key` and `Client secret` as these will be needed to provision a number for your application and for authentication. Now head over to **Getting Started** where you can find a postman collection as well as some links to sample apps and SDKs to get you started. Happy Messaging! # Frequently Asked Questions **Q: Is creating a subscription via the Provisioning call a required step?** A. Yes. You will only be able to start sending messages if you have a provisioned dedicated number. Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: When trying to send an SMS I receive a `400 Bad Request` response. How can I fix this?** A. You need to make sure you have a provisioned dedicated number before you can send an SMS. If you do not have a provisioned dedicated number and you try to send a message via the API, you will get the error below in the response:
{   \"status\":\"400\",   \"code\":\"DELIVERY-IMPOSSIBLE\",   \"message\":\"Invalid \\'from\\' address specified\" }
Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: How long does my dedicated number stay active for?** A. When you provision a dedicated number, by default it will be active for 30 days. You can use the `activeDays` parameter during the provisioning call to increment or decrement the number of days your dedicated number will remain active. Note that Free Trial apps will have 30 days as the maximum `activeDays` they can add to their provisioned number. If the Provisioning call is made several times within that 30-Day period, it will return the `expiryDate` in the Unix format and will not add any activeDays until after that `expiryDate`. **Q: Can I send a broadcast message using the Telstra Messaging API?** A. Yes. Recipient numbers can be in the form of an array of strings if a broadcast message needs to be sent, allowing you to send to multiple mobile numbers in one API call. A sample request body for this will be: `{\"to\":[\"+61412345678\",\"+61487654321\"],\"body\":\"Test Message\"}` **Q: Can I send SMS and MMS to all countries?** A. You can send SMS and MMS to all countries EXCEPT to countries which are subject to global sanctions namely: Burma, Côte d'Ivoire, Cuba, Iran, North Korea, Syria. **Q: Can I use `Alphanumeric Identifier` from my paid plan via credit card?** A. `Alphanumeric Identifier` is only available on Telstra Account paid plans, not through credit card paid plans. **Q: What is the maximum sized MMS that I can send?** A. This will depend on the carrier that will receive the MMS. For Telstra it's up to 2MB, Optus up to 1.5MB and Vodafone only allows up to 500kB. You will need to check with international carriers for thier MMS size limits. **Q: How is the size of an MMS calculated?** A. Images are scaled up to approximately 4/3 when base64 encoded. Additionally, there is approximately 200 bytes of overhead on each MMS. Assuming the maximum MMS that can be sent on Telstra’s network is 2MB, then the maximum image size that can be sent will be approximately 1.378MB (1.378 x 1.34 + 200, without SOAP encapsulation). **Q: How is an MMS classified as Small or Large?** A. MMSes with size below 600kB are classed as Small whereas those that are bigger than 600kB are classed as Large. They will be charged accordingly. **Q: Are SMILs supported by the Messaging API?** A. While there will be no error if you send an MMS with a SMIL presentation, the actual layout or sequence defined in the SMIL may not display as expected because most of the new smartphone devices ignore the SMIL presentation layer. SMIL was used in feature phones which had limited capability and SMIL allowed a *powerpoint type* presentation to be provided. Smartphones now have the capability to display video which is the better option for presentations. It is recommended that MMS messages should just drop the SMIL. **Q: How do I assign a delivery notification or callback URL?** A. You can assign a delivery notification or callback URL by adding the `notifyURL` parameter in the body of the request when you send a message. Once the message has been delivered, a notification will then be posted to this callback URL. **Q: What is the difference between the `notifyURL` parameter in the Provisoning call versus the `notifyURL` parameter in the Send Message call?** A. The `notifyURL` in the Provisoning call will be the URL where replies to the provisioned number will be posted. On the other hand, the `notifyURL` in the Send Message call will be the URL where the delivery notification will be posted, e.g. when an SMS has already been delivered to the recipient. # Getting Started Below are the steps to get started with the Telstra Messaging API. 1. Generate an OAuth2 token using your `Client key` and `Client secret`. 2. Use the Provisioning call to create a subscription and receive a dedicated number. 3. Send a message to a specific mobile number. ## Run in Postman \"Run ## Sample Apps - [Perl Sample App](https://github.com/telstra/MessagingAPI-perl-sample-app) - [Happy Chat App](https://github.com/telstra/messaging-sample-code-happy-chat) - [PHP Sample App](https://github.com/developersteve/telstra-messaging-php) ## SDK Repos - [Messaging API - PHP SDK](https://github.com/telstra/MessagingAPI-SDK-php) - [Messaging API - Python SDK](https://github.com/telstra/MessagingAPI-SDK-python) - [Messaging API - Ruby SDK](https://github.com/telstra/MessagingAPI-SDK-ruby) - [Messaging API - NodeJS SDK](https://github.com/telstra/MessagingAPI-SDK-node) - [Messaging API - .Net2 SDK](https://github.com/telstra/MessagingAPI-SDK-dotnet) - [Messaging API - Java SDK](https://github.com/telstra/MessagingAPI-SDK-Java) ## Blog Posts For more information on the Messaging API, you can read these blog posts: - [Callbacks Part 1](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-1) - [Callbacks Part 2](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-2) +#The Telstra Messaging API specification -OpenAPI spec version: 2.2.9 +The version of the OpenAPI document: 2.2.9 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0 +OpenAPI Generator version: 4.2.3-SNAPSHOT =end @@ -14,7 +14,7 @@ module Telstra_Messaging class OutboundPollResponse - # The phone number (recipient) the message was sent to (in E.164 format). + # The phone number (recipient) the message was sent to (in E.164 format). attr_accessor :to # The date and time when the message was sent. @@ -45,28 +45,41 @@ def self.openapi_types } end + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - return unless attributes.is_a?(Hash) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Telstra_Messaging::OutboundPollResponse` initialize method" + end - # convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Telstra_Messaging::OutboundPollResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } - if attributes.has_key?(:'to') + if attributes.key?(:'to') self.to = attributes[:'to'] end - if attributes.has_key?(:'sentTimestamp') - self.sent_timestamp = attributes[:'sentTimestamp'] + if attributes.key?(:'sent_timestamp') + self.sent_timestamp = attributes[:'sent_timestamp'] end - if attributes.has_key?(:'receivedTimestamp') - self.received_timestamp = attributes[:'receivedTimestamp'] + if attributes.key?(:'received_timestamp') + self.received_timestamp = attributes[:'received_timestamp'] end - if attributes.has_key?(:'deliveryStatus') - self.delivery_status = attributes[:'deliveryStatus'] + if attributes.key?(:'delivery_status') + self.delivery_status = attributes[:'delivery_status'] end end @@ -101,11 +114,18 @@ def eql?(o) end # Calculates hash code according to all attributes. - # @return [Fixnum] Hash code + # @return [Integer] Hash code def hash [to, sent_timestamp, received_timestamp, delivery_status].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -113,7 +133,7 @@ def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.openapi_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the the attribute + # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) @@ -142,7 +162,7 @@ def _deserialize(type, value) value.to_i when :Float value.to_f - when :BOOLEAN + when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else @@ -163,8 +183,7 @@ def _deserialize(type, value) end end else # model - temp_model = Telstra_Messaging.const_get(type).new - temp_model.build_from_hash(value) + Telstra_Messaging.const_get(type).build_from_hash(value) end end @@ -186,7 +205,11 @@ def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) - next if value.nil? + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + hash[param] = _to_hash(value) end hash diff --git a/lib/Telstra_Messaging/models/provision_number_request.rb b/lib/Telstra_Messaging/models/provision_number_request.rb index c36854e..bda811f 100644 --- a/lib/Telstra_Messaging/models/provision_number_request.rb +++ b/lib/Telstra_Messaging/models/provision_number_request.rb @@ -1,12 +1,12 @@ =begin #Telstra Messaging API -# # Introduction

Send and receive SMS and MMS messages globally using Telstra's enterprise grade Messaging API. It also allows your application to track the delivery status of both sent and received messages. Get your dedicated Australian number, and start sending and receiving messages today.

# Features The Telstra Messaging API provides the features below. | Feature | Description | | --- | --- | | `Dedicated Number` | Provision a mobile number for your account to be used as `from` address in the API | | `Send Messages` | Sending SMS or MMS messages | | `Receive Messages` | Telstra will deliver messages sent to a dedicated number or to the `notifyURL` defined by you | | `Broadcast Messages` | Invoke a single API call to send a message to a list of numbers provided in `to` | | `Delivery Status` | Query the delivery status of your messages | | `Callbacks` | Provide a notification URL and Telstra will notify your app when a message status changes | | `Alphanumeric Identifier` | Differentiate yourself by providing an alphanumeric string in `from`. This feature is only available on paid plans | | `Concatenation` | Send messages up to 1900 characters long and Telstra will automaticaly segment and reassemble them | | `Reply Request` | Create a chat session by associating `messageId` and `to` number to track responses received from a mobile number. We will store this association for 8 days | | `Character set` | Accepts all Unicode characters as part of UTF-8 | | `Bounce-back response` | See if your SMS hits an unreachable or unallocated number (Australia Only) | | `Queuing` | Messaging API will automatically queue and deliver each message at a compliant rate. | | `Emoji Encoding` | The API supports the encoding of the full range of emojis. Emojis in the reply messages will be in their UTF-8 format. | ## Delivery Notification or Callbacks The API provides several methods for notifying when a message has been delivered to the destination. 1. When you send a message there is an opportunity to specify a `notifyURL`. Once the message has been delivered the API will make a call to this URL to advise of the message status. 2. If you do not specify a URL you can always call the `GET /status` API to get the status of the message. # Getting Access to the API 1. Register at [https://dev.telstra.com](https://dev.telstra.com). 2. After registration, login to [https://dev.telstra.com](https://dev.telstra.com) and navigate to the **My apps** page. 3. Create your application by clicking the **Add new app** button 4. Select **API Free Trial** Product when configuring your application. This Product includes the Telstra Messaging API as well as other free trial APIs. Your application will be approved automatically. 5. There is a maximum of 1000 free messages per developer. Additional messages and features can be purchased from [https://dev.telstra.com](https://dev.telstra.com). 6. Note your `Client key` and `Client secret` as these will be needed to provision a number for your application and for authentication. Now head over to **Getting Started** where you can find a postman collection as well as some links to sample apps and SDKs to get you started. Happy Messaging! # Frequently Asked Questions **Q: Is creating a subscription via the Provisioning call a required step?** A. Yes. You will only be able to start sending messages if you have a provisioned dedicated number. Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: When trying to send an SMS I receive a `400 Bad Request` response. How can I fix this?** A. You need to make sure you have a provisioned dedicated number before you can send an SMS. If you do not have a provisioned dedicated number and you try to send a message via the API, you will get the error below in the response:
{   \"status\":\"400\",   \"code\":\"DELIVERY-IMPOSSIBLE\",   \"message\":\"Invalid \\'from\\' address specified\" }
Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: How long does my dedicated number stay active for?** A. When you provision a dedicated number, by default it will be active for 30 days. You can use the `activeDays` parameter during the provisioning call to increment or decrement the number of days your dedicated number will remain active. Note that Free Trial apps will have 30 days as the maximum `activeDays` they can add to their provisioned number. If the Provisioning call is made several times within that 30-Day period, it will return the `expiryDate` in the Unix format and will not add any activeDays until after that `expiryDate`. **Q: Can I send a broadcast message using the Telstra Messaging API?** A. Yes. Recipient numbers can be in the form of an array of strings if a broadcast message needs to be sent, allowing you to send to multiple mobile numbers in one API call. A sample request body for this will be: `{\"to\":[\"+61412345678\",\"+61487654321\"],\"body\":\"Test Message\"}` **Q: Can I send SMS and MMS to all countries?** A. You can send SMS and MMS to all countries EXCEPT to countries which are subject to global sanctions namely: Burma, Côte d'Ivoire, Cuba, Iran, North Korea, Syria. **Q: Can I use `Alphanumeric Identifier` from my paid plan via credit card?** A. `Alphanumeric Identifier` is only available on Telstra Account paid plans, not through credit card paid plans. **Q: What is the maximum sized MMS that I can send?** A. This will depend on the carrier that will receive the MMS. For Telstra it's up to 2MB, Optus up to 1.5MB and Vodafone only allows up to 500kB. You will need to check with international carriers for thier MMS size limits. **Q: How is the size of an MMS calculated?** A. Images are scaled up to approximately 4/3 when base64 encoded. Additionally, there is approximately 200 bytes of overhead on each MMS. Assuming the maximum MMS that can be sent on Telstra’s network is 2MB, then the maximum image size that can be sent will be approximately 1.378MB (1.378 x 1.34 + 200, without SOAP encapsulation). **Q: How is an MMS classified as Small or Large?** A. MMSes with size below 600kB are classed as Small whereas those that are bigger than 600kB are classed as Large. They will be charged accordingly. **Q: Are SMILs supported by the Messaging API?** A. While there will be no error if you send an MMS with a SMIL presentation, the actual layout or sequence defined in the SMIL may not display as expected because most of the new smartphone devices ignore the SMIL presentation layer. SMIL was used in feature phones which had limited capability and SMIL allowed a *powerpoint type* presentation to be provided. Smartphones now have the capability to display video which is the better option for presentations. It is recommended that MMS messages should just drop the SMIL. **Q: How do I assign a delivery notification or callback URL?** A. You can assign a delivery notification or callback URL by adding the `notifyURL` parameter in the body of the request when you send a message. Once the message has been delivered, a notification will then be posted to this callback URL. **Q: What is the difference between the `notifyURL` parameter in the Provisoning call versus the `notifyURL` parameter in the Send Message call?** A. The `notifyURL` in the Provisoning call will be the URL where replies to the provisioned number will be posted. On the other hand, the `notifyURL` in the Send Message call will be the URL where the delivery notification will be posted, e.g. when an SMS has already been delivered to the recipient. # Getting Started Below are the steps to get started with the Telstra Messaging API. 1. Generate an OAuth2 token using your `Client key` and `Client secret`. 2. Use the Provisioning call to create a subscription and receive a dedicated number. 3. Send a message to a specific mobile number. ## Run in Postman \"Run ## Sample Apps - [Perl Sample App](https://github.com/telstra/MessagingAPI-perl-sample-app) - [Happy Chat App](https://github.com/telstra/messaging-sample-code-happy-chat) - [PHP Sample App](https://github.com/developersteve/telstra-messaging-php) ## SDK Repos - [Messaging API - PHP SDK](https://github.com/telstra/MessagingAPI-SDK-php) - [Messaging API - Python SDK](https://github.com/telstra/MessagingAPI-SDK-python) - [Messaging API - Ruby SDK](https://github.com/telstra/MessagingAPI-SDK-ruby) - [Messaging API - NodeJS SDK](https://github.com/telstra/MessagingAPI-SDK-node) - [Messaging API - .Net2 SDK](https://github.com/telstra/MessagingAPI-SDK-dotnet) - [Messaging API - Java SDK](https://github.com/telstra/MessagingAPI-SDK-Java) ## Blog Posts For more information on the Messaging API, you can read these blog posts: - [Callbacks Part 1](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-1) - [Callbacks Part 2](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-2) +#The Telstra Messaging API specification -OpenAPI spec version: 2.2.9 +The version of the OpenAPI document: 2.2.9 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0 +OpenAPI Generator version: 4.2.3-SNAPSHOT =end @@ -17,7 +17,7 @@ class ProvisionNumberRequest # The number of days before for which this number is provisioned. attr_accessor :active_days - # A notification URL that will be POSTed to whenever a new message (e.g. a reply to a message sent) arrives at this destination address. If this is not provided then you can use the Get /sms or /mms API to poll for reply messages. *Please note that the notification URLs and the Get /sms or /mms call are exclusive. If a notification URL has been set then the GET call will not provide any useful information.* + # A notification URL that will be POSTed to whenever a new message (i.e. a reply to a message sent) arrives at this destination address. If this is not provided then you can use the Get /sms or /mms API to poll for reply messages. If you are using a domain URL you must include the forward slash at the end of the URL (e.g. http://www.example.com/). *Please note that the notification URLs and the Get /sms or /mms call are exclusive. If a notification URL has been set then the GET call will not provide any useful information.* attr_accessor :notify_url # Attribute mapping from ruby-style variable name to JSON key. @@ -36,20 +36,33 @@ def self.openapi_types } end + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - return unless attributes.is_a?(Hash) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Telstra_Messaging::ProvisionNumberRequest` initialize method" + end - # convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Telstra_Messaging::ProvisionNumberRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } - if attributes.has_key?(:'activeDays') - self.active_days = attributes[:'activeDays'] + if attributes.key?(:'active_days') + self.active_days = attributes[:'active_days'] end - if attributes.has_key?(:'notifyURL') - self.notify_url = attributes[:'notifyURL'] + if attributes.key?(:'notify_url') + self.notify_url = attributes[:'notify_url'] end end @@ -82,11 +95,18 @@ def eql?(o) end # Calculates hash code according to all attributes. - # @return [Fixnum] Hash code + # @return [Integer] Hash code def hash [active_days, notify_url].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -94,7 +114,7 @@ def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.openapi_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the the attribute + # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) @@ -123,7 +143,7 @@ def _deserialize(type, value) value.to_i when :Float value.to_f - when :BOOLEAN + when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else @@ -144,8 +164,7 @@ def _deserialize(type, value) end end else # model - temp_model = Telstra_Messaging.const_get(type).new - temp_model.build_from_hash(value) + Telstra_Messaging.const_get(type).build_from_hash(value) end end @@ -167,7 +186,11 @@ def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) - next if value.nil? + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + hash[param] = _to_hash(value) end hash diff --git a/lib/Telstra_Messaging/models/provision_number_response.rb b/lib/Telstra_Messaging/models/provision_number_response.rb index cc10d14..b794955 100644 --- a/lib/Telstra_Messaging/models/provision_number_response.rb +++ b/lib/Telstra_Messaging/models/provision_number_response.rb @@ -1,12 +1,12 @@ =begin #Telstra Messaging API -# # Introduction

Send and receive SMS and MMS messages globally using Telstra's enterprise grade Messaging API. It also allows your application to track the delivery status of both sent and received messages. Get your dedicated Australian number, and start sending and receiving messages today.

# Features The Telstra Messaging API provides the features below. | Feature | Description | | --- | --- | | `Dedicated Number` | Provision a mobile number for your account to be used as `from` address in the API | | `Send Messages` | Sending SMS or MMS messages | | `Receive Messages` | Telstra will deliver messages sent to a dedicated number or to the `notifyURL` defined by you | | `Broadcast Messages` | Invoke a single API call to send a message to a list of numbers provided in `to` | | `Delivery Status` | Query the delivery status of your messages | | `Callbacks` | Provide a notification URL and Telstra will notify your app when a message status changes | | `Alphanumeric Identifier` | Differentiate yourself by providing an alphanumeric string in `from`. This feature is only available on paid plans | | `Concatenation` | Send messages up to 1900 characters long and Telstra will automaticaly segment and reassemble them | | `Reply Request` | Create a chat session by associating `messageId` and `to` number to track responses received from a mobile number. We will store this association for 8 days | | `Character set` | Accepts all Unicode characters as part of UTF-8 | | `Bounce-back response` | See if your SMS hits an unreachable or unallocated number (Australia Only) | | `Queuing` | Messaging API will automatically queue and deliver each message at a compliant rate. | | `Emoji Encoding` | The API supports the encoding of the full range of emojis. Emojis in the reply messages will be in their UTF-8 format. | ## Delivery Notification or Callbacks The API provides several methods for notifying when a message has been delivered to the destination. 1. When you send a message there is an opportunity to specify a `notifyURL`. Once the message has been delivered the API will make a call to this URL to advise of the message status. 2. If you do not specify a URL you can always call the `GET /status` API to get the status of the message. # Getting Access to the API 1. Register at [https://dev.telstra.com](https://dev.telstra.com). 2. After registration, login to [https://dev.telstra.com](https://dev.telstra.com) and navigate to the **My apps** page. 3. Create your application by clicking the **Add new app** button 4. Select **API Free Trial** Product when configuring your application. This Product includes the Telstra Messaging API as well as other free trial APIs. Your application will be approved automatically. 5. There is a maximum of 1000 free messages per developer. Additional messages and features can be purchased from [https://dev.telstra.com](https://dev.telstra.com). 6. Note your `Client key` and `Client secret` as these will be needed to provision a number for your application and for authentication. Now head over to **Getting Started** where you can find a postman collection as well as some links to sample apps and SDKs to get you started. Happy Messaging! # Frequently Asked Questions **Q: Is creating a subscription via the Provisioning call a required step?** A. Yes. You will only be able to start sending messages if you have a provisioned dedicated number. Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: When trying to send an SMS I receive a `400 Bad Request` response. How can I fix this?** A. You need to make sure you have a provisioned dedicated number before you can send an SMS. If you do not have a provisioned dedicated number and you try to send a message via the API, you will get the error below in the response:
{   \"status\":\"400\",   \"code\":\"DELIVERY-IMPOSSIBLE\",   \"message\":\"Invalid \\'from\\' address specified\" }
Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: How long does my dedicated number stay active for?** A. When you provision a dedicated number, by default it will be active for 30 days. You can use the `activeDays` parameter during the provisioning call to increment or decrement the number of days your dedicated number will remain active. Note that Free Trial apps will have 30 days as the maximum `activeDays` they can add to their provisioned number. If the Provisioning call is made several times within that 30-Day period, it will return the `expiryDate` in the Unix format and will not add any activeDays until after that `expiryDate`. **Q: Can I send a broadcast message using the Telstra Messaging API?** A. Yes. Recipient numbers can be in the form of an array of strings if a broadcast message needs to be sent, allowing you to send to multiple mobile numbers in one API call. A sample request body for this will be: `{\"to\":[\"+61412345678\",\"+61487654321\"],\"body\":\"Test Message\"}` **Q: Can I send SMS and MMS to all countries?** A. You can send SMS and MMS to all countries EXCEPT to countries which are subject to global sanctions namely: Burma, Côte d'Ivoire, Cuba, Iran, North Korea, Syria. **Q: Can I use `Alphanumeric Identifier` from my paid plan via credit card?** A. `Alphanumeric Identifier` is only available on Telstra Account paid plans, not through credit card paid plans. **Q: What is the maximum sized MMS that I can send?** A. This will depend on the carrier that will receive the MMS. For Telstra it's up to 2MB, Optus up to 1.5MB and Vodafone only allows up to 500kB. You will need to check with international carriers for thier MMS size limits. **Q: How is the size of an MMS calculated?** A. Images are scaled up to approximately 4/3 when base64 encoded. Additionally, there is approximately 200 bytes of overhead on each MMS. Assuming the maximum MMS that can be sent on Telstra’s network is 2MB, then the maximum image size that can be sent will be approximately 1.378MB (1.378 x 1.34 + 200, without SOAP encapsulation). **Q: How is an MMS classified as Small or Large?** A. MMSes with size below 600kB are classed as Small whereas those that are bigger than 600kB are classed as Large. They will be charged accordingly. **Q: Are SMILs supported by the Messaging API?** A. While there will be no error if you send an MMS with a SMIL presentation, the actual layout or sequence defined in the SMIL may not display as expected because most of the new smartphone devices ignore the SMIL presentation layer. SMIL was used in feature phones which had limited capability and SMIL allowed a *powerpoint type* presentation to be provided. Smartphones now have the capability to display video which is the better option for presentations. It is recommended that MMS messages should just drop the SMIL. **Q: How do I assign a delivery notification or callback URL?** A. You can assign a delivery notification or callback URL by adding the `notifyURL` parameter in the body of the request when you send a message. Once the message has been delivered, a notification will then be posted to this callback URL. **Q: What is the difference between the `notifyURL` parameter in the Provisoning call versus the `notifyURL` parameter in the Send Message call?** A. The `notifyURL` in the Provisoning call will be the URL where replies to the provisioned number will be posted. On the other hand, the `notifyURL` in the Send Message call will be the URL where the delivery notification will be posted, e.g. when an SMS has already been delivered to the recipient. # Getting Started Below are the steps to get started with the Telstra Messaging API. 1. Generate an OAuth2 token using your `Client key` and `Client secret`. 2. Use the Provisioning call to create a subscription and receive a dedicated number. 3. Send a message to a specific mobile number. ## Run in Postman \"Run ## Sample Apps - [Perl Sample App](https://github.com/telstra/MessagingAPI-perl-sample-app) - [Happy Chat App](https://github.com/telstra/messaging-sample-code-happy-chat) - [PHP Sample App](https://github.com/developersteve/telstra-messaging-php) ## SDK Repos - [Messaging API - PHP SDK](https://github.com/telstra/MessagingAPI-SDK-php) - [Messaging API - Python SDK](https://github.com/telstra/MessagingAPI-SDK-python) - [Messaging API - Ruby SDK](https://github.com/telstra/MessagingAPI-SDK-ruby) - [Messaging API - NodeJS SDK](https://github.com/telstra/MessagingAPI-SDK-node) - [Messaging API - .Net2 SDK](https://github.com/telstra/MessagingAPI-SDK-dotnet) - [Messaging API - Java SDK](https://github.com/telstra/MessagingAPI-SDK-Java) ## Blog Posts For more information on the Messaging API, you can read these blog posts: - [Callbacks Part 1](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-1) - [Callbacks Part 2](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-2) +#The Telstra Messaging API specification -OpenAPI spec version: 2.2.9 +The version of the OpenAPI document: 2.2.9 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0 +OpenAPI Generator version: 4.2.3-SNAPSHOT =end @@ -17,17 +17,13 @@ class ProvisionNumberResponse # The mobile phone number that was allocated attr_accessor :destination_address - # Metadata for provisioned numbers which are valid for more than 5 years - attr_accessor :description - - # Free Trial apps will have a 30-Day Limit for their provisioned number. This is in Unix time format. + # Free Trial apps can only add activeDays for their provisioned number every 30 days. This is in Unix time format. attr_accessor :expiry_date # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'destination_address' => :'destinationAddress', - :'description' => :'description', :'expiry_date' => :'expiryDate' } end @@ -36,29 +32,37 @@ def self.attribute_map def self.openapi_types { :'destination_address' => :'String', - :'description' => :'String', :'expiry_date' => :'Float' } end + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - return unless attributes.is_a?(Hash) - - # convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } - - if attributes.has_key?(:'destinationAddress') - self.destination_address = attributes[:'destinationAddress'] + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Telstra_Messaging::ProvisionNumberResponse` initialize method" end - if attributes.has_key?(:'description') - self.description = attributes[:'description'] + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Telstra_Messaging::ProvisionNumberResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'destination_address') + self.destination_address = attributes[:'destination_address'] end - if attributes.has_key?(:'expiryDate') - self.expiry_date = attributes[:'expiryDate'] + if attributes.key?(:'expiry_date') + self.expiry_date = attributes[:'expiry_date'] end end @@ -81,7 +85,6 @@ def ==(o) return true if self.equal?(o) self.class == o.class && destination_address == o.destination_address && - description == o.description && expiry_date == o.expiry_date end @@ -92,9 +95,16 @@ def eql?(o) end # Calculates hash code according to all attributes. - # @return [Fixnum] Hash code + # @return [Integer] Hash code def hash - [destination_address, description, expiry_date].hash + [destination_address, expiry_date].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) end # Builds the object from hash @@ -104,7 +114,7 @@ def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.openapi_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the the attribute + # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) @@ -133,7 +143,7 @@ def _deserialize(type, value) value.to_i when :Float value.to_f - when :BOOLEAN + when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else @@ -154,8 +164,7 @@ def _deserialize(type, value) end end else # model - temp_model = Telstra_Messaging.const_get(type).new - temp_model.build_from_hash(value) + Telstra_Messaging.const_get(type).build_from_hash(value) end end @@ -177,7 +186,11 @@ def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) - next if value.nil? + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + hash[param] = _to_hash(value) end hash diff --git a/lib/Telstra_Messaging/models/send_mms_request.rb b/lib/Telstra_Messaging/models/send_mms_request.rb index 82aef6e..bed2394 100644 --- a/lib/Telstra_Messaging/models/send_mms_request.rb +++ b/lib/Telstra_Messaging/models/send_mms_request.rb @@ -1,12 +1,12 @@ =begin #Telstra Messaging API -# # Introduction

Send and receive SMS and MMS messages globally using Telstra's enterprise grade Messaging API. It also allows your application to track the delivery status of both sent and received messages. Get your dedicated Australian number, and start sending and receiving messages today.

# Features The Telstra Messaging API provides the features below. | Feature | Description | | --- | --- | | `Dedicated Number` | Provision a mobile number for your account to be used as `from` address in the API | | `Send Messages` | Sending SMS or MMS messages | | `Receive Messages` | Telstra will deliver messages sent to a dedicated number or to the `notifyURL` defined by you | | `Broadcast Messages` | Invoke a single API call to send a message to a list of numbers provided in `to` | | `Delivery Status` | Query the delivery status of your messages | | `Callbacks` | Provide a notification URL and Telstra will notify your app when a message status changes | | `Alphanumeric Identifier` | Differentiate yourself by providing an alphanumeric string in `from`. This feature is only available on paid plans | | `Concatenation` | Send messages up to 1900 characters long and Telstra will automaticaly segment and reassemble them | | `Reply Request` | Create a chat session by associating `messageId` and `to` number to track responses received from a mobile number. We will store this association for 8 days | | `Character set` | Accepts all Unicode characters as part of UTF-8 | | `Bounce-back response` | See if your SMS hits an unreachable or unallocated number (Australia Only) | | `Queuing` | Messaging API will automatically queue and deliver each message at a compliant rate. | | `Emoji Encoding` | The API supports the encoding of the full range of emojis. Emojis in the reply messages will be in their UTF-8 format. | ## Delivery Notification or Callbacks The API provides several methods for notifying when a message has been delivered to the destination. 1. When you send a message there is an opportunity to specify a `notifyURL`. Once the message has been delivered the API will make a call to this URL to advise of the message status. 2. If you do not specify a URL you can always call the `GET /status` API to get the status of the message. # Getting Access to the API 1. Register at [https://dev.telstra.com](https://dev.telstra.com). 2. After registration, login to [https://dev.telstra.com](https://dev.telstra.com) and navigate to the **My apps** page. 3. Create your application by clicking the **Add new app** button 4. Select **API Free Trial** Product when configuring your application. This Product includes the Telstra Messaging API as well as other free trial APIs. Your application will be approved automatically. 5. There is a maximum of 1000 free messages per developer. Additional messages and features can be purchased from [https://dev.telstra.com](https://dev.telstra.com). 6. Note your `Client key` and `Client secret` as these will be needed to provision a number for your application and for authentication. Now head over to **Getting Started** where you can find a postman collection as well as some links to sample apps and SDKs to get you started. Happy Messaging! # Frequently Asked Questions **Q: Is creating a subscription via the Provisioning call a required step?** A. Yes. You will only be able to start sending messages if you have a provisioned dedicated number. Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: When trying to send an SMS I receive a `400 Bad Request` response. How can I fix this?** A. You need to make sure you have a provisioned dedicated number before you can send an SMS. If you do not have a provisioned dedicated number and you try to send a message via the API, you will get the error below in the response:
{   \"status\":\"400\",   \"code\":\"DELIVERY-IMPOSSIBLE\",   \"message\":\"Invalid \\'from\\' address specified\" }
Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: How long does my dedicated number stay active for?** A. When you provision a dedicated number, by default it will be active for 30 days. You can use the `activeDays` parameter during the provisioning call to increment or decrement the number of days your dedicated number will remain active. Note that Free Trial apps will have 30 days as the maximum `activeDays` they can add to their provisioned number. If the Provisioning call is made several times within that 30-Day period, it will return the `expiryDate` in the Unix format and will not add any activeDays until after that `expiryDate`. **Q: Can I send a broadcast message using the Telstra Messaging API?** A. Yes. Recipient numbers can be in the form of an array of strings if a broadcast message needs to be sent, allowing you to send to multiple mobile numbers in one API call. A sample request body for this will be: `{\"to\":[\"+61412345678\",\"+61487654321\"],\"body\":\"Test Message\"}` **Q: Can I send SMS and MMS to all countries?** A. You can send SMS and MMS to all countries EXCEPT to countries which are subject to global sanctions namely: Burma, Côte d'Ivoire, Cuba, Iran, North Korea, Syria. **Q: Can I use `Alphanumeric Identifier` from my paid plan via credit card?** A. `Alphanumeric Identifier` is only available on Telstra Account paid plans, not through credit card paid plans. **Q: What is the maximum sized MMS that I can send?** A. This will depend on the carrier that will receive the MMS. For Telstra it's up to 2MB, Optus up to 1.5MB and Vodafone only allows up to 500kB. You will need to check with international carriers for thier MMS size limits. **Q: How is the size of an MMS calculated?** A. Images are scaled up to approximately 4/3 when base64 encoded. Additionally, there is approximately 200 bytes of overhead on each MMS. Assuming the maximum MMS that can be sent on Telstra’s network is 2MB, then the maximum image size that can be sent will be approximately 1.378MB (1.378 x 1.34 + 200, without SOAP encapsulation). **Q: How is an MMS classified as Small or Large?** A. MMSes with size below 600kB are classed as Small whereas those that are bigger than 600kB are classed as Large. They will be charged accordingly. **Q: Are SMILs supported by the Messaging API?** A. While there will be no error if you send an MMS with a SMIL presentation, the actual layout or sequence defined in the SMIL may not display as expected because most of the new smartphone devices ignore the SMIL presentation layer. SMIL was used in feature phones which had limited capability and SMIL allowed a *powerpoint type* presentation to be provided. Smartphones now have the capability to display video which is the better option for presentations. It is recommended that MMS messages should just drop the SMIL. **Q: How do I assign a delivery notification or callback URL?** A. You can assign a delivery notification or callback URL by adding the `notifyURL` parameter in the body of the request when you send a message. Once the message has been delivered, a notification will then be posted to this callback URL. **Q: What is the difference between the `notifyURL` parameter in the Provisoning call versus the `notifyURL` parameter in the Send Message call?** A. The `notifyURL` in the Provisoning call will be the URL where replies to the provisioned number will be posted. On the other hand, the `notifyURL` in the Send Message call will be the URL where the delivery notification will be posted, e.g. when an SMS has already been delivered to the recipient. # Getting Started Below are the steps to get started with the Telstra Messaging API. 1. Generate an OAuth2 token using your `Client key` and `Client secret`. 2. Use the Provisioning call to create a subscription and receive a dedicated number. 3. Send a message to a specific mobile number. ## Run in Postman \"Run ## Sample Apps - [Perl Sample App](https://github.com/telstra/MessagingAPI-perl-sample-app) - [Happy Chat App](https://github.com/telstra/messaging-sample-code-happy-chat) - [PHP Sample App](https://github.com/developersteve/telstra-messaging-php) ## SDK Repos - [Messaging API - PHP SDK](https://github.com/telstra/MessagingAPI-SDK-php) - [Messaging API - Python SDK](https://github.com/telstra/MessagingAPI-SDK-python) - [Messaging API - Ruby SDK](https://github.com/telstra/MessagingAPI-SDK-ruby) - [Messaging API - NodeJS SDK](https://github.com/telstra/MessagingAPI-SDK-node) - [Messaging API - .Net2 SDK](https://github.com/telstra/MessagingAPI-SDK-dotnet) - [Messaging API - Java SDK](https://github.com/telstra/MessagingAPI-SDK-Java) ## Blog Posts For more information on the Messaging API, you can read these blog posts: - [Callbacks Part 1](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-1) - [Callbacks Part 2](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-2) +#The Telstra Messaging API specification -OpenAPI spec version: 2.2.9 +The version of the OpenAPI document: 2.2.9 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0 +OpenAPI Generator version: 4.2.3-SNAPSHOT =end @@ -14,29 +14,29 @@ module Telstra_Messaging class SendMmsRequest - # This will be the source address that will be displayed on the receiving device. If it is not present then it will default to the MSISDN assigned to the app. If replyRequest is set to true, then this field will be ignored. - attr_accessor :from - # This is the destination address. Can be an array of strings if sending to multiple numbers: \"to\":[\"+61412345678\", \"+61418765432\"] attr_accessor :to - # The subject that will be used in an MMS message. + # This will be the source address that will be displayed on the receiving device. You can set an Alphanumeric sender ID of up to 11 characters that the MMS was sent from. Phone numbers in the `from` attribute will be blocked (400-error) to prevent number spoofing. Most standard ASCII characters are accepted in the alphanumeric `from` attribute, however there are some limitations. The following limitations and characters are allowed in the alphanumeric `from` attribute; any alphabetic character (e.g. `abc`), any number mixed with alphabetic characters (e.g. `123abc`), uppercase and lowercase characters (e.g. `aBc`), any of the following special characters mixed with alphabetic characters are allowed; `~!@#$%^&*()~_~+-={}|[];'?,./` (e.g. `abc~!@`), any combination of lowercase, uppercase, numeric or allowed special characters (e.g. `abc@#123DE`). All other characters, including spaces and extended ASCII characters, are not allowed (e.g. `<>:\"\\`). If attribute is not present, the service will use the mobile number associated with the application (in E.164 format). If `replyRequest` is set to true, this field should not be present. This feature is only available on Telstra Account paid plans, not through Free Trials or credit card paid plans. *Please note:* *- Alphanumeric sender ID works for domestic, i.e. Australian, destinations only.* *- When Alphanumeric sender ID is used in sending MMS, Delivery Reports will NOT be returned.* + attr_accessor :from + + # The subject that will be used in an MMS message. Subject is limited to maximum of 64 characters. Some special characters need to be encoded if used in the `subject` field (e.g. &amp; for & and &lt; for <). attr_accessor :subject - # If set to true, the reply message functionality will be implemented and the to address will be ignored if present. + # If set to true, the reply message functionality will be implemented. The `from` field should not be present. attr_accessor :reply_request - # Notify url + # Contains a URL that will be called once your message has been processed. The status may be delivered, expired, deleted, etc. Please refer to the Delivery Status section for more information. If you are using a domain URL you must include the forward slash at the end of the URL (e.g. http://www.example.com/). attr_accessor :notify_url - # An array of content that will be sent in an MMS message. If this array is present it will cause the `body` element to be ignored, and the message will be sent as an MMS. + # An array of content that will be sent in an MMS message. If this array is present it will cause the `body` element to be ignored, and the message will be sent as an MMS. attr_accessor :mms_content # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { - :'from' => :'from', :'to' => :'to', + :'from' => :'from', :'subject' => :'subject', :'reply_request' => :'replyRequest', :'notify_url' => :'notifyURL', @@ -47,45 +47,58 @@ def self.attribute_map # Attribute type mapping. def self.openapi_types { - :'from' => :'String', :'to' => :'String', + :'from' => :'String', :'subject' => :'String', - :'reply_request' => :'BOOLEAN', + :'reply_request' => :'Boolean', :'notify_url' => :'String', :'mms_content' => :'Array' } end + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - return unless attributes.is_a?(Hash) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Telstra_Messaging::SendMmsRequest` initialize method" + end - # convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Telstra_Messaging::SendMmsRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } - if attributes.has_key?(:'from') - self.from = attributes[:'from'] + if attributes.key?(:'to') + self.to = attributes[:'to'] end - if attributes.has_key?(:'to') - self.to = attributes[:'to'] + if attributes.key?(:'from') + self.from = attributes[:'from'] end - if attributes.has_key?(:'subject') + if attributes.key?(:'subject') self.subject = attributes[:'subject'] end - if attributes.has_key?(:'replyRequest') - self.reply_request = attributes[:'replyRequest'] + if attributes.key?(:'reply_request') + self.reply_request = attributes[:'reply_request'] end - if attributes.has_key?(:'notifyURL') - self.notify_url = attributes[:'notifyURL'] + if attributes.key?(:'notify_url') + self.notify_url = attributes[:'notify_url'] end - if attributes.has_key?(:'MMSContent') - if (value = attributes[:'MMSContent']).is_a?(Array) + if attributes.key?(:'mms_content') + if (value = attributes[:'mms_content']).is_a?(Array) self.mms_content = value end end @@ -95,22 +108,10 @@ def initialize(attributes = {}) # @return Array for valid properties with the reasons def list_invalid_properties invalid_properties = Array.new - if @from.nil? - invalid_properties.push('invalid value for "from", from cannot be nil.') - end - if @to.nil? invalid_properties.push('invalid value for "to", to cannot be nil.') end - if @subject.nil? - invalid_properties.push('invalid value for "subject", subject cannot be nil.') - end - - if @reply_request.nil? - invalid_properties.push('invalid value for "reply_request", reply_request cannot be nil.') - end - if @mms_content.nil? invalid_properties.push('invalid value for "mms_content", mms_content cannot be nil.') end @@ -121,10 +122,7 @@ def list_invalid_properties # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? - return false if @from.nil? return false if @to.nil? - return false if @subject.nil? - return false if @reply_request.nil? return false if @mms_content.nil? true end @@ -134,8 +132,8 @@ def valid? def ==(o) return true if self.equal?(o) self.class == o.class && - from == o.from && to == o.to && + from == o.from && subject == o.subject && reply_request == o.reply_request && notify_url == o.notify_url && @@ -149,9 +147,16 @@ def eql?(o) end # Calculates hash code according to all attributes. - # @return [Fixnum] Hash code + # @return [Integer] Hash code def hash - [from, to, subject, reply_request, notify_url, mms_content].hash + [to, from, subject, reply_request, notify_url, mms_content].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) end # Builds the object from hash @@ -161,7 +166,7 @@ def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.openapi_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the the attribute + # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) @@ -190,7 +195,7 @@ def _deserialize(type, value) value.to_i when :Float value.to_f - when :BOOLEAN + when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else @@ -211,8 +216,7 @@ def _deserialize(type, value) end end else # model - temp_model = Telstra_Messaging.const_get(type).new - temp_model.build_from_hash(value) + Telstra_Messaging.const_get(type).build_from_hash(value) end end @@ -234,7 +238,11 @@ def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) - next if value.nil? + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + hash[param] = _to_hash(value) end hash diff --git a/lib/Telstra_Messaging/models/send_sms_multi_request.rb b/lib/Telstra_Messaging/models/send_sms_multi_request.rb new file mode 100644 index 0000000..3ab6297 --- /dev/null +++ b/lib/Telstra_Messaging/models/send_sms_multi_request.rb @@ -0,0 +1,219 @@ +=begin +#Telstra Messaging API + +#The Telstra Messaging API specification + +The version of the OpenAPI document: 2.2.9 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 4.2.3-SNAPSHOT + +=end + +require 'date' + +module Telstra_Messaging + class SendSmsMultiRequest + # Multiple SMS. Up to 10 messages can be sent in one API call. + attr_accessor :sms_multi + + # Contains a URL that will be called once your message has been processed. The status may be delivered, expired, deleted, etc. Please refer to the Delivery Status section for more information. If you are using a domain URL you must include the forward slash at the end of the URL (e.g. http://www.example.com/). This is required when `\"receiptOff\"` is missing or `\"receiptOff\":\"false\"`. + attr_accessor :notify_url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'sms_multi' => :'smsMulti', + :'notify_url' => :'notifyURL' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'sms_multi' => :'Array', + :'notify_url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Telstra_Messaging::SendSmsMultiRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Telstra_Messaging::SendSmsMultiRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'sms_multi') + if (value = attributes[:'sms_multi']).is_a?(Array) + self.sms_multi = value + end + end + + if attributes.key?(:'notify_url') + self.notify_url = attributes[:'notify_url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + sms_multi == o.sms_multi && + notify_url == o.notify_url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [sms_multi, notify_url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + Telstra_Messaging.const_get(type).build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/lib/Telstra_Messaging/models/send_sms_request.rb b/lib/Telstra_Messaging/models/send_sms_request.rb index 11e6531..388c13b 100644 --- a/lib/Telstra_Messaging/models/send_sms_request.rb +++ b/lib/Telstra_Messaging/models/send_sms_request.rb @@ -1,12 +1,12 @@ =begin #Telstra Messaging API -# # Introduction

Send and receive SMS and MMS messages globally using Telstra's enterprise grade Messaging API. It also allows your application to track the delivery status of both sent and received messages. Get your dedicated Australian number, and start sending and receiving messages today.

# Features The Telstra Messaging API provides the features below. | Feature | Description | | --- | --- | | `Dedicated Number` | Provision a mobile number for your account to be used as `from` address in the API | | `Send Messages` | Sending SMS or MMS messages | | `Receive Messages` | Telstra will deliver messages sent to a dedicated number or to the `notifyURL` defined by you | | `Broadcast Messages` | Invoke a single API call to send a message to a list of numbers provided in `to` | | `Delivery Status` | Query the delivery status of your messages | | `Callbacks` | Provide a notification URL and Telstra will notify your app when a message status changes | | `Alphanumeric Identifier` | Differentiate yourself by providing an alphanumeric string in `from`. This feature is only available on paid plans | | `Concatenation` | Send messages up to 1900 characters long and Telstra will automaticaly segment and reassemble them | | `Reply Request` | Create a chat session by associating `messageId` and `to` number to track responses received from a mobile number. We will store this association for 8 days | | `Character set` | Accepts all Unicode characters as part of UTF-8 | | `Bounce-back response` | See if your SMS hits an unreachable or unallocated number (Australia Only) | | `Queuing` | Messaging API will automatically queue and deliver each message at a compliant rate. | | `Emoji Encoding` | The API supports the encoding of the full range of emojis. Emojis in the reply messages will be in their UTF-8 format. | ## Delivery Notification or Callbacks The API provides several methods for notifying when a message has been delivered to the destination. 1. When you send a message there is an opportunity to specify a `notifyURL`. Once the message has been delivered the API will make a call to this URL to advise of the message status. 2. If you do not specify a URL you can always call the `GET /status` API to get the status of the message. # Getting Access to the API 1. Register at [https://dev.telstra.com](https://dev.telstra.com). 2. After registration, login to [https://dev.telstra.com](https://dev.telstra.com) and navigate to the **My apps** page. 3. Create your application by clicking the **Add new app** button 4. Select **API Free Trial** Product when configuring your application. This Product includes the Telstra Messaging API as well as other free trial APIs. Your application will be approved automatically. 5. There is a maximum of 1000 free messages per developer. Additional messages and features can be purchased from [https://dev.telstra.com](https://dev.telstra.com). 6. Note your `Client key` and `Client secret` as these will be needed to provision a number for your application and for authentication. Now head over to **Getting Started** where you can find a postman collection as well as some links to sample apps and SDKs to get you started. Happy Messaging! # Frequently Asked Questions **Q: Is creating a subscription via the Provisioning call a required step?** A. Yes. You will only be able to start sending messages if you have a provisioned dedicated number. Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: When trying to send an SMS I receive a `400 Bad Request` response. How can I fix this?** A. You need to make sure you have a provisioned dedicated number before you can send an SMS. If you do not have a provisioned dedicated number and you try to send a message via the API, you will get the error below in the response:
{   \"status\":\"400\",   \"code\":\"DELIVERY-IMPOSSIBLE\",   \"message\":\"Invalid \\'from\\' address specified\" }
Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: How long does my dedicated number stay active for?** A. When you provision a dedicated number, by default it will be active for 30 days. You can use the `activeDays` parameter during the provisioning call to increment or decrement the number of days your dedicated number will remain active. Note that Free Trial apps will have 30 days as the maximum `activeDays` they can add to their provisioned number. If the Provisioning call is made several times within that 30-Day period, it will return the `expiryDate` in the Unix format and will not add any activeDays until after that `expiryDate`. **Q: Can I send a broadcast message using the Telstra Messaging API?** A. Yes. Recipient numbers can be in the form of an array of strings if a broadcast message needs to be sent, allowing you to send to multiple mobile numbers in one API call. A sample request body for this will be: `{\"to\":[\"+61412345678\",\"+61487654321\"],\"body\":\"Test Message\"}` **Q: Can I send SMS and MMS to all countries?** A. You can send SMS and MMS to all countries EXCEPT to countries which are subject to global sanctions namely: Burma, Côte d'Ivoire, Cuba, Iran, North Korea, Syria. **Q: Can I use `Alphanumeric Identifier` from my paid plan via credit card?** A. `Alphanumeric Identifier` is only available on Telstra Account paid plans, not through credit card paid plans. **Q: What is the maximum sized MMS that I can send?** A. This will depend on the carrier that will receive the MMS. For Telstra it's up to 2MB, Optus up to 1.5MB and Vodafone only allows up to 500kB. You will need to check with international carriers for thier MMS size limits. **Q: How is the size of an MMS calculated?** A. Images are scaled up to approximately 4/3 when base64 encoded. Additionally, there is approximately 200 bytes of overhead on each MMS. Assuming the maximum MMS that can be sent on Telstra’s network is 2MB, then the maximum image size that can be sent will be approximately 1.378MB (1.378 x 1.34 + 200, without SOAP encapsulation). **Q: How is an MMS classified as Small or Large?** A. MMSes with size below 600kB are classed as Small whereas those that are bigger than 600kB are classed as Large. They will be charged accordingly. **Q: Are SMILs supported by the Messaging API?** A. While there will be no error if you send an MMS with a SMIL presentation, the actual layout or sequence defined in the SMIL may not display as expected because most of the new smartphone devices ignore the SMIL presentation layer. SMIL was used in feature phones which had limited capability and SMIL allowed a *powerpoint type* presentation to be provided. Smartphones now have the capability to display video which is the better option for presentations. It is recommended that MMS messages should just drop the SMIL. **Q: How do I assign a delivery notification or callback URL?** A. You can assign a delivery notification or callback URL by adding the `notifyURL` parameter in the body of the request when you send a message. Once the message has been delivered, a notification will then be posted to this callback URL. **Q: What is the difference between the `notifyURL` parameter in the Provisoning call versus the `notifyURL` parameter in the Send Message call?** A. The `notifyURL` in the Provisoning call will be the URL where replies to the provisioned number will be posted. On the other hand, the `notifyURL` in the Send Message call will be the URL where the delivery notification will be posted, e.g. when an SMS has already been delivered to the recipient. # Getting Started Below are the steps to get started with the Telstra Messaging API. 1. Generate an OAuth2 token using your `Client key` and `Client secret`. 2. Use the Provisioning call to create a subscription and receive a dedicated number. 3. Send a message to a specific mobile number. ## Run in Postman \"Run ## Sample Apps - [Perl Sample App](https://github.com/telstra/MessagingAPI-perl-sample-app) - [Happy Chat App](https://github.com/telstra/messaging-sample-code-happy-chat) - [PHP Sample App](https://github.com/developersteve/telstra-messaging-php) ## SDK Repos - [Messaging API - PHP SDK](https://github.com/telstra/MessagingAPI-SDK-php) - [Messaging API - Python SDK](https://github.com/telstra/MessagingAPI-SDK-python) - [Messaging API - Ruby SDK](https://github.com/telstra/MessagingAPI-SDK-ruby) - [Messaging API - NodeJS SDK](https://github.com/telstra/MessagingAPI-SDK-node) - [Messaging API - .Net2 SDK](https://github.com/telstra/MessagingAPI-SDK-dotnet) - [Messaging API - Java SDK](https://github.com/telstra/MessagingAPI-SDK-Java) ## Blog Posts For more information on the Messaging API, you can read these blog posts: - [Callbacks Part 1](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-1) - [Callbacks Part 2](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-2) +#The Telstra Messaging API specification -OpenAPI spec version: 2.2.9 +The version of the OpenAPI document: 2.2.9 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0 +OpenAPI Generator version: 4.2.3-SNAPSHOT =end @@ -20,22 +20,22 @@ class SendSMSRequest # The text body of the message. Messages longer than 160 characters will be counted as multiple messages. This field contains the message text, this can be up to 1900 (for a single recipient) or 500 (for multiple recipients) UTF-8 characters. As mobile devices rarely support the full range of UTF-8 characters, it is possible that some characters may not be translated correctly by the mobile device attr_accessor :body - # The Alphanumeric sender ID of up to 11 characters or phone number the SMS was sent from. If not present, the service will use the mobile number associated with the application (in E.164 format). This feature is only available on paid plans. + # This will be the source address that will be displayed on the receiving device. You can set an Alphanumeric sender ID of up to 11 characters that the SMS was sent from. Phone numbers in the `from` attribute will be blocked (400-error) to prevent number spoofing. Most standard ASCII characters are accepted in the alphanumeric `from` attribute, however there are some limitations. The following limitations and characters are allowed in the alphanumeric `from` attribute; any alphabetic character (e.g. `abc`), any number mixed with alphabetic characters (e.g. `123abc`), uppercase and lowercase characters (e.g. `aBc`), any of the following special characters mixed with alphabetic characters are allowed; `~!@#$%^&*()~_~+-={}|[];'?,./` (e.g. `abc~!@`), any combination of lowercase, uppercase, numeric or allowed special characters (e.g. `abc@#123DE`). All other characters, including spaces and extended ASCII characters, are not allowed (e.g. `<>:\"\\`). If attribute is not present, the service will use the mobile number associated with the application (in E.164 format). If `replyRequest` is set to true, then this field should not be present. This feature is only available on Telstra Account paid plans, not through Free Trials or credit card paid plans. *Please note that Alphanumeric sender ID works for domestic, i.e. Australian, destinations only.* attr_accessor :from - # How long the platform should attempt to deliver the message for. This period is specified in minutes from the message. Normally if the message cannot be delivered immediately, it will be stored and delivery will be periodically reattempted. The network will attempt to send the message for up to seven days. It is possible to define a period smaller than 7 days by including this parameter and specifying the number of minutes that delivery should be attempted. eg: including `\"validity\": 60` will specify that if a message can't be delivered within the first 60 minutes them the network should stop. + # How long the platform should attempt to deliver the message for. This period is specified in minutes from the message. Normally if the message cannot be delivered immediately, it will be stored and delivery will be periodically reattempted. The network will attempt to send the message for up to seven days. It is possible to define a period smaller than 7 days by including this parameter and specifying the number of minutes that delivery should be attempted. e.g.: including `\"validity\": 60` will specify that if a message can't be delivered within the first 60 minutes then the network should stop. attr_accessor :validity - # How long the platform should wait before attempting to send the message - specified in minutes. e.g.: If `\"scheduledDelivery\": 120` is included, then the network will not attempt to start message delivery for two hours after the message has been submitted + # How long the platform should wait before attempting to send the message - specified in minutes. e.g.: If `\"scheduledDelivery\": 120` is included, then the network will not attempt to start message delivery for two hours after the message has been submitted attr_accessor :scheduled_delivery - # Contains a URL that will be called once your message has been processed. The status may be delivered, expired, deleted, etc. It is possible for the network to make a call to a URL when the message has been delivered (or has expired), different URLs can be set per message. Please refer to the Delivery Notification section. + # Contains a URL that will be called once your message has been processed. The status may be delivered, expired, deleted, etc. Please refer to the Delivery Status section for more information. If you are using a domain URL you must include the forward slash at the end of the URL (e.g. http://www.example.com/). attr_accessor :notify_url - # If set to true, the reply message functionality will be implemented and the to address will be ignored if present. If false or not present, then normal message handling is implemented. When set to true, network will use a temporary number to deliver this message. All messages sent by mobile to this temporary number will be stored against the same `messageId`. If a `notifyURL` is provided then user response will be delivered to the URL where `messageId` will be same as `messageId` in reponse to original API request. This field contains the message text, this can be up to 500 UTF-8 characters. As mobile devices rarely support the full range of UTF-8 characters, it is possible that some characters may not be translated correctly by the mobile device. + # If set to true, the reply message functionality will be implemented. The `from` field should not be present. If false or not present, then normal message handling is implemented. When set to true, network will use a temporary number to deliver this message. All messages sent by a mobile to this temporary number will be stored against the same `messageId`. If a `notifyURL` is provided then user replies will be delivered to the URL where `messageId` will be same as `messageId` in the response to the original API request. This field contains the message text, this can be up to 500 UTF-8 characters. As mobile devices rarely support the full range of UTF-8 characters, it is possible that some characters may not be translated correctly by the mobile device. attr_accessor :reply_request - # When messages are queued up for a number, then it is possible to set where a new message will be placed in the queue. If the priority is set to true then the new message will be placed ahead of all messages with a normal priority. If there are no messages queued for the number, then this parameter has no effect. + # When messages are queued up for a number, then it is possible to set where a new message will be placed in the queue. If the priority is set to true then the new message will be placed ahead of all messages with a normal priority. If there are no messages queued for the number, then this parameter has no effect. attr_accessor :priority # Attribute mapping from ruby-style variable name to JSON key. @@ -61,48 +61,61 @@ def self.openapi_types :'validity' => :'Integer', :'scheduled_delivery' => :'Integer', :'notify_url' => :'String', - :'reply_request' => :'BOOLEAN', - :'priority' => :'BOOLEAN' + :'reply_request' => :'Boolean', + :'priority' => :'Boolean' } end + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - return unless attributes.is_a?(Hash) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Telstra_Messaging::SendSMSRequest` initialize method" + end - # convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Telstra_Messaging::SendSMSRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } - if attributes.has_key?(:'to') + if attributes.key?(:'to') self.to = attributes[:'to'] end - if attributes.has_key?(:'body') + if attributes.key?(:'body') self.body = attributes[:'body'] end - if attributes.has_key?(:'from') + if attributes.key?(:'from') self.from = attributes[:'from'] end - if attributes.has_key?(:'validity') + if attributes.key?(:'validity') self.validity = attributes[:'validity'] end - if attributes.has_key?(:'scheduledDelivery') - self.scheduled_delivery = attributes[:'scheduledDelivery'] + if attributes.key?(:'scheduled_delivery') + self.scheduled_delivery = attributes[:'scheduled_delivery'] end - if attributes.has_key?(:'notifyURL') - self.notify_url = attributes[:'notifyURL'] + if attributes.key?(:'notify_url') + self.notify_url = attributes[:'notify_url'] end - if attributes.has_key?(:'replyRequest') - self.reply_request = attributes[:'replyRequest'] + if attributes.key?(:'reply_request') + self.reply_request = attributes[:'reply_request'] end - if attributes.has_key?(:'priority') + if attributes.key?(:'priority') self.priority = attributes[:'priority'] end end @@ -152,11 +165,18 @@ def eql?(o) end # Calculates hash code according to all attributes. - # @return [Fixnum] Hash code + # @return [Integer] Hash code def hash [to, body, from, validity, scheduled_delivery, notify_url, reply_request, priority].hash end + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself @@ -164,7 +184,7 @@ def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.openapi_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the the attribute + # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) @@ -193,7 +213,7 @@ def _deserialize(type, value) value.to_i when :Float value.to_f - when :BOOLEAN + when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else @@ -214,8 +234,7 @@ def _deserialize(type, value) end end else # model - temp_model = Telstra_Messaging.const_get(type).new - temp_model.build_from_hash(value) + Telstra_Messaging.const_get(type).build_from_hash(value) end end @@ -237,7 +256,11 @@ def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) - next if value.nil? + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + hash[param] = _to_hash(value) end hash diff --git a/lib/Telstra_Messaging/models/status.rb b/lib/Telstra_Messaging/models/status.rb index 9872527..e7b40a8 100644 --- a/lib/Telstra_Messaging/models/status.rb +++ b/lib/Telstra_Messaging/models/status.rb @@ -1,12 +1,12 @@ =begin #Telstra Messaging API -# # Introduction

Send and receive SMS and MMS messages globally using Telstra's enterprise grade Messaging API. It also allows your application to track the delivery status of both sent and received messages. Get your dedicated Australian number, and start sending and receiving messages today.

# Features The Telstra Messaging API provides the features below. | Feature | Description | | --- | --- | | `Dedicated Number` | Provision a mobile number for your account to be used as `from` address in the API | | `Send Messages` | Sending SMS or MMS messages | | `Receive Messages` | Telstra will deliver messages sent to a dedicated number or to the `notifyURL` defined by you | | `Broadcast Messages` | Invoke a single API call to send a message to a list of numbers provided in `to` | | `Delivery Status` | Query the delivery status of your messages | | `Callbacks` | Provide a notification URL and Telstra will notify your app when a message status changes | | `Alphanumeric Identifier` | Differentiate yourself by providing an alphanumeric string in `from`. This feature is only available on paid plans | | `Concatenation` | Send messages up to 1900 characters long and Telstra will automaticaly segment and reassemble them | | `Reply Request` | Create a chat session by associating `messageId` and `to` number to track responses received from a mobile number. We will store this association for 8 days | | `Character set` | Accepts all Unicode characters as part of UTF-8 | | `Bounce-back response` | See if your SMS hits an unreachable or unallocated number (Australia Only) | | `Queuing` | Messaging API will automatically queue and deliver each message at a compliant rate. | | `Emoji Encoding` | The API supports the encoding of the full range of emojis. Emojis in the reply messages will be in their UTF-8 format. | ## Delivery Notification or Callbacks The API provides several methods for notifying when a message has been delivered to the destination. 1. When you send a message there is an opportunity to specify a `notifyURL`. Once the message has been delivered the API will make a call to this URL to advise of the message status. 2. If you do not specify a URL you can always call the `GET /status` API to get the status of the message. # Getting Access to the API 1. Register at [https://dev.telstra.com](https://dev.telstra.com). 2. After registration, login to [https://dev.telstra.com](https://dev.telstra.com) and navigate to the **My apps** page. 3. Create your application by clicking the **Add new app** button 4. Select **API Free Trial** Product when configuring your application. This Product includes the Telstra Messaging API as well as other free trial APIs. Your application will be approved automatically. 5. There is a maximum of 1000 free messages per developer. Additional messages and features can be purchased from [https://dev.telstra.com](https://dev.telstra.com). 6. Note your `Client key` and `Client secret` as these will be needed to provision a number for your application and for authentication. Now head over to **Getting Started** where you can find a postman collection as well as some links to sample apps and SDKs to get you started. Happy Messaging! # Frequently Asked Questions **Q: Is creating a subscription via the Provisioning call a required step?** A. Yes. You will only be able to start sending messages if you have a provisioned dedicated number. Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: When trying to send an SMS I receive a `400 Bad Request` response. How can I fix this?** A. You need to make sure you have a provisioned dedicated number before you can send an SMS. If you do not have a provisioned dedicated number and you try to send a message via the API, you will get the error below in the response:
{   \"status\":\"400\",   \"code\":\"DELIVERY-IMPOSSIBLE\",   \"message\":\"Invalid \\'from\\' address specified\" }
Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: How long does my dedicated number stay active for?** A. When you provision a dedicated number, by default it will be active for 30 days. You can use the `activeDays` parameter during the provisioning call to increment or decrement the number of days your dedicated number will remain active. Note that Free Trial apps will have 30 days as the maximum `activeDays` they can add to their provisioned number. If the Provisioning call is made several times within that 30-Day period, it will return the `expiryDate` in the Unix format and will not add any activeDays until after that `expiryDate`. **Q: Can I send a broadcast message using the Telstra Messaging API?** A. Yes. Recipient numbers can be in the form of an array of strings if a broadcast message needs to be sent, allowing you to send to multiple mobile numbers in one API call. A sample request body for this will be: `{\"to\":[\"+61412345678\",\"+61487654321\"],\"body\":\"Test Message\"}` **Q: Can I send SMS and MMS to all countries?** A. You can send SMS and MMS to all countries EXCEPT to countries which are subject to global sanctions namely: Burma, Côte d'Ivoire, Cuba, Iran, North Korea, Syria. **Q: Can I use `Alphanumeric Identifier` from my paid plan via credit card?** A. `Alphanumeric Identifier` is only available on Telstra Account paid plans, not through credit card paid plans. **Q: What is the maximum sized MMS that I can send?** A. This will depend on the carrier that will receive the MMS. For Telstra it's up to 2MB, Optus up to 1.5MB and Vodafone only allows up to 500kB. You will need to check with international carriers for thier MMS size limits. **Q: How is the size of an MMS calculated?** A. Images are scaled up to approximately 4/3 when base64 encoded. Additionally, there is approximately 200 bytes of overhead on each MMS. Assuming the maximum MMS that can be sent on Telstra’s network is 2MB, then the maximum image size that can be sent will be approximately 1.378MB (1.378 x 1.34 + 200, without SOAP encapsulation). **Q: How is an MMS classified as Small or Large?** A. MMSes with size below 600kB are classed as Small whereas those that are bigger than 600kB are classed as Large. They will be charged accordingly. **Q: Are SMILs supported by the Messaging API?** A. While there will be no error if you send an MMS with a SMIL presentation, the actual layout or sequence defined in the SMIL may not display as expected because most of the new smartphone devices ignore the SMIL presentation layer. SMIL was used in feature phones which had limited capability and SMIL allowed a *powerpoint type* presentation to be provided. Smartphones now have the capability to display video which is the better option for presentations. It is recommended that MMS messages should just drop the SMIL. **Q: How do I assign a delivery notification or callback URL?** A. You can assign a delivery notification or callback URL by adding the `notifyURL` parameter in the body of the request when you send a message. Once the message has been delivered, a notification will then be posted to this callback URL. **Q: What is the difference between the `notifyURL` parameter in the Provisoning call versus the `notifyURL` parameter in the Send Message call?** A. The `notifyURL` in the Provisoning call will be the URL where replies to the provisioned number will be posted. On the other hand, the `notifyURL` in the Send Message call will be the URL where the delivery notification will be posted, e.g. when an SMS has already been delivered to the recipient. # Getting Started Below are the steps to get started with the Telstra Messaging API. 1. Generate an OAuth2 token using your `Client key` and `Client secret`. 2. Use the Provisioning call to create a subscription and receive a dedicated number. 3. Send a message to a specific mobile number. ## Run in Postman \"Run ## Sample Apps - [Perl Sample App](https://github.com/telstra/MessagingAPI-perl-sample-app) - [Happy Chat App](https://github.com/telstra/messaging-sample-code-happy-chat) - [PHP Sample App](https://github.com/developersteve/telstra-messaging-php) ## SDK Repos - [Messaging API - PHP SDK](https://github.com/telstra/MessagingAPI-SDK-php) - [Messaging API - Python SDK](https://github.com/telstra/MessagingAPI-SDK-python) - [Messaging API - Ruby SDK](https://github.com/telstra/MessagingAPI-SDK-ruby) - [Messaging API - NodeJS SDK](https://github.com/telstra/MessagingAPI-SDK-node) - [Messaging API - .Net2 SDK](https://github.com/telstra/MessagingAPI-SDK-dotnet) - [Messaging API - Java SDK](https://github.com/telstra/MessagingAPI-SDK-Java) ## Blog Posts For more information on the Messaging API, you can read these blog posts: - [Callbacks Part 1](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-1) - [Callbacks Part 2](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-2) +#The Telstra Messaging API specification -OpenAPI spec version: 2.2.9 +The version of the OpenAPI document: 2.2.9 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0 +OpenAPI Generator version: 4.2.3-SNAPSHOT =end @@ -14,15 +14,21 @@ module Telstra_Messaging class Status - - PEND = 'PEND'.freeze - SENT = 'SENT'.freeze - DELIVRD = 'DELIVRD'.freeze - EXPIRED = 'EXPIRED'.freeze - DELETED = 'DELETED'.freeze - UNDVBL = 'UNDVBL'.freeze - REJECTED = 'REJECTED'.freeze - READ = 'READ'.freeze + PEND = "PEND".freeze + SENT = "SENT".freeze + DELIVRD = "DELIVRD".freeze + EXPIRED = "EXPIRED".freeze + DELETED = "DELETED".freeze + UNDVBL = "UNDVBL".freeze + REJECTD = "REJECTD".freeze + UNKNOWN = "Unknown".freeze + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end # Builds the enum from string # @param [String] The enum value in the form of the string diff --git a/lib/Telstra_Messaging/version.rb b/lib/Telstra_Messaging/version.rb index 3ad558b..4c27990 100644 --- a/lib/Telstra_Messaging/version.rb +++ b/lib/Telstra_Messaging/version.rb @@ -1,15 +1,15 @@ =begin #Telstra Messaging API -# # Introduction

Send and receive SMS and MMS messages globally using Telstra's enterprise grade Messaging API. It also allows your application to track the delivery status of both sent and received messages. Get your dedicated Australian number, and start sending and receiving messages today.

# Features The Telstra Messaging API provides the features below. | Feature | Description | | --- | --- | | `Dedicated Number` | Provision a mobile number for your account to be used as `from` address in the API | | `Send Messages` | Sending SMS or MMS messages | | `Receive Messages` | Telstra will deliver messages sent to a dedicated number or to the `notifyURL` defined by you | | `Broadcast Messages` | Invoke a single API call to send a message to a list of numbers provided in `to` | | `Delivery Status` | Query the delivery status of your messages | | `Callbacks` | Provide a notification URL and Telstra will notify your app when a message status changes | | `Alphanumeric Identifier` | Differentiate yourself by providing an alphanumeric string in `from`. This feature is only available on paid plans | | `Concatenation` | Send messages up to 1900 characters long and Telstra will automaticaly segment and reassemble them | | `Reply Request` | Create a chat session by associating `messageId` and `to` number to track responses received from a mobile number. We will store this association for 8 days | | `Character set` | Accepts all Unicode characters as part of UTF-8 | | `Bounce-back response` | See if your SMS hits an unreachable or unallocated number (Australia Only) | | `Queuing` | Messaging API will automatically queue and deliver each message at a compliant rate. | | `Emoji Encoding` | The API supports the encoding of the full range of emojis. Emojis in the reply messages will be in their UTF-8 format. | ## Delivery Notification or Callbacks The API provides several methods for notifying when a message has been delivered to the destination. 1. When you send a message there is an opportunity to specify a `notifyURL`. Once the message has been delivered the API will make a call to this URL to advise of the message status. 2. If you do not specify a URL you can always call the `GET /status` API to get the status of the message. # Getting Access to the API 1. Register at [https://dev.telstra.com](https://dev.telstra.com). 2. After registration, login to [https://dev.telstra.com](https://dev.telstra.com) and navigate to the **My apps** page. 3. Create your application by clicking the **Add new app** button 4. Select **API Free Trial** Product when configuring your application. This Product includes the Telstra Messaging API as well as other free trial APIs. Your application will be approved automatically. 5. There is a maximum of 1000 free messages per developer. Additional messages and features can be purchased from [https://dev.telstra.com](https://dev.telstra.com). 6. Note your `Client key` and `Client secret` as these will be needed to provision a number for your application and for authentication. Now head over to **Getting Started** where you can find a postman collection as well as some links to sample apps and SDKs to get you started. Happy Messaging! # Frequently Asked Questions **Q: Is creating a subscription via the Provisioning call a required step?** A. Yes. You will only be able to start sending messages if you have a provisioned dedicated number. Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: When trying to send an SMS I receive a `400 Bad Request` response. How can I fix this?** A. You need to make sure you have a provisioned dedicated number before you can send an SMS. If you do not have a provisioned dedicated number and you try to send a message via the API, you will get the error below in the response:
{   \"status\":\"400\",   \"code\":\"DELIVERY-IMPOSSIBLE\",   \"message\":\"Invalid \\'from\\' address specified\" }
Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: How long does my dedicated number stay active for?** A. When you provision a dedicated number, by default it will be active for 30 days. You can use the `activeDays` parameter during the provisioning call to increment or decrement the number of days your dedicated number will remain active. Note that Free Trial apps will have 30 days as the maximum `activeDays` they can add to their provisioned number. If the Provisioning call is made several times within that 30-Day period, it will return the `expiryDate` in the Unix format and will not add any activeDays until after that `expiryDate`. **Q: Can I send a broadcast message using the Telstra Messaging API?** A. Yes. Recipient numbers can be in the form of an array of strings if a broadcast message needs to be sent, allowing you to send to multiple mobile numbers in one API call. A sample request body for this will be: `{\"to\":[\"+61412345678\",\"+61487654321\"],\"body\":\"Test Message\"}` **Q: Can I send SMS and MMS to all countries?** A. You can send SMS and MMS to all countries EXCEPT to countries which are subject to global sanctions namely: Burma, Côte d'Ivoire, Cuba, Iran, North Korea, Syria. **Q: Can I use `Alphanumeric Identifier` from my paid plan via credit card?** A. `Alphanumeric Identifier` is only available on Telstra Account paid plans, not through credit card paid plans. **Q: What is the maximum sized MMS that I can send?** A. This will depend on the carrier that will receive the MMS. For Telstra it's up to 2MB, Optus up to 1.5MB and Vodafone only allows up to 500kB. You will need to check with international carriers for thier MMS size limits. **Q: How is the size of an MMS calculated?** A. Images are scaled up to approximately 4/3 when base64 encoded. Additionally, there is approximately 200 bytes of overhead on each MMS. Assuming the maximum MMS that can be sent on Telstra’s network is 2MB, then the maximum image size that can be sent will be approximately 1.378MB (1.378 x 1.34 + 200, without SOAP encapsulation). **Q: How is an MMS classified as Small or Large?** A. MMSes with size below 600kB are classed as Small whereas those that are bigger than 600kB are classed as Large. They will be charged accordingly. **Q: Are SMILs supported by the Messaging API?** A. While there will be no error if you send an MMS with a SMIL presentation, the actual layout or sequence defined in the SMIL may not display as expected because most of the new smartphone devices ignore the SMIL presentation layer. SMIL was used in feature phones which had limited capability and SMIL allowed a *powerpoint type* presentation to be provided. Smartphones now have the capability to display video which is the better option for presentations. It is recommended that MMS messages should just drop the SMIL. **Q: How do I assign a delivery notification or callback URL?** A. You can assign a delivery notification or callback URL by adding the `notifyURL` parameter in the body of the request when you send a message. Once the message has been delivered, a notification will then be posted to this callback URL. **Q: What is the difference between the `notifyURL` parameter in the Provisoning call versus the `notifyURL` parameter in the Send Message call?** A. The `notifyURL` in the Provisoning call will be the URL where replies to the provisioned number will be posted. On the other hand, the `notifyURL` in the Send Message call will be the URL where the delivery notification will be posted, e.g. when an SMS has already been delivered to the recipient. # Getting Started Below are the steps to get started with the Telstra Messaging API. 1. Generate an OAuth2 token using your `Client key` and `Client secret`. 2. Use the Provisioning call to create a subscription and receive a dedicated number. 3. Send a message to a specific mobile number. ## Run in Postman \"Run ## Sample Apps - [Perl Sample App](https://github.com/telstra/MessagingAPI-perl-sample-app) - [Happy Chat App](https://github.com/telstra/messaging-sample-code-happy-chat) - [PHP Sample App](https://github.com/developersteve/telstra-messaging-php) ## SDK Repos - [Messaging API - PHP SDK](https://github.com/telstra/MessagingAPI-SDK-php) - [Messaging API - Python SDK](https://github.com/telstra/MessagingAPI-SDK-python) - [Messaging API - Ruby SDK](https://github.com/telstra/MessagingAPI-SDK-ruby) - [Messaging API - NodeJS SDK](https://github.com/telstra/MessagingAPI-SDK-node) - [Messaging API - .Net2 SDK](https://github.com/telstra/MessagingAPI-SDK-dotnet) - [Messaging API - Java SDK](https://github.com/telstra/MessagingAPI-SDK-Java) ## Blog Posts For more information on the Messaging API, you can read these blog posts: - [Callbacks Part 1](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-1) - [Callbacks Part 2](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-2) +#The Telstra Messaging API specification -OpenAPI spec version: 2.2.9 +The version of the OpenAPI document: 2.2.9 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0 +OpenAPI Generator version: 4.2.3-SNAPSHOT =end module Telstra_Messaging - VERSION = '1.0.6' + VERSION = '1.0.8' end diff --git a/spec/api/authentication_api_spec.rb b/spec/api/authentication_api_spec.rb index 339d68c..c869955 100644 --- a/spec/api/authentication_api_spec.rb +++ b/spec/api/authentication_api_spec.rb @@ -1,12 +1,12 @@ =begin #Telstra Messaging API -# # Introduction Send and receive SMS and MMS messages globally using Telstra’s enterprise grade Messaging API. It also allows your application to track the delivery status of both sent and received messages. Get your dedicated Australian number, and start sending and receiving messages today. # Features The Telstra Messaging API provides the features below. | Feature | Description | | --- | --- | | `Dedicated Number` | Provision a mobile number for your account to be used as `from` address in the API | | `Send Messages` | Sending SMS or MMS messages | | `Receive Messages` | Telstra will deliver messages sent to a dedicated number or to the `notifyURL` defined by you | | `Broadcast Messages` | Invoke a single API call to send a message to a list of numbers provided in `to` | | `Delivery Status` | Query the delivery status of your messages | | `Callbacks` | Provide a notification URL and Telstra will notify your app when a message status changes | | `Alphanumeric Identifier` | Differentiate yourself by providing an alphanumeric string in `from`. This feature is only available on paid plans | | `Concatenation` | Send messages up to 1900 characters long and Telstra will automaticaly segment and reassemble them | | `Reply Request` | Create a chat session by associating `messageId` and `to` number to track responses received from a mobile number. We will store this association for 8 days | | `Character set` | Accepts all Unicode characters as part of UTF-8 | | `Bounce-back response` | See if your SMS hits an unreachable or unallocated number (Australia Only) | | `Queuing` | Messaging API will automatically queue and deliver each message at a compliant rate. | | `Emoji Encoding` | The API supports the encoding of the full range of emojis. Emojis in the reply messages will be in their UTF-8 format. | ## Delivery Notification or Callbacks The API provides several methods for notifying when a message has been delivered to the destination. 1. When you send a message there is an opportunity to specify a `notifyURL`. Once the message has been delivered the API will make a call to this URL to advise of the message status. 2. If you do not specify a URL you can always call the `GET /status` API to get the status of the message. # Getting Access to the API 1. Register at [https://dev.telstra.com](https://dev.telstra.com). 2. After registration, login to [https://dev.telstra.com](https://dev.telstra.com) and navigate to the **My apps** page. 3. Create your application by clicking the **Add new app** button 4. Select **API Free Trial** Product when configuring your application. This Product includes the Telstra Messaging API as well as other free trial APIs. Your application will be approved automatically. 5. There is a maximum of 1000 free messages per developer. Additional messages and features can be purchased from [https://dev.telstra.com](https://dev.telstra.com). 6. Note your `Client key` and `Client secret` as these will be needed to provision a number for your application and for authentication. Now head over to **Getting Started** where you can find a postman collection as well as some links to sample apps and SDKs to get you started. Happy Messaging! # Frequently Asked Questions **Q: Is creating a subscription via the Provisioning call a required step?** A. Yes. You will only be able to start sending messages if you have a provisioned dedicated number. Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: When trying to send an SMS I receive a `400 Bad Request` response. How can I fix this?** A. You need to make sure you have a provisioned dedicated number before you can send an SMS. If you do not have a provisioned dedicated number and you try to send a message via the API, you will get the error below in the response:
{   \"status\":\"400\",   \"code\":\"DELIVERY-IMPOSSIBLE\",   \"message\":\"Invalid \\'from\\' address specified\" }
Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: Can I send a broadcast message using the Telstra Messaging API?** A. Yes. Recipient numbers can be in the form of an array of strings if a broadcast message needs to be sent, allowing you to send to multiple mobile numbers in one API call. A sample request body for this will be: `{\"to\":[\"+61412345678\",\"+61487654321\"],\"body\":\"Test Message\"}` **Q: Can I use `Alphanumeric Identifier` from my paid plan via credit card?** A. `Alphanumeric Identifier` is only available on Telstra Account paid plans, not through credit card paid plans. **Q: How long does my dedicated number stay active for?** A. When you provision a dedicated number, by default it will be active for 30-days. You can use the `activeDays` parameter during the provisioning call to increment or decrement the number of days your dedicated number will remain active. **Q: What is the maximum sized MMS that I can send?** A. This will depend on the carrier that will receive the MMS. For Telstra it's up to 2MB, Optus up to 1.5MB and Vodafone only allows up to 500kB. You will need to check with international carriers for thier MMS size limits. **Q: Are SMILs supported by the Messaging API?** A. While there will be no error if you send an MMS with a SMIL presentation, the actual layout or sequence defined in the SMIL may not display as expected because most of the new smartphone devices ignore the SMIL presentation layer. SMIL was used in feature phones which had limited capability and SMIL allowed a *powerpoint type* presentation to be provided. Smartphones now have the capability to display video which is the better option for presentations. It is recommended that MMS messages should just drop the SMIL. **Q: How do I assign a delivery notification or callback URL?** A. You can assign a delivery notification or callback URL by adding the `notifyURL` parameter in the body of the request when you send a message. Once the message has been delivered, a notification will then be posted to this callback URL. **Q: What is the difference between the `notifyURL` parameter in the Provisoning call versus the `notifyURL` parameter in the Send Message call?** A. The `notifyURL` in the Provisoning call will be the URL where replies to the provisioned number will be posted. On the other hand, the `notifyURL` in the Send Message call will be the URL where the delivery notification will be posted, e.g. when an SMS has already been delivered to the recipient. # Getting Started Below are the steps to get started with the Telstra Messaging API. 1. Generate an OAuth2 token using your `Client key` and `Client secret`. 2. Use the Provisioning call to create a subscription and receive a dedicated number. 3. Send a message to a specific mobile number. ## Run in Postman \"Run ## Sample Apps - [Perl Sample App](https://github.com/telstra/MessagingAPI-perl-sample-app) - [Happy Chat App](https://github.com/telstra/messaging-sample-code-happy-chat) - [PHP Sample App](https://github.com/developersteve/telstra-messaging-php) ## SDK Repos - [Messaging API - PHP SDK](https://github.com/telstra/MessagingAPI-SDK-php) - [Messaging API - Python SDK](https://github.com/telstra/MessagingAPI-SDK-python) - [Messaging API - Ruby SDK](https://github.com/telstra/MessagingAPI-SDK-ruby) - [Messaging API - NodeJS SDK](https://github.com/telstra/MessagingAPI-SDK-node) - [Messaging API - .Net2 SDK](https://github.com/telstra/MessagingAPI-SDK-dotnet) - [Messaging API - Java SDK](https://github.com/telstra/MessagingAPI-SDK-Java) ## Blog Posts For more information on the Messaging API, you can read these blog posts: - [Callbacks Part 1](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-1) - [Callbacks Part 2](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-2) +#The Telstra Messaging API specification -OpenAPI spec version: 2.2.6 +The version of the OpenAPI document: 2.2.9 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.0.1 +OpenAPI Generator version: 4.2.3-SNAPSHOT =end @@ -19,7 +19,7 @@ describe 'AuthenticationApi' do before do # run before each test - @instance = Telstra_Messaging::AuthenticationApi.new + @api_instance = Telstra_Messaging::AuthenticationApi.new end after do @@ -28,17 +28,18 @@ describe 'test an instance of AuthenticationApi' do it 'should create an instance of AuthenticationApi' do - expect(@instance).to be_instance_of(Telstra_Messaging::AuthenticationApi) + expect(@api_instance).to be_instance_of(Telstra_Messaging::AuthenticationApi) end end # unit tests for auth_token # Generate OAuth2 token - # To generate an OAuth2 Authentication token, pass through your `Client key` and `Client secret` that you received when you registered for the **API Free Trial** Product. The grant_type should be left as `client_credentials` and the scope as `NSMS`. The token will expire in one hour. + # To generate an OAuth2 Authentication token, pass through your `Client key` and `Client secret` that you received when you registered for the **API Free Trial** Product. The grant_type should be left as `client_credentials` and the scope as `NSMS`. The token will expire in one hour. # @param client_id # @param client_secret # @param grant_type # @param [Hash] opts the optional parameters + # @option opts [String] :scope NSMS # @return [OAuthResponse] describe 'auth_token test' do it 'should work' do diff --git a/spec/api/messaging_api_spec.rb b/spec/api/messaging_api_spec.rb index 2715aaf..e9f137e 100644 --- a/spec/api/messaging_api_spec.rb +++ b/spec/api/messaging_api_spec.rb @@ -1,12 +1,12 @@ =begin #Telstra Messaging API -# # Introduction Send and receive SMS and MMS messages globally using Telstra’s enterprise grade Messaging API. It also allows your application to track the delivery status of both sent and received messages. Get your dedicated Australian number, and start sending and receiving messages today. # Features The Telstra Messaging API provides the features below. | Feature | Description | | --- | --- | | `Dedicated Number` | Provision a mobile number for your account to be used as `from` address in the API | | `Send Messages` | Sending SMS or MMS messages | | `Receive Messages` | Telstra will deliver messages sent to a dedicated number or to the `notifyURL` defined by you | | `Broadcast Messages` | Invoke a single API call to send a message to a list of numbers provided in `to` | | `Delivery Status` | Query the delivery status of your messages | | `Callbacks` | Provide a notification URL and Telstra will notify your app when a message status changes | | `Alphanumeric Identifier` | Differentiate yourself by providing an alphanumeric string in `from`. This feature is only available on paid plans | | `Concatenation` | Send messages up to 1900 characters long and Telstra will automaticaly segment and reassemble them | | `Reply Request` | Create a chat session by associating `messageId` and `to` number to track responses received from a mobile number. We will store this association for 8 days | | `Character set` | Accepts all Unicode characters as part of UTF-8 | | `Bounce-back response` | See if your SMS hits an unreachable or unallocated number (Australia Only) | | `Queuing` | Messaging API will automatically queue and deliver each message at a compliant rate. | | `Emoji Encoding` | The API supports the encoding of the full range of emojis. Emojis in the reply messages will be in their UTF-8 format. | ## Delivery Notification or Callbacks The API provides several methods for notifying when a message has been delivered to the destination. 1. When you send a message there is an opportunity to specify a `notifyURL`. Once the message has been delivered the API will make a call to this URL to advise of the message status. 2. If you do not specify a URL you can always call the `GET /status` API to get the status of the message. # Getting Access to the API 1. Register at [https://dev.telstra.com](https://dev.telstra.com). 2. After registration, login to [https://dev.telstra.com](https://dev.telstra.com) and navigate to the **My apps** page. 3. Create your application by clicking the **Add new app** button 4. Select **API Free Trial** Product when configuring your application. This Product includes the Telstra Messaging API as well as other free trial APIs. Your application will be approved automatically. 5. There is a maximum of 1000 free messages per developer. Additional messages and features can be purchased from [https://dev.telstra.com](https://dev.telstra.com). 6. Note your `Client key` and `Client secret` as these will be needed to provision a number for your application and for authentication. Now head over to **Getting Started** where you can find a postman collection as well as some links to sample apps and SDKs to get you started. Happy Messaging! # Frequently Asked Questions **Q: Is creating a subscription via the Provisioning call a required step?** A. Yes. You will only be able to start sending messages if you have a provisioned dedicated number. Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: When trying to send an SMS I receive a `400 Bad Request` response. How can I fix this?** A. You need to make sure you have a provisioned dedicated number before you can send an SMS. If you do not have a provisioned dedicated number and you try to send a message via the API, you will get the error below in the response:
{   \"status\":\"400\",   \"code\":\"DELIVERY-IMPOSSIBLE\",   \"message\":\"Invalid \\'from\\' address specified\" }
Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: Can I send a broadcast message using the Telstra Messaging API?** A. Yes. Recipient numbers can be in the form of an array of strings if a broadcast message needs to be sent, allowing you to send to multiple mobile numbers in one API call. A sample request body for this will be: `{\"to\":[\"+61412345678\",\"+61487654321\"],\"body\":\"Test Message\"}` **Q: Can I use `Alphanumeric Identifier` from my paid plan via credit card?** A. `Alphanumeric Identifier` is only available on Telstra Account paid plans, not through credit card paid plans. **Q: How long does my dedicated number stay active for?** A. When you provision a dedicated number, by default it will be active for 30-days. You can use the `activeDays` parameter during the provisioning call to increment or decrement the number of days your dedicated number will remain active. **Q: What is the maximum sized MMS that I can send?** A. This will depend on the carrier that will receive the MMS. For Telstra it's up to 2MB, Optus up to 1.5MB and Vodafone only allows up to 500kB. You will need to check with international carriers for thier MMS size limits. **Q: Are SMILs supported by the Messaging API?** A. While there will be no error if you send an MMS with a SMIL presentation, the actual layout or sequence defined in the SMIL may not display as expected because most of the new smartphone devices ignore the SMIL presentation layer. SMIL was used in feature phones which had limited capability and SMIL allowed a *powerpoint type* presentation to be provided. Smartphones now have the capability to display video which is the better option for presentations. It is recommended that MMS messages should just drop the SMIL. **Q: How do I assign a delivery notification or callback URL?** A. You can assign a delivery notification or callback URL by adding the `notifyURL` parameter in the body of the request when you send a message. Once the message has been delivered, a notification will then be posted to this callback URL. **Q: What is the difference between the `notifyURL` parameter in the Provisoning call versus the `notifyURL` parameter in the Send Message call?** A. The `notifyURL` in the Provisoning call will be the URL where replies to the provisioned number will be posted. On the other hand, the `notifyURL` in the Send Message call will be the URL where the delivery notification will be posted, e.g. when an SMS has already been delivered to the recipient. # Getting Started Below are the steps to get started with the Telstra Messaging API. 1. Generate an OAuth2 token using your `Client key` and `Client secret`. 2. Use the Provisioning call to create a subscription and receive a dedicated number. 3. Send a message to a specific mobile number. ## Run in Postman \"Run ## Sample Apps - [Perl Sample App](https://github.com/telstra/MessagingAPI-perl-sample-app) - [Happy Chat App](https://github.com/telstra/messaging-sample-code-happy-chat) - [PHP Sample App](https://github.com/developersteve/telstra-messaging-php) ## SDK Repos - [Messaging API - PHP SDK](https://github.com/telstra/MessagingAPI-SDK-php) - [Messaging API - Python SDK](https://github.com/telstra/MessagingAPI-SDK-python) - [Messaging API - Ruby SDK](https://github.com/telstra/MessagingAPI-SDK-ruby) - [Messaging API - NodeJS SDK](https://github.com/telstra/MessagingAPI-SDK-node) - [Messaging API - .Net2 SDK](https://github.com/telstra/MessagingAPI-SDK-dotnet) - [Messaging API - Java SDK](https://github.com/telstra/MessagingAPI-SDK-Java) ## Blog Posts For more information on the Messaging API, you can read these blog posts: - [Callbacks Part 1](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-1) - [Callbacks Part 2](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-2) +#The Telstra Messaging API specification -OpenAPI spec version: 2.2.6 +The version of the OpenAPI document: 2.2.9 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.0.1 +OpenAPI Generator version: 4.2.3-SNAPSHOT =end @@ -19,7 +19,7 @@ describe 'MessagingApi' do before do # run before each test - @instance = Telstra_Messaging::MessagingApi.new + @api_instance = Telstra_Messaging::MessagingApi.new end after do @@ -28,14 +28,14 @@ describe 'test an instance of MessagingApi' do it 'should create an instance of MessagingApi' do - expect(@instance).to be_instance_of(Telstra_Messaging::MessagingApi) + expect(@api_instance).to be_instance_of(Telstra_Messaging::MessagingApi) end end # unit tests for get_mms_status # Get MMS Status # Get MMS Status - # @param messageid Unique identifier of a message - it is the value returned from a previous POST call to https://api.telstra.com/v2/messages/mms + # @param messageid Unique identifier of a message - it is the value returned from a previous POST call to https://tapi.telstra.com/v2/messages/mms # @param [Hash] opts the optional parameters # @return [Array] describe 'get_mms_status test' do @@ -46,8 +46,8 @@ # unit tests for get_sms_status # Get SMS Status - # If no notification URL has been specified, it is possible to poll for the message status. Note that the `MessageId` that appears in the URL must be URL encoded. Just copying the `MessageId` as it was supplied when submitting the message may not work. SMS Status with Notification URL --- When a message has reached its final state, the API will send a POST to the URL that has been previously specified. <pre><code class=\"language-sh\">{ to: '+61418123456' sentTimestamp: '2017-03-17T10:05:22+10:00' receivedTimestamp: '2017-03-17T10:05:23+10:00' messageId: /cccb284200035236000000000ee9d074019e0301/1261418123456 deliveryStatus: DELIVRD } </code></pre> The fields are: <table> <thead> <tr> <th>Field</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><code>to</code></td> <td>The number the message was sent to.</td> </tr> <tr> <td><code>receivedTimestamp</code></td> <td>Time the message was sent to the API.</td> </tr> <tr> <td><code>sentTimestamp</code></td> <td>Time handling of the message ended.</td> </tr> <tr> <td><code>deliveryStatus</code></td> <td>The final state of the message.</td> </tr> <tr> <td><code>messageId</code></td> <td>The same reference that was returned when the original message was sent.</td> </tr> <tr> <td><code>receivedTimestamp</code></td> <td>Time the message was sent to the API.</td> </tr> </tbody> </table> Upon receiving this call it is expected that your servers will give a 204 (No Content) response. Anything else will cause the API to reattempt the call 5 minutes later. - # @param message_id Unique identifier of a message - it is the value returned from a previous POST call to https://api.telstra.com/v2/messages/sms. + # If no notification URL has been specified, it is possible to poll for the message status. Note that the `MessageId` that appears in the URL must be URL encoded. Just copying the `MessageId` as it was supplied when submitting the message may not work. # SMS Status with Notification URL When a message has reached its final state, the API will send a POST to the URL that has been previously specified. <pre><code class=\"language-sh\">{ \"to\": \"+61418123456\", \"sentTimestamp\": \"2017-03-17T10:05:22+10:00\", \"receivedTimestamp\": \"2017-03-17T10:05:23+10:00\", \"messageId\": \"1234567890ABCDEFGHIJKLNOPQRSTUVW\", \"deliveryStatus\": \"DELIVRD\" } </code></pre> The fields are: | Field | Description | | --- | ---| | `to` | The number the message was sent to. | | `receivedTimestamp` | Time the message was sent to the API. | | `sentTimestamp` | Time handling of the message ended. | | `deliveryStatus` | The final state of the message. | | `messageId` | The same reference that was returned when the original message was sent.| | `receivedTimestamp` | Time the message was sent to the API.| Upon receiving this call it is expected that your servers will give a 204 (No Content) response. + # @param message_id Unique identifier of a message - it is the value returned from a previous POST call to https://tapi.telstra.com/v2/messages/sms. # @param [Hash] opts the optional parameters # @return [Array] describe 'get_sms_status test' do @@ -56,23 +56,57 @@ end end - # unit tests for retrieve_mms_responses - # Retrieve MMS Responses - # Messages are retrieved one at a time, starting with the earliest response. If the subscription has a `notifyURL`, response messages will be logged there instead. # Notification URL Format for MMS Replies <pre><code class=\"language-sh\">{ \"status\": \"RECEIVED\", \"destinationAddress\": \"+61418123456\", \"senderAddress\": \"+61421987654\", \"subject\": \"Foo\", \"sentTimestamp\": \"2018-03-23T12:15:45+10:00\", \"envelope\": \"string\", \"MMSContent\": [ { \"type\": \"text/plain\", \"filename\": \"text_1.txt\", \"payload\": \"string\" }, { \"type\": \"image/jpeg\", \"filename\": \"sample.jpeg\", \"payload\": \"string\" } ] }</code></pre> The fields are: | Field | Description | | --- | --- | | `status` | The final state of the message. | | `destinationAddress` |The number the message was sent to. | | `senderAddress` | The number the message was sent from. | | `subject` | The subject assigned to the message. | | `sentTimestamp` | Time handling of the message ended. | | `envelope` | Information about about terminal type and originating operator. | | `MMSContent` | An array of the actual content of the reply message. | | `type` | The content type of the message. | | `filename` | The filename for the message content. | | `payload` | The content of the message. | + # unit tests for m_ms_health_check + # MMS Health Check + # Determine whether the MMS service is up or down. # @param [Hash] opts the optional parameters - # @return [Array] - describe 'retrieve_mms_responses test' do + # @return [HealthCheckResponse] + describe 'm_ms_health_check test' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end - # unit tests for retrieve_sms_responses - # Retrieve SMS Responses - # Messages are retrieved one at a time, starting with the earliest response. The API supports the encoding of the full range of emojis in the reply message. The emojis will be in their UTF-8 format. If the subscription has a `notifyURL`, response messages will be logged there instead. # Notification URL Format for SMS Response <pre><code class=\"language-sh\">{ \"to\":\"+61472880123\", \"from\":\"+61412345678\", \"body\":\"Foo4\", \"sentTimestamp\":\"2018-04-20T14:24:35\", \"messageId\":\"DMASApiA0000000146\" }</code></pre> The fields are: | Field | Description | | --- |--- | | `to` | The number the message was sent to. | | `from` | The number the message was sent from. | | `body` | The content of the SMS response. | | `sentTimestamp` | Time handling of the message ended. | | `messageId` | The ID assigned to the message. | + # unit tests for retrieve_mms_replies + # Retrieve MMS Replies + # Messages are retrieved one at a time, starting with the earliest reply. If the subscription has a `notifyURL`, reply messages will be logged there instead, i.e. `GET` and reply `notifyURL` are exclusive. # MMS Reply with Notification URL When a reply is received, the API will send a POST to the subscription URL that has been previously specified. <pre><code class=\"language-sh\">{ \"to\": \"+61418123456\", \"from\": \"+61421987654\", \"sentTimestamp\": \"2018-03-23T12:15:45+10:00\", \"messageId\": \"XFRO1ApiA0000000111\", \"subject\": \"Foo\", \"envelope\": \"string\", \"MMSContent\": [ { \"type\": \"text/plain\", \"filename\": \"text_1.txt\", \"payload\": \"string\" }, { \"type\": \"image/jpeg\", \"filename\": \"sample.jpeg\", \"payload\": \"string\" } ] }</code></pre> The fields are: | Field | Description | | --- | --- | | `to` |The number the message was sent to. | | `from` | The number the message was sent from. | | `sentTimestamp` | Time handling of the message ended. | | `messageId` | Message Id assigned by the MMSC | | `subject` | The subject assigned to the message. | | `envelope` | Information about about terminal type and originating operator. | | `MMSContent` | An array of the actual content of the reply message. | | `type` | The content type of the message. | | `filename` | The filename for the message content. | | `payload` | The content of the message. | + # @param [Hash] opts the optional parameters + # @return [GetMmsResponse] + describe 'retrieve_mms_replies test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for retrieve_sms_replies + # Retrieve SMS Replies + # Messages are retrieved one at a time, starting with the earliest reply. The API supports the encoding of emojis in the reply message. The emojis will be in their UTF-8 format. If the subscription has a `notifyURL`, reply messages will be logged there instead. # SMS Reply with Notification URL When a reply is received, the API will send a POST to the subscription URL that has been previously specified. <pre><code class=\"language-sh\">{ \"to\":\"+61472880123\", \"from\":\"+61412345678\", \"body\":\"Foo4\", \"sentTimestamp\":\"2018-04-20T14:24:35\", \"messageId\":\"DMASApiA0000000146\" }</code></pre> The fields are: | Field | Description | | --- |--- | | `to` | The number the message was sent to. | | `from` | The number the message was sent from. | | `body` | The content of the SMS response. | | `sentTimestamp` | Time handling of the message ended. | | `messageId` | The ID assigned to the message. | # @param [Hash] opts the optional parameters # @return [InboundPollResponse] - describe 'retrieve_sms_responses test' do + describe 'retrieve_sms_replies test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for s_ms_health_check + # SMS Health Check + # Determine whether the SMS service is up or down. + # @param [Hash] opts the optional parameters + # @return [HealthCheckResponse] + describe 's_ms_health_check test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for s_ms_multi + # Send Multiple SMS + # Send multiple SMS in one API call. + # @param payload A JSON payload containing the recipient's phone number and text message. This number can be in international format if preceeded by a '+' or in national format ('04xxxxxxxx') where x is a digit. + # @param [Hash] opts the optional parameters + # @return [MessageSentResponseSms] + describe 's_ms_multi test' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end @@ -81,11 +115,9 @@ # unit tests for send_mms # Send MMS # Send MMS - # @param send_mms_request A JSON or XML payload containing the recipient's phone number and MMS message. -The recipient number should be in the format '04xxxxxxxx' where x is a digit. - + # @param body A JSON or XML payload containing the recipient's phone number and MMS message. The recipient number should be in the format '04xxxxxxxx' where x is a digit. # @param [Hash] opts the optional parameters - # @return [MessageSentResponse] + # @return [MessageSentResponseMms] describe 'send_mms test' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers @@ -95,11 +127,9 @@ # unit tests for send_sms # Send SMS # Send an SMS Message to a single or multiple mobile number/s. - # @param send_sms_request A JSON or XML payload containing the recipient's phone number and text message. -This number can be in international format if preceeded by a +61 or in national format ('04xxxxxxxx') where x is a digit. - + # @param payload A JSON or XML payload containing the recipient's phone number and text message. This number can be in international format if preceeded by a '+' or in national format ('04xxxxxxxx') where x is a digit. # @param [Hash] opts the optional parameters - # @return [MessageSentResponse] + # @return [MessageSentResponseSms] describe 'send_sms test' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers diff --git a/spec/api/provisioning_api_spec.rb b/spec/api/provisioning_api_spec.rb index aa36b54..288fc87 100644 --- a/spec/api/provisioning_api_spec.rb +++ b/spec/api/provisioning_api_spec.rb @@ -1,12 +1,12 @@ =begin #Telstra Messaging API -# # Introduction Send and receive SMS and MMS messages globally using Telstra’s enterprise grade Messaging API. It also allows your application to track the delivery status of both sent and received messages. Get your dedicated Australian number, and start sending and receiving messages today. # Features The Telstra Messaging API provides the features below. | Feature | Description | | --- | --- | | `Dedicated Number` | Provision a mobile number for your account to be used as `from` address in the API | | `Send Messages` | Sending SMS or MMS messages | | `Receive Messages` | Telstra will deliver messages sent to a dedicated number or to the `notifyURL` defined by you | | `Broadcast Messages` | Invoke a single API call to send a message to a list of numbers provided in `to` | | `Delivery Status` | Query the delivery status of your messages | | `Callbacks` | Provide a notification URL and Telstra will notify your app when a message status changes | | `Alphanumeric Identifier` | Differentiate yourself by providing an alphanumeric string in `from`. This feature is only available on paid plans | | `Concatenation` | Send messages up to 1900 characters long and Telstra will automaticaly segment and reassemble them | | `Reply Request` | Create a chat session by associating `messageId` and `to` number to track responses received from a mobile number. We will store this association for 8 days | | `Character set` | Accepts all Unicode characters as part of UTF-8 | | `Bounce-back response` | See if your SMS hits an unreachable or unallocated number (Australia Only) | | `Queuing` | Messaging API will automatically queue and deliver each message at a compliant rate. | | `Emoji Encoding` | The API supports the encoding of the full range of emojis. Emojis in the reply messages will be in their UTF-8 format. | ## Delivery Notification or Callbacks The API provides several methods for notifying when a message has been delivered to the destination. 1. When you send a message there is an opportunity to specify a `notifyURL`. Once the message has been delivered the API will make a call to this URL to advise of the message status. 2. If you do not specify a URL you can always call the `GET /status` API to get the status of the message. # Getting Access to the API 1. Register at [https://dev.telstra.com](https://dev.telstra.com). 2. After registration, login to [https://dev.telstra.com](https://dev.telstra.com) and navigate to the **My apps** page. 3. Create your application by clicking the **Add new app** button 4. Select **API Free Trial** Product when configuring your application. This Product includes the Telstra Messaging API as well as other free trial APIs. Your application will be approved automatically. 5. There is a maximum of 1000 free messages per developer. Additional messages and features can be purchased from [https://dev.telstra.com](https://dev.telstra.com). 6. Note your `Client key` and `Client secret` as these will be needed to provision a number for your application and for authentication. Now head over to **Getting Started** where you can find a postman collection as well as some links to sample apps and SDKs to get you started. Happy Messaging! # Frequently Asked Questions **Q: Is creating a subscription via the Provisioning call a required step?** A. Yes. You will only be able to start sending messages if you have a provisioned dedicated number. Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: When trying to send an SMS I receive a `400 Bad Request` response. How can I fix this?** A. You need to make sure you have a provisioned dedicated number before you can send an SMS. If you do not have a provisioned dedicated number and you try to send a message via the API, you will get the error below in the response:
{   \"status\":\"400\",   \"code\":\"DELIVERY-IMPOSSIBLE\",   \"message\":\"Invalid \\'from\\' address specified\" }
Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: Can I send a broadcast message using the Telstra Messaging API?** A. Yes. Recipient numbers can be in the form of an array of strings if a broadcast message needs to be sent, allowing you to send to multiple mobile numbers in one API call. A sample request body for this will be: `{\"to\":[\"+61412345678\",\"+61487654321\"],\"body\":\"Test Message\"}` **Q: Can I use `Alphanumeric Identifier` from my paid plan via credit card?** A. `Alphanumeric Identifier` is only available on Telstra Account paid plans, not through credit card paid plans. **Q: How long does my dedicated number stay active for?** A. When you provision a dedicated number, by default it will be active for 30-days. You can use the `activeDays` parameter during the provisioning call to increment or decrement the number of days your dedicated number will remain active. **Q: What is the maximum sized MMS that I can send?** A. This will depend on the carrier that will receive the MMS. For Telstra it's up to 2MB, Optus up to 1.5MB and Vodafone only allows up to 500kB. You will need to check with international carriers for thier MMS size limits. **Q: Are SMILs supported by the Messaging API?** A. While there will be no error if you send an MMS with a SMIL presentation, the actual layout or sequence defined in the SMIL may not display as expected because most of the new smartphone devices ignore the SMIL presentation layer. SMIL was used in feature phones which had limited capability and SMIL allowed a *powerpoint type* presentation to be provided. Smartphones now have the capability to display video which is the better option for presentations. It is recommended that MMS messages should just drop the SMIL. **Q: How do I assign a delivery notification or callback URL?** A. You can assign a delivery notification or callback URL by adding the `notifyURL` parameter in the body of the request when you send a message. Once the message has been delivered, a notification will then be posted to this callback URL. **Q: What is the difference between the `notifyURL` parameter in the Provisoning call versus the `notifyURL` parameter in the Send Message call?** A. The `notifyURL` in the Provisoning call will be the URL where replies to the provisioned number will be posted. On the other hand, the `notifyURL` in the Send Message call will be the URL where the delivery notification will be posted, e.g. when an SMS has already been delivered to the recipient. # Getting Started Below are the steps to get started with the Telstra Messaging API. 1. Generate an OAuth2 token using your `Client key` and `Client secret`. 2. Use the Provisioning call to create a subscription and receive a dedicated number. 3. Send a message to a specific mobile number. ## Run in Postman \"Run ## Sample Apps - [Perl Sample App](https://github.com/telstra/MessagingAPI-perl-sample-app) - [Happy Chat App](https://github.com/telstra/messaging-sample-code-happy-chat) - [PHP Sample App](https://github.com/developersteve/telstra-messaging-php) ## SDK Repos - [Messaging API - PHP SDK](https://github.com/telstra/MessagingAPI-SDK-php) - [Messaging API - Python SDK](https://github.com/telstra/MessagingAPI-SDK-python) - [Messaging API - Ruby SDK](https://github.com/telstra/MessagingAPI-SDK-ruby) - [Messaging API - NodeJS SDK](https://github.com/telstra/MessagingAPI-SDK-node) - [Messaging API - .Net2 SDK](https://github.com/telstra/MessagingAPI-SDK-dotnet) - [Messaging API - Java SDK](https://github.com/telstra/MessagingAPI-SDK-Java) ## Blog Posts For more information on the Messaging API, you can read these blog posts: - [Callbacks Part 1](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-1) - [Callbacks Part 2](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-2) +#The Telstra Messaging API specification -OpenAPI spec version: 2.2.6 +The version of the OpenAPI document: 2.2.9 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.0.1 +OpenAPI Generator version: 4.2.3-SNAPSHOT =end @@ -19,7 +19,7 @@ describe 'ProvisioningApi' do before do # run before each test - @instance = Telstra_Messaging::ProvisioningApi.new + @api_instance = Telstra_Messaging::ProvisioningApi.new end after do @@ -28,14 +28,14 @@ describe 'test an instance of ProvisioningApi' do it 'should create an instance of ProvisioningApi' do - expect(@instance).to be_instance_of(Telstra_Messaging::ProvisioningApi) + expect(@api_instance).to be_instance_of(Telstra_Messaging::ProvisioningApi) end end # unit tests for create_subscription # Create Subscription - # Invoke the provisioning API to get a dedicated mobile number for an account or application. - # @param provision_number_request A JSON payload containing the required attributes + # Invoke the provisioning API to get a dedicated mobile number for an account or application. Note that Free Trial apps will have a 30-Day Limit for their provisioned number. If the Provisioning call is made several times within that 30-Day period, it will return the `expiryDate` in the Unix format and will not add any activeDays until after that `expiryDate`. After the `expiryDate`, you may make another Provisioning call to extend the activeDays by another 30-Days. For paid apps, a provisioned number can be allotted for a maximum of 5 years. If a Provisioning call is made which will result to activeDays > 1825, a 409 `Active Days Max` response will be returned to indicate that the provisioned number is already valid for more than 5 years and that no update to activeDays has been made. + # @param body A JSON payload containing the required attributes # @param [Hash] opts the optional parameters # @return [ProvisionNumberResponse] describe 'create_subscription test' do @@ -47,7 +47,7 @@ # unit tests for delete_subscription # Delete Subscription # Delete a mobile number subscription from an account - # @param delete_number_request EmptyArr + # @param body EmptyArr # @param [Hash] opts the optional parameters # @return [nil] describe 'delete_subscription test' do diff --git a/spec/api_client_spec.rb b/spec/api_client_spec.rb index 8c0f59e..e998e46 100644 --- a/spec/api_client_spec.rb +++ b/spec/api_client_spec.rb @@ -1,12 +1,12 @@ =begin #Telstra Messaging API -# # Introduction Send and receive SMS and MMS messages globally using Telstra’s enterprise grade Messaging API. It also allows your application to track the delivery status of both sent and received messages. Get your dedicated Australian number, and start sending and receiving messages today. # Features The Telstra Messaging API provides the features below. | Feature | Description | | --- | --- | | `Dedicated Number` | Provision a mobile number for your account to be used as `from` address in the API | | `Send Messages` | Sending SMS or MMS messages | | `Receive Messages` | Telstra will deliver messages sent to a dedicated number or to the `notifyURL` defined by you | | `Broadcast Messages` | Invoke a single API call to send a message to a list of numbers provided in `to` | | `Delivery Status` | Query the delivery status of your messages | | `Callbacks` | Provide a notification URL and Telstra will notify your app when a message status changes | | `Alphanumeric Identifier` | Differentiate yourself by providing an alphanumeric string in `from`. This feature is only available on paid plans | | `Concatenation` | Send messages up to 1900 characters long and Telstra will automaticaly segment and reassemble them | | `Reply Request` | Create a chat session by associating `messageId` and `to` number to track responses received from a mobile number. We will store this association for 8 days | | `Character set` | Accepts all Unicode characters as part of UTF-8 | | `Bounce-back response` | See if your SMS hits an unreachable or unallocated number (Australia Only) | | `Queuing` | Messaging API will automatically queue and deliver each message at a compliant rate. | | `Emoji Encoding` | The API supports the encoding of the full range of emojis. Emojis in the reply messages will be in their UTF-8 format. | ## Delivery Notification or Callbacks The API provides several methods for notifying when a message has been delivered to the destination. 1. When you send a message there is an opportunity to specify a `notifyURL`. Once the message has been delivered the API will make a call to this URL to advise of the message status. 2. If you do not specify a URL you can always call the `GET /status` API to get the status of the message. # Getting Access to the API 1. Register at [https://dev.telstra.com](https://dev.telstra.com). 2. After registration, login to [https://dev.telstra.com](https://dev.telstra.com) and navigate to the **My apps** page. 3. Create your application by clicking the **Add new app** button 4. Select **API Free Trial** Product when configuring your application. This Product includes the Telstra Messaging API as well as other free trial APIs. Your application will be approved automatically. 5. There is a maximum of 1000 free messages per developer. Additional messages and features can be purchased from [https://dev.telstra.com](https://dev.telstra.com). 6. Note your `Client key` and `Client secret` as these will be needed to provision a number for your application and for authentication. Now head over to **Getting Started** where you can find a postman collection as well as some links to sample apps and SDKs to get you started. Happy Messaging! # Frequently Asked Questions **Q: Is creating a subscription via the Provisioning call a required step?** A. Yes. You will only be able to start sending messages if you have a provisioned dedicated number. Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: When trying to send an SMS I receive a `400 Bad Request` response. How can I fix this?** A. You need to make sure you have a provisioned dedicated number before you can send an SMS. If you do not have a provisioned dedicated number and you try to send a message via the API, you will get the error below in the response:
{   \"status\":\"400\",   \"code\":\"DELIVERY-IMPOSSIBLE\",   \"message\":\"Invalid \\'from\\' address specified\" }
Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: Can I send a broadcast message using the Telstra Messaging API?** A. Yes. Recipient numbers can be in the form of an array of strings if a broadcast message needs to be sent, allowing you to send to multiple mobile numbers in one API call. A sample request body for this will be: `{\"to\":[\"+61412345678\",\"+61487654321\"],\"body\":\"Test Message\"}` **Q: Can I use `Alphanumeric Identifier` from my paid plan via credit card?** A. `Alphanumeric Identifier` is only available on Telstra Account paid plans, not through credit card paid plans. **Q: How long does my dedicated number stay active for?** A. When you provision a dedicated number, by default it will be active for 30-days. You can use the `activeDays` parameter during the provisioning call to increment or decrement the number of days your dedicated number will remain active. **Q: What is the maximum sized MMS that I can send?** A. This will depend on the carrier that will receive the MMS. For Telstra it's up to 2MB, Optus up to 1.5MB and Vodafone only allows up to 500kB. You will need to check with international carriers for thier MMS size limits. **Q: Are SMILs supported by the Messaging API?** A. While there will be no error if you send an MMS with a SMIL presentation, the actual layout or sequence defined in the SMIL may not display as expected because most of the new smartphone devices ignore the SMIL presentation layer. SMIL was used in feature phones which had limited capability and SMIL allowed a *powerpoint type* presentation to be provided. Smartphones now have the capability to display video which is the better option for presentations. It is recommended that MMS messages should just drop the SMIL. **Q: How do I assign a delivery notification or callback URL?** A. You can assign a delivery notification or callback URL by adding the `notifyURL` parameter in the body of the request when you send a message. Once the message has been delivered, a notification will then be posted to this callback URL. **Q: What is the difference between the `notifyURL` parameter in the Provisoning call versus the `notifyURL` parameter in the Send Message call?** A. The `notifyURL` in the Provisoning call will be the URL where replies to the provisioned number will be posted. On the other hand, the `notifyURL` in the Send Message call will be the URL where the delivery notification will be posted, e.g. when an SMS has already been delivered to the recipient. # Getting Started Below are the steps to get started with the Telstra Messaging API. 1. Generate an OAuth2 token using your `Client key` and `Client secret`. 2. Use the Provisioning call to create a subscription and receive a dedicated number. 3. Send a message to a specific mobile number. ## Run in Postman \"Run ## Sample Apps - [Perl Sample App](https://github.com/telstra/MessagingAPI-perl-sample-app) - [Happy Chat App](https://github.com/telstra/messaging-sample-code-happy-chat) - [PHP Sample App](https://github.com/developersteve/telstra-messaging-php) ## SDK Repos - [Messaging API - PHP SDK](https://github.com/telstra/MessagingAPI-SDK-php) - [Messaging API - Python SDK](https://github.com/telstra/MessagingAPI-SDK-python) - [Messaging API - Ruby SDK](https://github.com/telstra/MessagingAPI-SDK-ruby) - [Messaging API - NodeJS SDK](https://github.com/telstra/MessagingAPI-SDK-node) - [Messaging API - .Net2 SDK](https://github.com/telstra/MessagingAPI-SDK-dotnet) - [Messaging API - Java SDK](https://github.com/telstra/MessagingAPI-SDK-Java) ## Blog Posts For more information on the Messaging API, you can read these blog posts: - [Callbacks Part 1](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-1) - [Callbacks Part 2](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-2) +#The Telstra Messaging API specification -OpenAPI spec version: 2.2.6 +The version of the OpenAPI document: 2.2.9 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.0.1 +OpenAPI Generator version: 4.2.3-SNAPSHOT =end @@ -156,7 +156,7 @@ end it 'fails for invalid collection format' do - expect(proc { api_client.build_collection_param(param, :INVALID) }).to raise_error(RuntimeError, 'unknown collection format: :INVALID') + expect{api_client.build_collection_param(param, :INVALID)}.to raise_error(RuntimeError, 'unknown collection format: :INVALID') end end diff --git a/spec/configuration_spec.rb b/spec/configuration_spec.rb index 654db9d..5e244d4 100644 --- a/spec/configuration_spec.rb +++ b/spec/configuration_spec.rb @@ -1,12 +1,12 @@ =begin #Telstra Messaging API -# # Introduction Send and receive SMS and MMS messages globally using Telstra’s enterprise grade Messaging API. It also allows your application to track the delivery status of both sent and received messages. Get your dedicated Australian number, and start sending and receiving messages today. # Features The Telstra Messaging API provides the features below. | Feature | Description | | --- | --- | | `Dedicated Number` | Provision a mobile number for your account to be used as `from` address in the API | | `Send Messages` | Sending SMS or MMS messages | | `Receive Messages` | Telstra will deliver messages sent to a dedicated number or to the `notifyURL` defined by you | | `Broadcast Messages` | Invoke a single API call to send a message to a list of numbers provided in `to` | | `Delivery Status` | Query the delivery status of your messages | | `Callbacks` | Provide a notification URL and Telstra will notify your app when a message status changes | | `Alphanumeric Identifier` | Differentiate yourself by providing an alphanumeric string in `from`. This feature is only available on paid plans | | `Concatenation` | Send messages up to 1900 characters long and Telstra will automaticaly segment and reassemble them | | `Reply Request` | Create a chat session by associating `messageId` and `to` number to track responses received from a mobile number. We will store this association for 8 days | | `Character set` | Accepts all Unicode characters as part of UTF-8 | | `Bounce-back response` | See if your SMS hits an unreachable or unallocated number (Australia Only) | | `Queuing` | Messaging API will automatically queue and deliver each message at a compliant rate. | | `Emoji Encoding` | The API supports the encoding of the full range of emojis. Emojis in the reply messages will be in their UTF-8 format. | ## Delivery Notification or Callbacks The API provides several methods for notifying when a message has been delivered to the destination. 1. When you send a message there is an opportunity to specify a `notifyURL`. Once the message has been delivered the API will make a call to this URL to advise of the message status. 2. If you do not specify a URL you can always call the `GET /status` API to get the status of the message. # Getting Access to the API 1. Register at [https://dev.telstra.com](https://dev.telstra.com). 2. After registration, login to [https://dev.telstra.com](https://dev.telstra.com) and navigate to the **My apps** page. 3. Create your application by clicking the **Add new app** button 4. Select **API Free Trial** Product when configuring your application. This Product includes the Telstra Messaging API as well as other free trial APIs. Your application will be approved automatically. 5. There is a maximum of 1000 free messages per developer. Additional messages and features can be purchased from [https://dev.telstra.com](https://dev.telstra.com). 6. Note your `Client key` and `Client secret` as these will be needed to provision a number for your application and for authentication. Now head over to **Getting Started** where you can find a postman collection as well as some links to sample apps and SDKs to get you started. Happy Messaging! # Frequently Asked Questions **Q: Is creating a subscription via the Provisioning call a required step?** A. Yes. You will only be able to start sending messages if you have a provisioned dedicated number. Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: When trying to send an SMS I receive a `400 Bad Request` response. How can I fix this?** A. You need to make sure you have a provisioned dedicated number before you can send an SMS. If you do not have a provisioned dedicated number and you try to send a message via the API, you will get the error below in the response:
{   \"status\":\"400\",   \"code\":\"DELIVERY-IMPOSSIBLE\",   \"message\":\"Invalid \\'from\\' address specified\" }
Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: Can I send a broadcast message using the Telstra Messaging API?** A. Yes. Recipient numbers can be in the form of an array of strings if a broadcast message needs to be sent, allowing you to send to multiple mobile numbers in one API call. A sample request body for this will be: `{\"to\":[\"+61412345678\",\"+61487654321\"],\"body\":\"Test Message\"}` **Q: Can I use `Alphanumeric Identifier` from my paid plan via credit card?** A. `Alphanumeric Identifier` is only available on Telstra Account paid plans, not through credit card paid plans. **Q: How long does my dedicated number stay active for?** A. When you provision a dedicated number, by default it will be active for 30-days. You can use the `activeDays` parameter during the provisioning call to increment or decrement the number of days your dedicated number will remain active. **Q: What is the maximum sized MMS that I can send?** A. This will depend on the carrier that will receive the MMS. For Telstra it's up to 2MB, Optus up to 1.5MB and Vodafone only allows up to 500kB. You will need to check with international carriers for thier MMS size limits. **Q: Are SMILs supported by the Messaging API?** A. While there will be no error if you send an MMS with a SMIL presentation, the actual layout or sequence defined in the SMIL may not display as expected because most of the new smartphone devices ignore the SMIL presentation layer. SMIL was used in feature phones which had limited capability and SMIL allowed a *powerpoint type* presentation to be provided. Smartphones now have the capability to display video which is the better option for presentations. It is recommended that MMS messages should just drop the SMIL. **Q: How do I assign a delivery notification or callback URL?** A. You can assign a delivery notification or callback URL by adding the `notifyURL` parameter in the body of the request when you send a message. Once the message has been delivered, a notification will then be posted to this callback URL. **Q: What is the difference between the `notifyURL` parameter in the Provisoning call versus the `notifyURL` parameter in the Send Message call?** A. The `notifyURL` in the Provisoning call will be the URL where replies to the provisioned number will be posted. On the other hand, the `notifyURL` in the Send Message call will be the URL where the delivery notification will be posted, e.g. when an SMS has already been delivered to the recipient. # Getting Started Below are the steps to get started with the Telstra Messaging API. 1. Generate an OAuth2 token using your `Client key` and `Client secret`. 2. Use the Provisioning call to create a subscription and receive a dedicated number. 3. Send a message to a specific mobile number. ## Run in Postman \"Run ## Sample Apps - [Perl Sample App](https://github.com/telstra/MessagingAPI-perl-sample-app) - [Happy Chat App](https://github.com/telstra/messaging-sample-code-happy-chat) - [PHP Sample App](https://github.com/developersteve/telstra-messaging-php) ## SDK Repos - [Messaging API - PHP SDK](https://github.com/telstra/MessagingAPI-SDK-php) - [Messaging API - Python SDK](https://github.com/telstra/MessagingAPI-SDK-python) - [Messaging API - Ruby SDK](https://github.com/telstra/MessagingAPI-SDK-ruby) - [Messaging API - NodeJS SDK](https://github.com/telstra/MessagingAPI-SDK-node) - [Messaging API - .Net2 SDK](https://github.com/telstra/MessagingAPI-SDK-dotnet) - [Messaging API - Java SDK](https://github.com/telstra/MessagingAPI-SDK-Java) ## Blog Posts For more information on the Messaging API, you can read these blog posts: - [Callbacks Part 1](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-1) - [Callbacks Part 2](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-2) +#The Telstra Messaging API specification -OpenAPI spec version: 2.2.6 +The version of the OpenAPI document: 2.2.9 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.0.1 +OpenAPI Generator version: 4.2.3-SNAPSHOT =end diff --git a/spec/models/delete_number_request_spec.rb b/spec/models/delete_number_request_spec.rb index c1fbbc8..57bf609 100644 --- a/spec/models/delete_number_request_spec.rb +++ b/spec/models/delete_number_request_spec.rb @@ -1,12 +1,12 @@ =begin #Telstra Messaging API -# # Introduction Send and receive SMS and MMS messages globally using Telstra’s enterprise grade Messaging API. It also allows your application to track the delivery status of both sent and received messages. Get your dedicated Australian number, and start sending and receiving messages today. # Features The Telstra Messaging API provides the features below. | Feature | Description | | --- | --- | | `Dedicated Number` | Provision a mobile number for your account to be used as `from` address in the API | | `Send Messages` | Sending SMS or MMS messages | | `Receive Messages` | Telstra will deliver messages sent to a dedicated number or to the `notifyURL` defined by you | | `Broadcast Messages` | Invoke a single API call to send a message to a list of numbers provided in `to` | | `Delivery Status` | Query the delivery status of your messages | | `Callbacks` | Provide a notification URL and Telstra will notify your app when a message status changes | | `Alphanumeric Identifier` | Differentiate yourself by providing an alphanumeric string in `from`. This feature is only available on paid plans | | `Concatenation` | Send messages up to 1900 characters long and Telstra will automaticaly segment and reassemble them | | `Reply Request` | Create a chat session by associating `messageId` and `to` number to track responses received from a mobile number. We will store this association for 8 days | | `Character set` | Accepts all Unicode characters as part of UTF-8 | | `Bounce-back response` | See if your SMS hits an unreachable or unallocated number (Australia Only) | | `Queuing` | Messaging API will automatically queue and deliver each message at a compliant rate. | | `Emoji Encoding` | The API supports the encoding of the full range of emojis. Emojis in the reply messages will be in their UTF-8 format. | ## Delivery Notification or Callbacks The API provides several methods for notifying when a message has been delivered to the destination. 1. When you send a message there is an opportunity to specify a `notifyURL`. Once the message has been delivered the API will make a call to this URL to advise of the message status. 2. If you do not specify a URL you can always call the `GET /status` API to get the status of the message. # Getting Access to the API 1. Register at [https://dev.telstra.com](https://dev.telstra.com). 2. After registration, login to [https://dev.telstra.com](https://dev.telstra.com) and navigate to the **My apps** page. 3. Create your application by clicking the **Add new app** button 4. Select **API Free Trial** Product when configuring your application. This Product includes the Telstra Messaging API as well as other free trial APIs. Your application will be approved automatically. 5. There is a maximum of 1000 free messages per developer. Additional messages and features can be purchased from [https://dev.telstra.com](https://dev.telstra.com). 6. Note your `Client key` and `Client secret` as these will be needed to provision a number for your application and for authentication. Now head over to **Getting Started** where you can find a postman collection as well as some links to sample apps and SDKs to get you started. Happy Messaging! # Frequently Asked Questions **Q: Is creating a subscription via the Provisioning call a required step?** A. Yes. You will only be able to start sending messages if you have a provisioned dedicated number. Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: When trying to send an SMS I receive a `400 Bad Request` response. How can I fix this?** A. You need to make sure you have a provisioned dedicated number before you can send an SMS. If you do not have a provisioned dedicated number and you try to send a message via the API, you will get the error below in the response:
{   \"status\":\"400\",   \"code\":\"DELIVERY-IMPOSSIBLE\",   \"message\":\"Invalid \\'from\\' address specified\" }
Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: Can I send a broadcast message using the Telstra Messaging API?** A. Yes. Recipient numbers can be in the form of an array of strings if a broadcast message needs to be sent, allowing you to send to multiple mobile numbers in one API call. A sample request body for this will be: `{\"to\":[\"+61412345678\",\"+61487654321\"],\"body\":\"Test Message\"}` **Q: Can I use `Alphanumeric Identifier` from my paid plan via credit card?** A. `Alphanumeric Identifier` is only available on Telstra Account paid plans, not through credit card paid plans. **Q: How long does my dedicated number stay active for?** A. When you provision a dedicated number, by default it will be active for 30-days. You can use the `activeDays` parameter during the provisioning call to increment or decrement the number of days your dedicated number will remain active. **Q: What is the maximum sized MMS that I can send?** A. This will depend on the carrier that will receive the MMS. For Telstra it's up to 2MB, Optus up to 1.5MB and Vodafone only allows up to 500kB. You will need to check with international carriers for thier MMS size limits. **Q: Are SMILs supported by the Messaging API?** A. While there will be no error if you send an MMS with a SMIL presentation, the actual layout or sequence defined in the SMIL may not display as expected because most of the new smartphone devices ignore the SMIL presentation layer. SMIL was used in feature phones which had limited capability and SMIL allowed a *powerpoint type* presentation to be provided. Smartphones now have the capability to display video which is the better option for presentations. It is recommended that MMS messages should just drop the SMIL. **Q: How do I assign a delivery notification or callback URL?** A. You can assign a delivery notification or callback URL by adding the `notifyURL` parameter in the body of the request when you send a message. Once the message has been delivered, a notification will then be posted to this callback URL. **Q: What is the difference between the `notifyURL` parameter in the Provisoning call versus the `notifyURL` parameter in the Send Message call?** A. The `notifyURL` in the Provisoning call will be the URL where replies to the provisioned number will be posted. On the other hand, the `notifyURL` in the Send Message call will be the URL where the delivery notification will be posted, e.g. when an SMS has already been delivered to the recipient. # Getting Started Below are the steps to get started with the Telstra Messaging API. 1. Generate an OAuth2 token using your `Client key` and `Client secret`. 2. Use the Provisioning call to create a subscription and receive a dedicated number. 3. Send a message to a specific mobile number. ## Run in Postman \"Run ## Sample Apps - [Perl Sample App](https://github.com/telstra/MessagingAPI-perl-sample-app) - [Happy Chat App](https://github.com/telstra/messaging-sample-code-happy-chat) - [PHP Sample App](https://github.com/developersteve/telstra-messaging-php) ## SDK Repos - [Messaging API - PHP SDK](https://github.com/telstra/MessagingAPI-SDK-php) - [Messaging API - Python SDK](https://github.com/telstra/MessagingAPI-SDK-python) - [Messaging API - Ruby SDK](https://github.com/telstra/MessagingAPI-SDK-ruby) - [Messaging API - NodeJS SDK](https://github.com/telstra/MessagingAPI-SDK-node) - [Messaging API - .Net2 SDK](https://github.com/telstra/MessagingAPI-SDK-dotnet) - [Messaging API - Java SDK](https://github.com/telstra/MessagingAPI-SDK-Java) ## Blog Posts For more information on the Messaging API, you can read these blog posts: - [Callbacks Part 1](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-1) - [Callbacks Part 2](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-2) +#The Telstra Messaging API specification -OpenAPI spec version: 2.2.6 +The version of the OpenAPI document: 2.2.9 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.0.1 +OpenAPI Generator version: 4.2.3-SNAPSHOT =end diff --git a/spec/models/get_mms_response_spec.rb b/spec/models/get_mms_response_spec.rb new file mode 100644 index 0000000..73ba5d0 --- /dev/null +++ b/spec/models/get_mms_response_spec.rb @@ -0,0 +1,83 @@ +=begin +#Telstra Messaging API + +#The Telstra Messaging API specification + +The version of the OpenAPI document: 2.2.9 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 4.2.3-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Telstra_Messaging::GetMmsResponse +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'GetMmsResponse' do + before do + # run before each test + @instance = Telstra_Messaging::GetMmsResponse.new + end + + after do + # run after each test + end + + describe 'test an instance of GetMmsResponse' do + it 'should create an instance of GetMmsResponse' do + expect(@instance).to be_instance_of(Telstra_Messaging::GetMmsResponse) + end + end + describe 'test attribute "status"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "destination_address"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "sender_address"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "subject"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "message_id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "api_msg_id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "sent_timestamp"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "mms_content"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/models/get_subscription_response_spec.rb b/spec/models/get_subscription_response_spec.rb index f046807..6ec0e79 100644 --- a/spec/models/get_subscription_response_spec.rb +++ b/spec/models/get_subscription_response_spec.rb @@ -1,12 +1,12 @@ =begin #Telstra Messaging API -# # Introduction Send and receive SMS and MMS messages globally using Telstra’s enterprise grade Messaging API. It also allows your application to track the delivery status of both sent and received messages. Get your dedicated Australian number, and start sending and receiving messages today. # Features The Telstra Messaging API provides the features below. | Feature | Description | | --- | --- | | `Dedicated Number` | Provision a mobile number for your account to be used as `from` address in the API | | `Send Messages` | Sending SMS or MMS messages | | `Receive Messages` | Telstra will deliver messages sent to a dedicated number or to the `notifyURL` defined by you | | `Broadcast Messages` | Invoke a single API call to send a message to a list of numbers provided in `to` | | `Delivery Status` | Query the delivery status of your messages | | `Callbacks` | Provide a notification URL and Telstra will notify your app when a message status changes | | `Alphanumeric Identifier` | Differentiate yourself by providing an alphanumeric string in `from`. This feature is only available on paid plans | | `Concatenation` | Send messages up to 1900 characters long and Telstra will automaticaly segment and reassemble them | | `Reply Request` | Create a chat session by associating `messageId` and `to` number to track responses received from a mobile number. We will store this association for 8 days | | `Character set` | Accepts all Unicode characters as part of UTF-8 | | `Bounce-back response` | See if your SMS hits an unreachable or unallocated number (Australia Only) | | `Queuing` | Messaging API will automatically queue and deliver each message at a compliant rate. | | `Emoji Encoding` | The API supports the encoding of the full range of emojis. Emojis in the reply messages will be in their UTF-8 format. | ## Delivery Notification or Callbacks The API provides several methods for notifying when a message has been delivered to the destination. 1. When you send a message there is an opportunity to specify a `notifyURL`. Once the message has been delivered the API will make a call to this URL to advise of the message status. 2. If you do not specify a URL you can always call the `GET /status` API to get the status of the message. # Getting Access to the API 1. Register at [https://dev.telstra.com](https://dev.telstra.com). 2. After registration, login to [https://dev.telstra.com](https://dev.telstra.com) and navigate to the **My apps** page. 3. Create your application by clicking the **Add new app** button 4. Select **API Free Trial** Product when configuring your application. This Product includes the Telstra Messaging API as well as other free trial APIs. Your application will be approved automatically. 5. There is a maximum of 1000 free messages per developer. Additional messages and features can be purchased from [https://dev.telstra.com](https://dev.telstra.com). 6. Note your `Client key` and `Client secret` as these will be needed to provision a number for your application and for authentication. Now head over to **Getting Started** where you can find a postman collection as well as some links to sample apps and SDKs to get you started. Happy Messaging! # Frequently Asked Questions **Q: Is creating a subscription via the Provisioning call a required step?** A. Yes. You will only be able to start sending messages if you have a provisioned dedicated number. Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: When trying to send an SMS I receive a `400 Bad Request` response. How can I fix this?** A. You need to make sure you have a provisioned dedicated number before you can send an SMS. If you do not have a provisioned dedicated number and you try to send a message via the API, you will get the error below in the response:
{   \"status\":\"400\",   \"code\":\"DELIVERY-IMPOSSIBLE\",   \"message\":\"Invalid \\'from\\' address specified\" }
Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: Can I send a broadcast message using the Telstra Messaging API?** A. Yes. Recipient numbers can be in the form of an array of strings if a broadcast message needs to be sent, allowing you to send to multiple mobile numbers in one API call. A sample request body for this will be: `{\"to\":[\"+61412345678\",\"+61487654321\"],\"body\":\"Test Message\"}` **Q: Can I use `Alphanumeric Identifier` from my paid plan via credit card?** A. `Alphanumeric Identifier` is only available on Telstra Account paid plans, not through credit card paid plans. **Q: How long does my dedicated number stay active for?** A. When you provision a dedicated number, by default it will be active for 30-days. You can use the `activeDays` parameter during the provisioning call to increment or decrement the number of days your dedicated number will remain active. **Q: What is the maximum sized MMS that I can send?** A. This will depend on the carrier that will receive the MMS. For Telstra it's up to 2MB, Optus up to 1.5MB and Vodafone only allows up to 500kB. You will need to check with international carriers for thier MMS size limits. **Q: Are SMILs supported by the Messaging API?** A. While there will be no error if you send an MMS with a SMIL presentation, the actual layout or sequence defined in the SMIL may not display as expected because most of the new smartphone devices ignore the SMIL presentation layer. SMIL was used in feature phones which had limited capability and SMIL allowed a *powerpoint type* presentation to be provided. Smartphones now have the capability to display video which is the better option for presentations. It is recommended that MMS messages should just drop the SMIL. **Q: How do I assign a delivery notification or callback URL?** A. You can assign a delivery notification or callback URL by adding the `notifyURL` parameter in the body of the request when you send a message. Once the message has been delivered, a notification will then be posted to this callback URL. **Q: What is the difference between the `notifyURL` parameter in the Provisoning call versus the `notifyURL` parameter in the Send Message call?** A. The `notifyURL` in the Provisoning call will be the URL where replies to the provisioned number will be posted. On the other hand, the `notifyURL` in the Send Message call will be the URL where the delivery notification will be posted, e.g. when an SMS has already been delivered to the recipient. # Getting Started Below are the steps to get started with the Telstra Messaging API. 1. Generate an OAuth2 token using your `Client key` and `Client secret`. 2. Use the Provisioning call to create a subscription and receive a dedicated number. 3. Send a message to a specific mobile number. ## Run in Postman \"Run ## Sample Apps - [Perl Sample App](https://github.com/telstra/MessagingAPI-perl-sample-app) - [Happy Chat App](https://github.com/telstra/messaging-sample-code-happy-chat) - [PHP Sample App](https://github.com/developersteve/telstra-messaging-php) ## SDK Repos - [Messaging API - PHP SDK](https://github.com/telstra/MessagingAPI-SDK-php) - [Messaging API - Python SDK](https://github.com/telstra/MessagingAPI-SDK-python) - [Messaging API - Ruby SDK](https://github.com/telstra/MessagingAPI-SDK-ruby) - [Messaging API - NodeJS SDK](https://github.com/telstra/MessagingAPI-SDK-node) - [Messaging API - .Net2 SDK](https://github.com/telstra/MessagingAPI-SDK-dotnet) - [Messaging API - Java SDK](https://github.com/telstra/MessagingAPI-SDK-Java) ## Blog Posts For more information on the Messaging API, you can read these blog posts: - [Callbacks Part 1](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-1) - [Callbacks Part 2](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-2) +#The Telstra Messaging API specification -OpenAPI spec version: 2.2.6 +The version of the OpenAPI document: 2.2.9 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.0.1 +OpenAPI Generator version: 4.2.3-SNAPSHOT =end diff --git a/spec/models/health_check_response_spec.rb b/spec/models/health_check_response_spec.rb new file mode 100644 index 0000000..487b5f1 --- /dev/null +++ b/spec/models/health_check_response_spec.rb @@ -0,0 +1,41 @@ +=begin +#Telstra Messaging API + +#The Telstra Messaging API specification + +The version of the OpenAPI document: 2.2.9 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 4.2.3-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Telstra_Messaging::HealthCheckResponse +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'HealthCheckResponse' do + before do + # run before each test + @instance = Telstra_Messaging::HealthCheckResponse.new + end + + after do + # run after each test + end + + describe 'test an instance of HealthCheckResponse' do + it 'should create an instance of HealthCheckResponse' do + expect(@instance).to be_instance_of(Telstra_Messaging::HealthCheckResponse) + end + end + describe 'test attribute "status"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/models/inbound_poll_response_spec.rb b/spec/models/inbound_poll_response_spec.rb index 568afac..7b9bff6 100644 --- a/spec/models/inbound_poll_response_spec.rb +++ b/spec/models/inbound_poll_response_spec.rb @@ -1,12 +1,12 @@ =begin #Telstra Messaging API -# # Introduction Send and receive SMS and MMS messages globally using Telstra’s enterprise grade Messaging API. It also allows your application to track the delivery status of both sent and received messages. Get your dedicated Australian number, and start sending and receiving messages today. # Features The Telstra Messaging API provides the features below. | Feature | Description | | --- | --- | | `Dedicated Number` | Provision a mobile number for your account to be used as `from` address in the API | | `Send Messages` | Sending SMS or MMS messages | | `Receive Messages` | Telstra will deliver messages sent to a dedicated number or to the `notifyURL` defined by you | | `Broadcast Messages` | Invoke a single API call to send a message to a list of numbers provided in `to` | | `Delivery Status` | Query the delivery status of your messages | | `Callbacks` | Provide a notification URL and Telstra will notify your app when a message status changes | | `Alphanumeric Identifier` | Differentiate yourself by providing an alphanumeric string in `from`. This feature is only available on paid plans | | `Concatenation` | Send messages up to 1900 characters long and Telstra will automaticaly segment and reassemble them | | `Reply Request` | Create a chat session by associating `messageId` and `to` number to track responses received from a mobile number. We will store this association for 8 days | | `Character set` | Accepts all Unicode characters as part of UTF-8 | | `Bounce-back response` | See if your SMS hits an unreachable or unallocated number (Australia Only) | | `Queuing` | Messaging API will automatically queue and deliver each message at a compliant rate. | | `Emoji Encoding` | The API supports the encoding of the full range of emojis. Emojis in the reply messages will be in their UTF-8 format. | ## Delivery Notification or Callbacks The API provides several methods for notifying when a message has been delivered to the destination. 1. When you send a message there is an opportunity to specify a `notifyURL`. Once the message has been delivered the API will make a call to this URL to advise of the message status. 2. If you do not specify a URL you can always call the `GET /status` API to get the status of the message. # Getting Access to the API 1. Register at [https://dev.telstra.com](https://dev.telstra.com). 2. After registration, login to [https://dev.telstra.com](https://dev.telstra.com) and navigate to the **My apps** page. 3. Create your application by clicking the **Add new app** button 4. Select **API Free Trial** Product when configuring your application. This Product includes the Telstra Messaging API as well as other free trial APIs. Your application will be approved automatically. 5. There is a maximum of 1000 free messages per developer. Additional messages and features can be purchased from [https://dev.telstra.com](https://dev.telstra.com). 6. Note your `Client key` and `Client secret` as these will be needed to provision a number for your application and for authentication. Now head over to **Getting Started** where you can find a postman collection as well as some links to sample apps and SDKs to get you started. Happy Messaging! # Frequently Asked Questions **Q: Is creating a subscription via the Provisioning call a required step?** A. Yes. You will only be able to start sending messages if you have a provisioned dedicated number. Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: When trying to send an SMS I receive a `400 Bad Request` response. How can I fix this?** A. You need to make sure you have a provisioned dedicated number before you can send an SMS. If you do not have a provisioned dedicated number and you try to send a message via the API, you will get the error below in the response:
{   \"status\":\"400\",   \"code\":\"DELIVERY-IMPOSSIBLE\",   \"message\":\"Invalid \\'from\\' address specified\" }
Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: Can I send a broadcast message using the Telstra Messaging API?** A. Yes. Recipient numbers can be in the form of an array of strings if a broadcast message needs to be sent, allowing you to send to multiple mobile numbers in one API call. A sample request body for this will be: `{\"to\":[\"+61412345678\",\"+61487654321\"],\"body\":\"Test Message\"}` **Q: Can I use `Alphanumeric Identifier` from my paid plan via credit card?** A. `Alphanumeric Identifier` is only available on Telstra Account paid plans, not through credit card paid plans. **Q: How long does my dedicated number stay active for?** A. When you provision a dedicated number, by default it will be active for 30-days. You can use the `activeDays` parameter during the provisioning call to increment or decrement the number of days your dedicated number will remain active. **Q: What is the maximum sized MMS that I can send?** A. This will depend on the carrier that will receive the MMS. For Telstra it's up to 2MB, Optus up to 1.5MB and Vodafone only allows up to 500kB. You will need to check with international carriers for thier MMS size limits. **Q: Are SMILs supported by the Messaging API?** A. While there will be no error if you send an MMS with a SMIL presentation, the actual layout or sequence defined in the SMIL may not display as expected because most of the new smartphone devices ignore the SMIL presentation layer. SMIL was used in feature phones which had limited capability and SMIL allowed a *powerpoint type* presentation to be provided. Smartphones now have the capability to display video which is the better option for presentations. It is recommended that MMS messages should just drop the SMIL. **Q: How do I assign a delivery notification or callback URL?** A. You can assign a delivery notification or callback URL by adding the `notifyURL` parameter in the body of the request when you send a message. Once the message has been delivered, a notification will then be posted to this callback URL. **Q: What is the difference between the `notifyURL` parameter in the Provisoning call versus the `notifyURL` parameter in the Send Message call?** A. The `notifyURL` in the Provisoning call will be the URL where replies to the provisioned number will be posted. On the other hand, the `notifyURL` in the Send Message call will be the URL where the delivery notification will be posted, e.g. when an SMS has already been delivered to the recipient. # Getting Started Below are the steps to get started with the Telstra Messaging API. 1. Generate an OAuth2 token using your `Client key` and `Client secret`. 2. Use the Provisioning call to create a subscription and receive a dedicated number. 3. Send a message to a specific mobile number. ## Run in Postman \"Run ## Sample Apps - [Perl Sample App](https://github.com/telstra/MessagingAPI-perl-sample-app) - [Happy Chat App](https://github.com/telstra/messaging-sample-code-happy-chat) - [PHP Sample App](https://github.com/developersteve/telstra-messaging-php) ## SDK Repos - [Messaging API - PHP SDK](https://github.com/telstra/MessagingAPI-SDK-php) - [Messaging API - Python SDK](https://github.com/telstra/MessagingAPI-SDK-python) - [Messaging API - Ruby SDK](https://github.com/telstra/MessagingAPI-SDK-ruby) - [Messaging API - NodeJS SDK](https://github.com/telstra/MessagingAPI-SDK-node) - [Messaging API - .Net2 SDK](https://github.com/telstra/MessagingAPI-SDK-dotnet) - [Messaging API - Java SDK](https://github.com/telstra/MessagingAPI-SDK-Java) ## Blog Posts For more information on the Messaging API, you can read these blog posts: - [Callbacks Part 1](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-1) - [Callbacks Part 2](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-2) +#The Telstra Messaging API specification -OpenAPI spec version: 2.2.6 +The version of the OpenAPI document: 2.2.9 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.0.1 +OpenAPI Generator version: 4.2.3-SNAPSHOT =end diff --git a/spec/models/message_multi_spec.rb b/spec/models/message_multi_spec.rb new file mode 100644 index 0000000..9676167 --- /dev/null +++ b/spec/models/message_multi_spec.rb @@ -0,0 +1,53 @@ +=begin +#Telstra Messaging API + +#The Telstra Messaging API specification + +The version of the OpenAPI document: 2.2.9 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 4.2.3-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Telstra_Messaging::MessageMulti +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'MessageMulti' do + before do + # run before each test + @instance = Telstra_Messaging::MessageMulti.new + end + + after do + # run after each test + end + + describe 'test an instance of MessageMulti' do + it 'should create an instance of MessageMulti' do + expect(@instance).to be_instance_of(Telstra_Messaging::MessageMulti) + end + end + describe 'test attribute "to"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "body"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "receipt_off"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/models/message_sent_response_mms_spec.rb b/spec/models/message_sent_response_mms_spec.rb new file mode 100644 index 0000000..d647eb4 --- /dev/null +++ b/spec/models/message_sent_response_mms_spec.rb @@ -0,0 +1,65 @@ +=begin +#Telstra Messaging API + +#The Telstra Messaging API specification + +The version of the OpenAPI document: 2.2.9 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 4.2.3-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Telstra_Messaging::MessageSentResponseMms +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'MessageSentResponseMms' do + before do + # run before each test + @instance = Telstra_Messaging::MessageSentResponseMms.new + end + + after do + # run after each test + end + + describe 'test an instance of MessageSentResponseMms' do + it 'should create an instance of MessageSentResponseMms' do + expect(@instance).to be_instance_of(Telstra_Messaging::MessageSentResponseMms) + end + end + describe 'test attribute "messages"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "mms_media_kb"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "country"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "message_type"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "number_segments"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/models/message_sent_response_sms_spec.rb b/spec/models/message_sent_response_sms_spec.rb new file mode 100644 index 0000000..2fc5bf0 --- /dev/null +++ b/spec/models/message_sent_response_sms_spec.rb @@ -0,0 +1,59 @@ +=begin +#Telstra Messaging API + +#The Telstra Messaging API specification + +The version of the OpenAPI document: 2.2.9 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 4.2.3-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Telstra_Messaging::MessageSentResponseSms +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'MessageSentResponseSms' do + before do + # run before each test + @instance = Telstra_Messaging::MessageSentResponseSms.new + end + + after do + # run after each test + end + + describe 'test an instance of MessageSentResponseSms' do + it 'should create an instance of MessageSentResponseSms' do + expect(@instance).to be_instance_of(Telstra_Messaging::MessageSentResponseSms) + end + end + describe 'test attribute "messages"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "country"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "message_type"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "number_segments"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/models/message_sent_response_spec.rb b/spec/models/message_sent_response_spec.rb deleted file mode 100644 index f2f0df2..0000000 --- a/spec/models/message_sent_response_spec.rb +++ /dev/null @@ -1,65 +0,0 @@ -=begin -#Telstra Messaging API - -# # Introduction Send and receive SMS and MMS messages globally using Telstra’s enterprise grade Messaging API. It also allows your application to track the delivery status of both sent and received messages. Get your dedicated Australian number, and start sending and receiving messages today. # Features The Telstra Messaging API provides the features below. | Feature | Description | | --- | --- | | `Dedicated Number` | Provision a mobile number for your account to be used as `from` address in the API | | `Send Messages` | Sending SMS or MMS messages | | `Receive Messages` | Telstra will deliver messages sent to a dedicated number or to the `notifyURL` defined by you | | `Broadcast Messages` | Invoke a single API call to send a message to a list of numbers provided in `to` | | `Delivery Status` | Query the delivery status of your messages | | `Callbacks` | Provide a notification URL and Telstra will notify your app when a message status changes | | `Alphanumeric Identifier` | Differentiate yourself by providing an alphanumeric string in `from`. This feature is only available on paid plans | | `Concatenation` | Send messages up to 1900 characters long and Telstra will automaticaly segment and reassemble them | | `Reply Request` | Create a chat session by associating `messageId` and `to` number to track responses received from a mobile number. We will store this association for 8 days | | `Character set` | Accepts all Unicode characters as part of UTF-8 | | `Bounce-back response` | See if your SMS hits an unreachable or unallocated number (Australia Only) | | `Queuing` | Messaging API will automatically queue and deliver each message at a compliant rate. | | `Emoji Encoding` | The API supports the encoding of the full range of emojis. Emojis in the reply messages will be in their UTF-8 format. | ## Delivery Notification or Callbacks The API provides several methods for notifying when a message has been delivered to the destination. 1. When you send a message there is an opportunity to specify a `notifyURL`. Once the message has been delivered the API will make a call to this URL to advise of the message status. 2. If you do not specify a URL you can always call the `GET /status` API to get the status of the message. # Getting Access to the API 1. Register at [https://dev.telstra.com](https://dev.telstra.com). 2. After registration, login to [https://dev.telstra.com](https://dev.telstra.com) and navigate to the **My apps** page. 3. Create your application by clicking the **Add new app** button 4. Select **API Free Trial** Product when configuring your application. This Product includes the Telstra Messaging API as well as other free trial APIs. Your application will be approved automatically. 5. There is a maximum of 1000 free messages per developer. Additional messages and features can be purchased from [https://dev.telstra.com](https://dev.telstra.com). 6. Note your `Client key` and `Client secret` as these will be needed to provision a number for your application and for authentication. Now head over to **Getting Started** where you can find a postman collection as well as some links to sample apps and SDKs to get you started. Happy Messaging! # Frequently Asked Questions **Q: Is creating a subscription via the Provisioning call a required step?** A. Yes. You will only be able to start sending messages if you have a provisioned dedicated number. Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: When trying to send an SMS I receive a `400 Bad Request` response. How can I fix this?** A. You need to make sure you have a provisioned dedicated number before you can send an SMS. If you do not have a provisioned dedicated number and you try to send a message via the API, you will get the error below in the response:
{   \"status\":\"400\",   \"code\":\"DELIVERY-IMPOSSIBLE\",   \"message\":\"Invalid \\'from\\' address specified\" }
Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: Can I send a broadcast message using the Telstra Messaging API?** A. Yes. Recipient numbers can be in the form of an array of strings if a broadcast message needs to be sent, allowing you to send to multiple mobile numbers in one API call. A sample request body for this will be: `{\"to\":[\"+61412345678\",\"+61487654321\"],\"body\":\"Test Message\"}` **Q: Can I use `Alphanumeric Identifier` from my paid plan via credit card?** A. `Alphanumeric Identifier` is only available on Telstra Account paid plans, not through credit card paid plans. **Q: How long does my dedicated number stay active for?** A. When you provision a dedicated number, by default it will be active for 30-days. You can use the `activeDays` parameter during the provisioning call to increment or decrement the number of days your dedicated number will remain active. **Q: What is the maximum sized MMS that I can send?** A. This will depend on the carrier that will receive the MMS. For Telstra it's up to 2MB, Optus up to 1.5MB and Vodafone only allows up to 500kB. You will need to check with international carriers for thier MMS size limits. **Q: Are SMILs supported by the Messaging API?** A. While there will be no error if you send an MMS with a SMIL presentation, the actual layout or sequence defined in the SMIL may not display as expected because most of the new smartphone devices ignore the SMIL presentation layer. SMIL was used in feature phones which had limited capability and SMIL allowed a *powerpoint type* presentation to be provided. Smartphones now have the capability to display video which is the better option for presentations. It is recommended that MMS messages should just drop the SMIL. **Q: How do I assign a delivery notification or callback URL?** A. You can assign a delivery notification or callback URL by adding the `notifyURL` parameter in the body of the request when you send a message. Once the message has been delivered, a notification will then be posted to this callback URL. **Q: What is the difference between the `notifyURL` parameter in the Provisoning call versus the `notifyURL` parameter in the Send Message call?** A. The `notifyURL` in the Provisoning call will be the URL where replies to the provisioned number will be posted. On the other hand, the `notifyURL` in the Send Message call will be the URL where the delivery notification will be posted, e.g. when an SMS has already been delivered to the recipient. # Getting Started Below are the steps to get started with the Telstra Messaging API. 1. Generate an OAuth2 token using your `Client key` and `Client secret`. 2. Use the Provisioning call to create a subscription and receive a dedicated number. 3. Send a message to a specific mobile number. ## Run in Postman \"Run ## Sample Apps - [Perl Sample App](https://github.com/telstra/MessagingAPI-perl-sample-app) - [Happy Chat App](https://github.com/telstra/messaging-sample-code-happy-chat) - [PHP Sample App](https://github.com/developersteve/telstra-messaging-php) ## SDK Repos - [Messaging API - PHP SDK](https://github.com/telstra/MessagingAPI-SDK-php) - [Messaging API - Python SDK](https://github.com/telstra/MessagingAPI-SDK-python) - [Messaging API - Ruby SDK](https://github.com/telstra/MessagingAPI-SDK-ruby) - [Messaging API - NodeJS SDK](https://github.com/telstra/MessagingAPI-SDK-node) - [Messaging API - .Net2 SDK](https://github.com/telstra/MessagingAPI-SDK-dotnet) - [Messaging API - Java SDK](https://github.com/telstra/MessagingAPI-SDK-Java) ## Blog Posts For more information on the Messaging API, you can read these blog posts: - [Callbacks Part 1](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-1) - [Callbacks Part 2](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-2) - -OpenAPI spec version: 2.2.6 - -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.0.1 - -=end - -require 'spec_helper' -require 'json' -require 'date' - -# Unit tests for Telstra_Messaging::MessageSentResponse -# Automatically generated by openapi-generator (https://openapi-generator.tech) -# Please update as you see appropriate -describe 'MessageSentResponse' do - before do - # run before each test - @instance = Telstra_Messaging::MessageSentResponse.new - end - - after do - # run after each test - end - - describe 'test an instance of MessageSentResponse' do - it 'should create an instance of MessageSentResponse' do - expect(@instance).to be_instance_of(Telstra_Messaging::MessageSentResponse) - end - end - describe 'test attribute "messages"' do - it 'should work' do - # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers - end - end - - describe 'test attribute "message_type"' do - it 'should work' do - # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers - end - end - - describe 'test attribute "number_segments"' do - it 'should work' do - # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers - end - end - - describe 'test attribute "number_national_destinations"' do - it 'should work' do - # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers - end - end - - describe 'test attribute "number_international_destinations"' do - it 'should work' do - # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers - end - end - -end diff --git a/spec/models/message_spec.rb b/spec/models/message_spec.rb index c659c34..0c12814 100644 --- a/spec/models/message_spec.rb +++ b/spec/models/message_spec.rb @@ -1,12 +1,12 @@ =begin #Telstra Messaging API -# # Introduction Send and receive SMS and MMS messages globally using Telstra’s enterprise grade Messaging API. It also allows your application to track the delivery status of both sent and received messages. Get your dedicated Australian number, and start sending and receiving messages today. # Features The Telstra Messaging API provides the features below. | Feature | Description | | --- | --- | | `Dedicated Number` | Provision a mobile number for your account to be used as `from` address in the API | | `Send Messages` | Sending SMS or MMS messages | | `Receive Messages` | Telstra will deliver messages sent to a dedicated number or to the `notifyURL` defined by you | | `Broadcast Messages` | Invoke a single API call to send a message to a list of numbers provided in `to` | | `Delivery Status` | Query the delivery status of your messages | | `Callbacks` | Provide a notification URL and Telstra will notify your app when a message status changes | | `Alphanumeric Identifier` | Differentiate yourself by providing an alphanumeric string in `from`. This feature is only available on paid plans | | `Concatenation` | Send messages up to 1900 characters long and Telstra will automaticaly segment and reassemble them | | `Reply Request` | Create a chat session by associating `messageId` and `to` number to track responses received from a mobile number. We will store this association for 8 days | | `Character set` | Accepts all Unicode characters as part of UTF-8 | | `Bounce-back response` | See if your SMS hits an unreachable or unallocated number (Australia Only) | | `Queuing` | Messaging API will automatically queue and deliver each message at a compliant rate. | | `Emoji Encoding` | The API supports the encoding of the full range of emojis. Emojis in the reply messages will be in their UTF-8 format. | ## Delivery Notification or Callbacks The API provides several methods for notifying when a message has been delivered to the destination. 1. When you send a message there is an opportunity to specify a `notifyURL`. Once the message has been delivered the API will make a call to this URL to advise of the message status. 2. If you do not specify a URL you can always call the `GET /status` API to get the status of the message. # Getting Access to the API 1. Register at [https://dev.telstra.com](https://dev.telstra.com). 2. After registration, login to [https://dev.telstra.com](https://dev.telstra.com) and navigate to the **My apps** page. 3. Create your application by clicking the **Add new app** button 4. Select **API Free Trial** Product when configuring your application. This Product includes the Telstra Messaging API as well as other free trial APIs. Your application will be approved automatically. 5. There is a maximum of 1000 free messages per developer. Additional messages and features can be purchased from [https://dev.telstra.com](https://dev.telstra.com). 6. Note your `Client key` and `Client secret` as these will be needed to provision a number for your application and for authentication. Now head over to **Getting Started** where you can find a postman collection as well as some links to sample apps and SDKs to get you started. Happy Messaging! # Frequently Asked Questions **Q: Is creating a subscription via the Provisioning call a required step?** A. Yes. You will only be able to start sending messages if you have a provisioned dedicated number. Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: When trying to send an SMS I receive a `400 Bad Request` response. How can I fix this?** A. You need to make sure you have a provisioned dedicated number before you can send an SMS. If you do not have a provisioned dedicated number and you try to send a message via the API, you will get the error below in the response:
{   \"status\":\"400\",   \"code\":\"DELIVERY-IMPOSSIBLE\",   \"message\":\"Invalid \\'from\\' address specified\" }
Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: Can I send a broadcast message using the Telstra Messaging API?** A. Yes. Recipient numbers can be in the form of an array of strings if a broadcast message needs to be sent, allowing you to send to multiple mobile numbers in one API call. A sample request body for this will be: `{\"to\":[\"+61412345678\",\"+61487654321\"],\"body\":\"Test Message\"}` **Q: Can I use `Alphanumeric Identifier` from my paid plan via credit card?** A. `Alphanumeric Identifier` is only available on Telstra Account paid plans, not through credit card paid plans. **Q: How long does my dedicated number stay active for?** A. When you provision a dedicated number, by default it will be active for 30-days. You can use the `activeDays` parameter during the provisioning call to increment or decrement the number of days your dedicated number will remain active. **Q: What is the maximum sized MMS that I can send?** A. This will depend on the carrier that will receive the MMS. For Telstra it's up to 2MB, Optus up to 1.5MB and Vodafone only allows up to 500kB. You will need to check with international carriers for thier MMS size limits. **Q: Are SMILs supported by the Messaging API?** A. While there will be no error if you send an MMS with a SMIL presentation, the actual layout or sequence defined in the SMIL may not display as expected because most of the new smartphone devices ignore the SMIL presentation layer. SMIL was used in feature phones which had limited capability and SMIL allowed a *powerpoint type* presentation to be provided. Smartphones now have the capability to display video which is the better option for presentations. It is recommended that MMS messages should just drop the SMIL. **Q: How do I assign a delivery notification or callback URL?** A. You can assign a delivery notification or callback URL by adding the `notifyURL` parameter in the body of the request when you send a message. Once the message has been delivered, a notification will then be posted to this callback URL. **Q: What is the difference between the `notifyURL` parameter in the Provisoning call versus the `notifyURL` parameter in the Send Message call?** A. The `notifyURL` in the Provisoning call will be the URL where replies to the provisioned number will be posted. On the other hand, the `notifyURL` in the Send Message call will be the URL where the delivery notification will be posted, e.g. when an SMS has already been delivered to the recipient. # Getting Started Below are the steps to get started with the Telstra Messaging API. 1. Generate an OAuth2 token using your `Client key` and `Client secret`. 2. Use the Provisioning call to create a subscription and receive a dedicated number. 3. Send a message to a specific mobile number. ## Run in Postman \"Run ## Sample Apps - [Perl Sample App](https://github.com/telstra/MessagingAPI-perl-sample-app) - [Happy Chat App](https://github.com/telstra/messaging-sample-code-happy-chat) - [PHP Sample App](https://github.com/developersteve/telstra-messaging-php) ## SDK Repos - [Messaging API - PHP SDK](https://github.com/telstra/MessagingAPI-SDK-php) - [Messaging API - Python SDK](https://github.com/telstra/MessagingAPI-SDK-python) - [Messaging API - Ruby SDK](https://github.com/telstra/MessagingAPI-SDK-ruby) - [Messaging API - NodeJS SDK](https://github.com/telstra/MessagingAPI-SDK-node) - [Messaging API - .Net2 SDK](https://github.com/telstra/MessagingAPI-SDK-dotnet) - [Messaging API - Java SDK](https://github.com/telstra/MessagingAPI-SDK-Java) ## Blog Posts For more information on the Messaging API, you can read these blog posts: - [Callbacks Part 1](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-1) - [Callbacks Part 2](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-2) +#The Telstra Messaging API specification -OpenAPI spec version: 2.2.6 +The version of the OpenAPI document: 2.2.9 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.0.1 +OpenAPI Generator version: 4.2.3-SNAPSHOT =end diff --git a/spec/models/mms_content_spec.rb b/spec/models/mms_content_spec.rb index 2a667db..3accdac 100644 --- a/spec/models/mms_content_spec.rb +++ b/spec/models/mms_content_spec.rb @@ -1,12 +1,12 @@ =begin #Telstra Messaging API -# # Introduction Send and receive SMS and MMS messages globally using Telstra’s enterprise grade Messaging API. It also allows your application to track the delivery status of both sent and received messages. Get your dedicated Australian number, and start sending and receiving messages today. # Features The Telstra Messaging API provides the features below. | Feature | Description | | --- | --- | | `Dedicated Number` | Provision a mobile number for your account to be used as `from` address in the API | | `Send Messages` | Sending SMS or MMS messages | | `Receive Messages` | Telstra will deliver messages sent to a dedicated number or to the `notifyURL` defined by you | | `Broadcast Messages` | Invoke a single API call to send a message to a list of numbers provided in `to` | | `Delivery Status` | Query the delivery status of your messages | | `Callbacks` | Provide a notification URL and Telstra will notify your app when a message status changes | | `Alphanumeric Identifier` | Differentiate yourself by providing an alphanumeric string in `from`. This feature is only available on paid plans | | `Concatenation` | Send messages up to 1900 characters long and Telstra will automaticaly segment and reassemble them | | `Reply Request` | Create a chat session by associating `messageId` and `to` number to track responses received from a mobile number. We will store this association for 8 days | | `Character set` | Accepts all Unicode characters as part of UTF-8 | | `Bounce-back response` | See if your SMS hits an unreachable or unallocated number (Australia Only) | | `Queuing` | Messaging API will automatically queue and deliver each message at a compliant rate. | | `Emoji Encoding` | The API supports the encoding of the full range of emojis. Emojis in the reply messages will be in their UTF-8 format. | ## Delivery Notification or Callbacks The API provides several methods for notifying when a message has been delivered to the destination. 1. When you send a message there is an opportunity to specify a `notifyURL`. Once the message has been delivered the API will make a call to this URL to advise of the message status. 2. If you do not specify a URL you can always call the `GET /status` API to get the status of the message. # Getting Access to the API 1. Register at [https://dev.telstra.com](https://dev.telstra.com). 2. After registration, login to [https://dev.telstra.com](https://dev.telstra.com) and navigate to the **My apps** page. 3. Create your application by clicking the **Add new app** button 4. Select **API Free Trial** Product when configuring your application. This Product includes the Telstra Messaging API as well as other free trial APIs. Your application will be approved automatically. 5. There is a maximum of 1000 free messages per developer. Additional messages and features can be purchased from [https://dev.telstra.com](https://dev.telstra.com). 6. Note your `Client key` and `Client secret` as these will be needed to provision a number for your application and for authentication. Now head over to **Getting Started** where you can find a postman collection as well as some links to sample apps and SDKs to get you started. Happy Messaging! # Frequently Asked Questions **Q: Is creating a subscription via the Provisioning call a required step?** A. Yes. You will only be able to start sending messages if you have a provisioned dedicated number. Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: When trying to send an SMS I receive a `400 Bad Request` response. How can I fix this?** A. You need to make sure you have a provisioned dedicated number before you can send an SMS. If you do not have a provisioned dedicated number and you try to send a message via the API, you will get the error below in the response:
{   \"status\":\"400\",   \"code\":\"DELIVERY-IMPOSSIBLE\",   \"message\":\"Invalid \\'from\\' address specified\" }
Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: Can I send a broadcast message using the Telstra Messaging API?** A. Yes. Recipient numbers can be in the form of an array of strings if a broadcast message needs to be sent, allowing you to send to multiple mobile numbers in one API call. A sample request body for this will be: `{\"to\":[\"+61412345678\",\"+61487654321\"],\"body\":\"Test Message\"}` **Q: Can I use `Alphanumeric Identifier` from my paid plan via credit card?** A. `Alphanumeric Identifier` is only available on Telstra Account paid plans, not through credit card paid plans. **Q: How long does my dedicated number stay active for?** A. When you provision a dedicated number, by default it will be active for 30-days. You can use the `activeDays` parameter during the provisioning call to increment or decrement the number of days your dedicated number will remain active. **Q: What is the maximum sized MMS that I can send?** A. This will depend on the carrier that will receive the MMS. For Telstra it's up to 2MB, Optus up to 1.5MB and Vodafone only allows up to 500kB. You will need to check with international carriers for thier MMS size limits. **Q: Are SMILs supported by the Messaging API?** A. While there will be no error if you send an MMS with a SMIL presentation, the actual layout or sequence defined in the SMIL may not display as expected because most of the new smartphone devices ignore the SMIL presentation layer. SMIL was used in feature phones which had limited capability and SMIL allowed a *powerpoint type* presentation to be provided. Smartphones now have the capability to display video which is the better option for presentations. It is recommended that MMS messages should just drop the SMIL. **Q: How do I assign a delivery notification or callback URL?** A. You can assign a delivery notification or callback URL by adding the `notifyURL` parameter in the body of the request when you send a message. Once the message has been delivered, a notification will then be posted to this callback URL. **Q: What is the difference between the `notifyURL` parameter in the Provisoning call versus the `notifyURL` parameter in the Send Message call?** A. The `notifyURL` in the Provisoning call will be the URL where replies to the provisioned number will be posted. On the other hand, the `notifyURL` in the Send Message call will be the URL where the delivery notification will be posted, e.g. when an SMS has already been delivered to the recipient. # Getting Started Below are the steps to get started with the Telstra Messaging API. 1. Generate an OAuth2 token using your `Client key` and `Client secret`. 2. Use the Provisioning call to create a subscription and receive a dedicated number. 3. Send a message to a specific mobile number. ## Run in Postman \"Run ## Sample Apps - [Perl Sample App](https://github.com/telstra/MessagingAPI-perl-sample-app) - [Happy Chat App](https://github.com/telstra/messaging-sample-code-happy-chat) - [PHP Sample App](https://github.com/developersteve/telstra-messaging-php) ## SDK Repos - [Messaging API - PHP SDK](https://github.com/telstra/MessagingAPI-SDK-php) - [Messaging API - Python SDK](https://github.com/telstra/MessagingAPI-SDK-python) - [Messaging API - Ruby SDK](https://github.com/telstra/MessagingAPI-SDK-ruby) - [Messaging API - NodeJS SDK](https://github.com/telstra/MessagingAPI-SDK-node) - [Messaging API - .Net2 SDK](https://github.com/telstra/MessagingAPI-SDK-dotnet) - [Messaging API - Java SDK](https://github.com/telstra/MessagingAPI-SDK-Java) ## Blog Posts For more information on the Messaging API, you can read these blog posts: - [Callbacks Part 1](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-1) - [Callbacks Part 2](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-2) +#The Telstra Messaging API specification -OpenAPI spec version: 2.2.6 +The version of the OpenAPI document: 2.2.9 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.0.1 +OpenAPI Generator version: 4.2.3-SNAPSHOT =end diff --git a/spec/models/o_auth_response_spec.rb b/spec/models/o_auth_response_spec.rb index 7e956f5..959974b 100644 --- a/spec/models/o_auth_response_spec.rb +++ b/spec/models/o_auth_response_spec.rb @@ -1,12 +1,12 @@ =begin #Telstra Messaging API -# # Introduction Send and receive SMS and MMS messages globally using Telstra’s enterprise grade Messaging API. It also allows your application to track the delivery status of both sent and received messages. Get your dedicated Australian number, and start sending and receiving messages today. # Features The Telstra Messaging API provides the features below. | Feature | Description | | --- | --- | | `Dedicated Number` | Provision a mobile number for your account to be used as `from` address in the API | | `Send Messages` | Sending SMS or MMS messages | | `Receive Messages` | Telstra will deliver messages sent to a dedicated number or to the `notifyURL` defined by you | | `Broadcast Messages` | Invoke a single API call to send a message to a list of numbers provided in `to` | | `Delivery Status` | Query the delivery status of your messages | | `Callbacks` | Provide a notification URL and Telstra will notify your app when a message status changes | | `Alphanumeric Identifier` | Differentiate yourself by providing an alphanumeric string in `from`. This feature is only available on paid plans | | `Concatenation` | Send messages up to 1900 characters long and Telstra will automaticaly segment and reassemble them | | `Reply Request` | Create a chat session by associating `messageId` and `to` number to track responses received from a mobile number. We will store this association for 8 days | | `Character set` | Accepts all Unicode characters as part of UTF-8 | | `Bounce-back response` | See if your SMS hits an unreachable or unallocated number (Australia Only) | | `Queuing` | Messaging API will automatically queue and deliver each message at a compliant rate. | | `Emoji Encoding` | The API supports the encoding of the full range of emojis. Emojis in the reply messages will be in their UTF-8 format. | ## Delivery Notification or Callbacks The API provides several methods for notifying when a message has been delivered to the destination. 1. When you send a message there is an opportunity to specify a `notifyURL`. Once the message has been delivered the API will make a call to this URL to advise of the message status. 2. If you do not specify a URL you can always call the `GET /status` API to get the status of the message. # Getting Access to the API 1. Register at [https://dev.telstra.com](https://dev.telstra.com). 2. After registration, login to [https://dev.telstra.com](https://dev.telstra.com) and navigate to the **My apps** page. 3. Create your application by clicking the **Add new app** button 4. Select **API Free Trial** Product when configuring your application. This Product includes the Telstra Messaging API as well as other free trial APIs. Your application will be approved automatically. 5. There is a maximum of 1000 free messages per developer. Additional messages and features can be purchased from [https://dev.telstra.com](https://dev.telstra.com). 6. Note your `Client key` and `Client secret` as these will be needed to provision a number for your application and for authentication. Now head over to **Getting Started** where you can find a postman collection as well as some links to sample apps and SDKs to get you started. Happy Messaging! # Frequently Asked Questions **Q: Is creating a subscription via the Provisioning call a required step?** A. Yes. You will only be able to start sending messages if you have a provisioned dedicated number. Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: When trying to send an SMS I receive a `400 Bad Request` response. How can I fix this?** A. You need to make sure you have a provisioned dedicated number before you can send an SMS. If you do not have a provisioned dedicated number and you try to send a message via the API, you will get the error below in the response:
{   \"status\":\"400\",   \"code\":\"DELIVERY-IMPOSSIBLE\",   \"message\":\"Invalid \\'from\\' address specified\" }
Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: Can I send a broadcast message using the Telstra Messaging API?** A. Yes. Recipient numbers can be in the form of an array of strings if a broadcast message needs to be sent, allowing you to send to multiple mobile numbers in one API call. A sample request body for this will be: `{\"to\":[\"+61412345678\",\"+61487654321\"],\"body\":\"Test Message\"}` **Q: Can I use `Alphanumeric Identifier` from my paid plan via credit card?** A. `Alphanumeric Identifier` is only available on Telstra Account paid plans, not through credit card paid plans. **Q: How long does my dedicated number stay active for?** A. When you provision a dedicated number, by default it will be active for 30-days. You can use the `activeDays` parameter during the provisioning call to increment or decrement the number of days your dedicated number will remain active. **Q: What is the maximum sized MMS that I can send?** A. This will depend on the carrier that will receive the MMS. For Telstra it's up to 2MB, Optus up to 1.5MB and Vodafone only allows up to 500kB. You will need to check with international carriers for thier MMS size limits. **Q: Are SMILs supported by the Messaging API?** A. While there will be no error if you send an MMS with a SMIL presentation, the actual layout or sequence defined in the SMIL may not display as expected because most of the new smartphone devices ignore the SMIL presentation layer. SMIL was used in feature phones which had limited capability and SMIL allowed a *powerpoint type* presentation to be provided. Smartphones now have the capability to display video which is the better option for presentations. It is recommended that MMS messages should just drop the SMIL. **Q: How do I assign a delivery notification or callback URL?** A. You can assign a delivery notification or callback URL by adding the `notifyURL` parameter in the body of the request when you send a message. Once the message has been delivered, a notification will then be posted to this callback URL. **Q: What is the difference between the `notifyURL` parameter in the Provisoning call versus the `notifyURL` parameter in the Send Message call?** A. The `notifyURL` in the Provisoning call will be the URL where replies to the provisioned number will be posted. On the other hand, the `notifyURL` in the Send Message call will be the URL where the delivery notification will be posted, e.g. when an SMS has already been delivered to the recipient. # Getting Started Below are the steps to get started with the Telstra Messaging API. 1. Generate an OAuth2 token using your `Client key` and `Client secret`. 2. Use the Provisioning call to create a subscription and receive a dedicated number. 3. Send a message to a specific mobile number. ## Run in Postman \"Run ## Sample Apps - [Perl Sample App](https://github.com/telstra/MessagingAPI-perl-sample-app) - [Happy Chat App](https://github.com/telstra/messaging-sample-code-happy-chat) - [PHP Sample App](https://github.com/developersteve/telstra-messaging-php) ## SDK Repos - [Messaging API - PHP SDK](https://github.com/telstra/MessagingAPI-SDK-php) - [Messaging API - Python SDK](https://github.com/telstra/MessagingAPI-SDK-python) - [Messaging API - Ruby SDK](https://github.com/telstra/MessagingAPI-SDK-ruby) - [Messaging API - NodeJS SDK](https://github.com/telstra/MessagingAPI-SDK-node) - [Messaging API - .Net2 SDK](https://github.com/telstra/MessagingAPI-SDK-dotnet) - [Messaging API - Java SDK](https://github.com/telstra/MessagingAPI-SDK-Java) ## Blog Posts For more information on the Messaging API, you can read these blog posts: - [Callbacks Part 1](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-1) - [Callbacks Part 2](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-2) +#The Telstra Messaging API specification -OpenAPI spec version: 2.2.6 +The version of the OpenAPI document: 2.2.9 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.0.1 +OpenAPI Generator version: 4.2.3-SNAPSHOT =end diff --git a/spec/models/outbound_poll_response_spec.rb b/spec/models/outbound_poll_response_spec.rb index 92d83d5..0975422 100644 --- a/spec/models/outbound_poll_response_spec.rb +++ b/spec/models/outbound_poll_response_spec.rb @@ -1,12 +1,12 @@ =begin #Telstra Messaging API -# # Introduction Send and receive SMS and MMS messages globally using Telstra’s enterprise grade Messaging API. It also allows your application to track the delivery status of both sent and received messages. Get your dedicated Australian number, and start sending and receiving messages today. # Features The Telstra Messaging API provides the features below. | Feature | Description | | --- | --- | | `Dedicated Number` | Provision a mobile number for your account to be used as `from` address in the API | | `Send Messages` | Sending SMS or MMS messages | | `Receive Messages` | Telstra will deliver messages sent to a dedicated number or to the `notifyURL` defined by you | | `Broadcast Messages` | Invoke a single API call to send a message to a list of numbers provided in `to` | | `Delivery Status` | Query the delivery status of your messages | | `Callbacks` | Provide a notification URL and Telstra will notify your app when a message status changes | | `Alphanumeric Identifier` | Differentiate yourself by providing an alphanumeric string in `from`. This feature is only available on paid plans | | `Concatenation` | Send messages up to 1900 characters long and Telstra will automaticaly segment and reassemble them | | `Reply Request` | Create a chat session by associating `messageId` and `to` number to track responses received from a mobile number. We will store this association for 8 days | | `Character set` | Accepts all Unicode characters as part of UTF-8 | | `Bounce-back response` | See if your SMS hits an unreachable or unallocated number (Australia Only) | | `Queuing` | Messaging API will automatically queue and deliver each message at a compliant rate. | | `Emoji Encoding` | The API supports the encoding of the full range of emojis. Emojis in the reply messages will be in their UTF-8 format. | ## Delivery Notification or Callbacks The API provides several methods for notifying when a message has been delivered to the destination. 1. When you send a message there is an opportunity to specify a `notifyURL`. Once the message has been delivered the API will make a call to this URL to advise of the message status. 2. If you do not specify a URL you can always call the `GET /status` API to get the status of the message. # Getting Access to the API 1. Register at [https://dev.telstra.com](https://dev.telstra.com). 2. After registration, login to [https://dev.telstra.com](https://dev.telstra.com) and navigate to the **My apps** page. 3. Create your application by clicking the **Add new app** button 4. Select **API Free Trial** Product when configuring your application. This Product includes the Telstra Messaging API as well as other free trial APIs. Your application will be approved automatically. 5. There is a maximum of 1000 free messages per developer. Additional messages and features can be purchased from [https://dev.telstra.com](https://dev.telstra.com). 6. Note your `Client key` and `Client secret` as these will be needed to provision a number for your application and for authentication. Now head over to **Getting Started** where you can find a postman collection as well as some links to sample apps and SDKs to get you started. Happy Messaging! # Frequently Asked Questions **Q: Is creating a subscription via the Provisioning call a required step?** A. Yes. You will only be able to start sending messages if you have a provisioned dedicated number. Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: When trying to send an SMS I receive a `400 Bad Request` response. How can I fix this?** A. You need to make sure you have a provisioned dedicated number before you can send an SMS. If you do not have a provisioned dedicated number and you try to send a message via the API, you will get the error below in the response:
{   \"status\":\"400\",   \"code\":\"DELIVERY-IMPOSSIBLE\",   \"message\":\"Invalid \\'from\\' address specified\" }
Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: Can I send a broadcast message using the Telstra Messaging API?** A. Yes. Recipient numbers can be in the form of an array of strings if a broadcast message needs to be sent, allowing you to send to multiple mobile numbers in one API call. A sample request body for this will be: `{\"to\":[\"+61412345678\",\"+61487654321\"],\"body\":\"Test Message\"}` **Q: Can I use `Alphanumeric Identifier` from my paid plan via credit card?** A. `Alphanumeric Identifier` is only available on Telstra Account paid plans, not through credit card paid plans. **Q: How long does my dedicated number stay active for?** A. When you provision a dedicated number, by default it will be active for 30-days. You can use the `activeDays` parameter during the provisioning call to increment or decrement the number of days your dedicated number will remain active. **Q: What is the maximum sized MMS that I can send?** A. This will depend on the carrier that will receive the MMS. For Telstra it's up to 2MB, Optus up to 1.5MB and Vodafone only allows up to 500kB. You will need to check with international carriers for thier MMS size limits. **Q: Are SMILs supported by the Messaging API?** A. While there will be no error if you send an MMS with a SMIL presentation, the actual layout or sequence defined in the SMIL may not display as expected because most of the new smartphone devices ignore the SMIL presentation layer. SMIL was used in feature phones which had limited capability and SMIL allowed a *powerpoint type* presentation to be provided. Smartphones now have the capability to display video which is the better option for presentations. It is recommended that MMS messages should just drop the SMIL. **Q: How do I assign a delivery notification or callback URL?** A. You can assign a delivery notification or callback URL by adding the `notifyURL` parameter in the body of the request when you send a message. Once the message has been delivered, a notification will then be posted to this callback URL. **Q: What is the difference between the `notifyURL` parameter in the Provisoning call versus the `notifyURL` parameter in the Send Message call?** A. The `notifyURL` in the Provisoning call will be the URL where replies to the provisioned number will be posted. On the other hand, the `notifyURL` in the Send Message call will be the URL where the delivery notification will be posted, e.g. when an SMS has already been delivered to the recipient. # Getting Started Below are the steps to get started with the Telstra Messaging API. 1. Generate an OAuth2 token using your `Client key` and `Client secret`. 2. Use the Provisioning call to create a subscription and receive a dedicated number. 3. Send a message to a specific mobile number. ## Run in Postman \"Run ## Sample Apps - [Perl Sample App](https://github.com/telstra/MessagingAPI-perl-sample-app) - [Happy Chat App](https://github.com/telstra/messaging-sample-code-happy-chat) - [PHP Sample App](https://github.com/developersteve/telstra-messaging-php) ## SDK Repos - [Messaging API - PHP SDK](https://github.com/telstra/MessagingAPI-SDK-php) - [Messaging API - Python SDK](https://github.com/telstra/MessagingAPI-SDK-python) - [Messaging API - Ruby SDK](https://github.com/telstra/MessagingAPI-SDK-ruby) - [Messaging API - NodeJS SDK](https://github.com/telstra/MessagingAPI-SDK-node) - [Messaging API - .Net2 SDK](https://github.com/telstra/MessagingAPI-SDK-dotnet) - [Messaging API - Java SDK](https://github.com/telstra/MessagingAPI-SDK-Java) ## Blog Posts For more information on the Messaging API, you can read these blog posts: - [Callbacks Part 1](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-1) - [Callbacks Part 2](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-2) +#The Telstra Messaging API specification -OpenAPI spec version: 2.2.6 +The version of the OpenAPI document: 2.2.9 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.0.1 +OpenAPI Generator version: 4.2.3-SNAPSHOT =end diff --git a/spec/models/provision_number_request_spec.rb b/spec/models/provision_number_request_spec.rb index ed1b4d4..7dca146 100644 --- a/spec/models/provision_number_request_spec.rb +++ b/spec/models/provision_number_request_spec.rb @@ -1,12 +1,12 @@ =begin #Telstra Messaging API -# # Introduction Send and receive SMS and MMS messages globally using Telstra’s enterprise grade Messaging API. It also allows your application to track the delivery status of both sent and received messages. Get your dedicated Australian number, and start sending and receiving messages today. # Features The Telstra Messaging API provides the features below. | Feature | Description | | --- | --- | | `Dedicated Number` | Provision a mobile number for your account to be used as `from` address in the API | | `Send Messages` | Sending SMS or MMS messages | | `Receive Messages` | Telstra will deliver messages sent to a dedicated number or to the `notifyURL` defined by you | | `Broadcast Messages` | Invoke a single API call to send a message to a list of numbers provided in `to` | | `Delivery Status` | Query the delivery status of your messages | | `Callbacks` | Provide a notification URL and Telstra will notify your app when a message status changes | | `Alphanumeric Identifier` | Differentiate yourself by providing an alphanumeric string in `from`. This feature is only available on paid plans | | `Concatenation` | Send messages up to 1900 characters long and Telstra will automaticaly segment and reassemble them | | `Reply Request` | Create a chat session by associating `messageId` and `to` number to track responses received from a mobile number. We will store this association for 8 days | | `Character set` | Accepts all Unicode characters as part of UTF-8 | | `Bounce-back response` | See if your SMS hits an unreachable or unallocated number (Australia Only) | | `Queuing` | Messaging API will automatically queue and deliver each message at a compliant rate. | | `Emoji Encoding` | The API supports the encoding of the full range of emojis. Emojis in the reply messages will be in their UTF-8 format. | ## Delivery Notification or Callbacks The API provides several methods for notifying when a message has been delivered to the destination. 1. When you send a message there is an opportunity to specify a `notifyURL`. Once the message has been delivered the API will make a call to this URL to advise of the message status. 2. If you do not specify a URL you can always call the `GET /status` API to get the status of the message. # Getting Access to the API 1. Register at [https://dev.telstra.com](https://dev.telstra.com). 2. After registration, login to [https://dev.telstra.com](https://dev.telstra.com) and navigate to the **My apps** page. 3. Create your application by clicking the **Add new app** button 4. Select **API Free Trial** Product when configuring your application. This Product includes the Telstra Messaging API as well as other free trial APIs. Your application will be approved automatically. 5. There is a maximum of 1000 free messages per developer. Additional messages and features can be purchased from [https://dev.telstra.com](https://dev.telstra.com). 6. Note your `Client key` and `Client secret` as these will be needed to provision a number for your application and for authentication. Now head over to **Getting Started** where you can find a postman collection as well as some links to sample apps and SDKs to get you started. Happy Messaging! # Frequently Asked Questions **Q: Is creating a subscription via the Provisioning call a required step?** A. Yes. You will only be able to start sending messages if you have a provisioned dedicated number. Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: When trying to send an SMS I receive a `400 Bad Request` response. How can I fix this?** A. You need to make sure you have a provisioned dedicated number before you can send an SMS. If you do not have a provisioned dedicated number and you try to send a message via the API, you will get the error below in the response:
{   \"status\":\"400\",   \"code\":\"DELIVERY-IMPOSSIBLE\",   \"message\":\"Invalid \\'from\\' address specified\" }
Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: Can I send a broadcast message using the Telstra Messaging API?** A. Yes. Recipient numbers can be in the form of an array of strings if a broadcast message needs to be sent, allowing you to send to multiple mobile numbers in one API call. A sample request body for this will be: `{\"to\":[\"+61412345678\",\"+61487654321\"],\"body\":\"Test Message\"}` **Q: Can I use `Alphanumeric Identifier` from my paid plan via credit card?** A. `Alphanumeric Identifier` is only available on Telstra Account paid plans, not through credit card paid plans. **Q: How long does my dedicated number stay active for?** A. When you provision a dedicated number, by default it will be active for 30-days. You can use the `activeDays` parameter during the provisioning call to increment or decrement the number of days your dedicated number will remain active. **Q: What is the maximum sized MMS that I can send?** A. This will depend on the carrier that will receive the MMS. For Telstra it's up to 2MB, Optus up to 1.5MB and Vodafone only allows up to 500kB. You will need to check with international carriers for thier MMS size limits. **Q: Are SMILs supported by the Messaging API?** A. While there will be no error if you send an MMS with a SMIL presentation, the actual layout or sequence defined in the SMIL may not display as expected because most of the new smartphone devices ignore the SMIL presentation layer. SMIL was used in feature phones which had limited capability and SMIL allowed a *powerpoint type* presentation to be provided. Smartphones now have the capability to display video which is the better option for presentations. It is recommended that MMS messages should just drop the SMIL. **Q: How do I assign a delivery notification or callback URL?** A. You can assign a delivery notification or callback URL by adding the `notifyURL` parameter in the body of the request when you send a message. Once the message has been delivered, a notification will then be posted to this callback URL. **Q: What is the difference between the `notifyURL` parameter in the Provisoning call versus the `notifyURL` parameter in the Send Message call?** A. The `notifyURL` in the Provisoning call will be the URL where replies to the provisioned number will be posted. On the other hand, the `notifyURL` in the Send Message call will be the URL where the delivery notification will be posted, e.g. when an SMS has already been delivered to the recipient. # Getting Started Below are the steps to get started with the Telstra Messaging API. 1. Generate an OAuth2 token using your `Client key` and `Client secret`. 2. Use the Provisioning call to create a subscription and receive a dedicated number. 3. Send a message to a specific mobile number. ## Run in Postman \"Run ## Sample Apps - [Perl Sample App](https://github.com/telstra/MessagingAPI-perl-sample-app) - [Happy Chat App](https://github.com/telstra/messaging-sample-code-happy-chat) - [PHP Sample App](https://github.com/developersteve/telstra-messaging-php) ## SDK Repos - [Messaging API - PHP SDK](https://github.com/telstra/MessagingAPI-SDK-php) - [Messaging API - Python SDK](https://github.com/telstra/MessagingAPI-SDK-python) - [Messaging API - Ruby SDK](https://github.com/telstra/MessagingAPI-SDK-ruby) - [Messaging API - NodeJS SDK](https://github.com/telstra/MessagingAPI-SDK-node) - [Messaging API - .Net2 SDK](https://github.com/telstra/MessagingAPI-SDK-dotnet) - [Messaging API - Java SDK](https://github.com/telstra/MessagingAPI-SDK-Java) ## Blog Posts For more information on the Messaging API, you can read these blog posts: - [Callbacks Part 1](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-1) - [Callbacks Part 2](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-2) +#The Telstra Messaging API specification -OpenAPI spec version: 2.2.6 +The version of the OpenAPI document: 2.2.9 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.0.1 +OpenAPI Generator version: 4.2.3-SNAPSHOT =end @@ -44,10 +44,4 @@ end end - describe 'test attribute "callback_data"' do - it 'should work' do - # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers - end - end - end diff --git a/spec/models/provision_number_response_spec.rb b/spec/models/provision_number_response_spec.rb index 2dee4bb..dd16342 100644 --- a/spec/models/provision_number_response_spec.rb +++ b/spec/models/provision_number_response_spec.rb @@ -1,12 +1,12 @@ =begin #Telstra Messaging API -# # Introduction Send and receive SMS and MMS messages globally using Telstra’s enterprise grade Messaging API. It also allows your application to track the delivery status of both sent and received messages. Get your dedicated Australian number, and start sending and receiving messages today. # Features The Telstra Messaging API provides the features below. | Feature | Description | | --- | --- | | `Dedicated Number` | Provision a mobile number for your account to be used as `from` address in the API | | `Send Messages` | Sending SMS or MMS messages | | `Receive Messages` | Telstra will deliver messages sent to a dedicated number or to the `notifyURL` defined by you | | `Broadcast Messages` | Invoke a single API call to send a message to a list of numbers provided in `to` | | `Delivery Status` | Query the delivery status of your messages | | `Callbacks` | Provide a notification URL and Telstra will notify your app when a message status changes | | `Alphanumeric Identifier` | Differentiate yourself by providing an alphanumeric string in `from`. This feature is only available on paid plans | | `Concatenation` | Send messages up to 1900 characters long and Telstra will automaticaly segment and reassemble them | | `Reply Request` | Create a chat session by associating `messageId` and `to` number to track responses received from a mobile number. We will store this association for 8 days | | `Character set` | Accepts all Unicode characters as part of UTF-8 | | `Bounce-back response` | See if your SMS hits an unreachable or unallocated number (Australia Only) | | `Queuing` | Messaging API will automatically queue and deliver each message at a compliant rate. | | `Emoji Encoding` | The API supports the encoding of the full range of emojis. Emojis in the reply messages will be in their UTF-8 format. | ## Delivery Notification or Callbacks The API provides several methods for notifying when a message has been delivered to the destination. 1. When you send a message there is an opportunity to specify a `notifyURL`. Once the message has been delivered the API will make a call to this URL to advise of the message status. 2. If you do not specify a URL you can always call the `GET /status` API to get the status of the message. # Getting Access to the API 1. Register at [https://dev.telstra.com](https://dev.telstra.com). 2. After registration, login to [https://dev.telstra.com](https://dev.telstra.com) and navigate to the **My apps** page. 3. Create your application by clicking the **Add new app** button 4. Select **API Free Trial** Product when configuring your application. This Product includes the Telstra Messaging API as well as other free trial APIs. Your application will be approved automatically. 5. There is a maximum of 1000 free messages per developer. Additional messages and features can be purchased from [https://dev.telstra.com](https://dev.telstra.com). 6. Note your `Client key` and `Client secret` as these will be needed to provision a number for your application and for authentication. Now head over to **Getting Started** where you can find a postman collection as well as some links to sample apps and SDKs to get you started. Happy Messaging! # Frequently Asked Questions **Q: Is creating a subscription via the Provisioning call a required step?** A. Yes. You will only be able to start sending messages if you have a provisioned dedicated number. Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: When trying to send an SMS I receive a `400 Bad Request` response. How can I fix this?** A. You need to make sure you have a provisioned dedicated number before you can send an SMS. If you do not have a provisioned dedicated number and you try to send a message via the API, you will get the error below in the response:
{   \"status\":\"400\",   \"code\":\"DELIVERY-IMPOSSIBLE\",   \"message\":\"Invalid \\'from\\' address specified\" }
Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: Can I send a broadcast message using the Telstra Messaging API?** A. Yes. Recipient numbers can be in the form of an array of strings if a broadcast message needs to be sent, allowing you to send to multiple mobile numbers in one API call. A sample request body for this will be: `{\"to\":[\"+61412345678\",\"+61487654321\"],\"body\":\"Test Message\"}` **Q: Can I use `Alphanumeric Identifier` from my paid plan via credit card?** A. `Alphanumeric Identifier` is only available on Telstra Account paid plans, not through credit card paid plans. **Q: How long does my dedicated number stay active for?** A. When you provision a dedicated number, by default it will be active for 30-days. You can use the `activeDays` parameter during the provisioning call to increment or decrement the number of days your dedicated number will remain active. **Q: What is the maximum sized MMS that I can send?** A. This will depend on the carrier that will receive the MMS. For Telstra it's up to 2MB, Optus up to 1.5MB and Vodafone only allows up to 500kB. You will need to check with international carriers for thier MMS size limits. **Q: Are SMILs supported by the Messaging API?** A. While there will be no error if you send an MMS with a SMIL presentation, the actual layout or sequence defined in the SMIL may not display as expected because most of the new smartphone devices ignore the SMIL presentation layer. SMIL was used in feature phones which had limited capability and SMIL allowed a *powerpoint type* presentation to be provided. Smartphones now have the capability to display video which is the better option for presentations. It is recommended that MMS messages should just drop the SMIL. **Q: How do I assign a delivery notification or callback URL?** A. You can assign a delivery notification or callback URL by adding the `notifyURL` parameter in the body of the request when you send a message. Once the message has been delivered, a notification will then be posted to this callback URL. **Q: What is the difference between the `notifyURL` parameter in the Provisoning call versus the `notifyURL` parameter in the Send Message call?** A. The `notifyURL` in the Provisoning call will be the URL where replies to the provisioned number will be posted. On the other hand, the `notifyURL` in the Send Message call will be the URL where the delivery notification will be posted, e.g. when an SMS has already been delivered to the recipient. # Getting Started Below are the steps to get started with the Telstra Messaging API. 1. Generate an OAuth2 token using your `Client key` and `Client secret`. 2. Use the Provisioning call to create a subscription and receive a dedicated number. 3. Send a message to a specific mobile number. ## Run in Postman \"Run ## Sample Apps - [Perl Sample App](https://github.com/telstra/MessagingAPI-perl-sample-app) - [Happy Chat App](https://github.com/telstra/messaging-sample-code-happy-chat) - [PHP Sample App](https://github.com/developersteve/telstra-messaging-php) ## SDK Repos - [Messaging API - PHP SDK](https://github.com/telstra/MessagingAPI-SDK-php) - [Messaging API - Python SDK](https://github.com/telstra/MessagingAPI-SDK-python) - [Messaging API - Ruby SDK](https://github.com/telstra/MessagingAPI-SDK-ruby) - [Messaging API - NodeJS SDK](https://github.com/telstra/MessagingAPI-SDK-node) - [Messaging API - .Net2 SDK](https://github.com/telstra/MessagingAPI-SDK-dotnet) - [Messaging API - Java SDK](https://github.com/telstra/MessagingAPI-SDK-Java) ## Blog Posts For more information on the Messaging API, you can read these blog posts: - [Callbacks Part 1](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-1) - [Callbacks Part 2](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-2) +#The Telstra Messaging API specification -OpenAPI spec version: 2.2.6 +The version of the OpenAPI document: 2.2.9 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.0.1 +OpenAPI Generator version: 4.2.3-SNAPSHOT =end @@ -38,4 +38,10 @@ end end + describe 'test attribute "expiry_date"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + end diff --git a/spec/models/send_mms_request_spec.rb b/spec/models/send_mms_request_spec.rb index 883eb45..8007604 100644 --- a/spec/models/send_mms_request_spec.rb +++ b/spec/models/send_mms_request_spec.rb @@ -1,12 +1,12 @@ =begin #Telstra Messaging API -# # Introduction Send and receive SMS and MMS messages globally using Telstra’s enterprise grade Messaging API. It also allows your application to track the delivery status of both sent and received messages. Get your dedicated Australian number, and start sending and receiving messages today. # Features The Telstra Messaging API provides the features below. | Feature | Description | | --- | --- | | `Dedicated Number` | Provision a mobile number for your account to be used as `from` address in the API | | `Send Messages` | Sending SMS or MMS messages | | `Receive Messages` | Telstra will deliver messages sent to a dedicated number or to the `notifyURL` defined by you | | `Broadcast Messages` | Invoke a single API call to send a message to a list of numbers provided in `to` | | `Delivery Status` | Query the delivery status of your messages | | `Callbacks` | Provide a notification URL and Telstra will notify your app when a message status changes | | `Alphanumeric Identifier` | Differentiate yourself by providing an alphanumeric string in `from`. This feature is only available on paid plans | | `Concatenation` | Send messages up to 1900 characters long and Telstra will automaticaly segment and reassemble them | | `Reply Request` | Create a chat session by associating `messageId` and `to` number to track responses received from a mobile number. We will store this association for 8 days | | `Character set` | Accepts all Unicode characters as part of UTF-8 | | `Bounce-back response` | See if your SMS hits an unreachable or unallocated number (Australia Only) | | `Queuing` | Messaging API will automatically queue and deliver each message at a compliant rate. | | `Emoji Encoding` | The API supports the encoding of the full range of emojis. Emojis in the reply messages will be in their UTF-8 format. | ## Delivery Notification or Callbacks The API provides several methods for notifying when a message has been delivered to the destination. 1. When you send a message there is an opportunity to specify a `notifyURL`. Once the message has been delivered the API will make a call to this URL to advise of the message status. 2. If you do not specify a URL you can always call the `GET /status` API to get the status of the message. # Getting Access to the API 1. Register at [https://dev.telstra.com](https://dev.telstra.com). 2. After registration, login to [https://dev.telstra.com](https://dev.telstra.com) and navigate to the **My apps** page. 3. Create your application by clicking the **Add new app** button 4. Select **API Free Trial** Product when configuring your application. This Product includes the Telstra Messaging API as well as other free trial APIs. Your application will be approved automatically. 5. There is a maximum of 1000 free messages per developer. Additional messages and features can be purchased from [https://dev.telstra.com](https://dev.telstra.com). 6. Note your `Client key` and `Client secret` as these will be needed to provision a number for your application and for authentication. Now head over to **Getting Started** where you can find a postman collection as well as some links to sample apps and SDKs to get you started. Happy Messaging! # Frequently Asked Questions **Q: Is creating a subscription via the Provisioning call a required step?** A. Yes. You will only be able to start sending messages if you have a provisioned dedicated number. Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: When trying to send an SMS I receive a `400 Bad Request` response. How can I fix this?** A. You need to make sure you have a provisioned dedicated number before you can send an SMS. If you do not have a provisioned dedicated number and you try to send a message via the API, you will get the error below in the response:
{   \"status\":\"400\",   \"code\":\"DELIVERY-IMPOSSIBLE\",   \"message\":\"Invalid \\'from\\' address specified\" }
Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: Can I send a broadcast message using the Telstra Messaging API?** A. Yes. Recipient numbers can be in the form of an array of strings if a broadcast message needs to be sent, allowing you to send to multiple mobile numbers in one API call. A sample request body for this will be: `{\"to\":[\"+61412345678\",\"+61487654321\"],\"body\":\"Test Message\"}` **Q: Can I use `Alphanumeric Identifier` from my paid plan via credit card?** A. `Alphanumeric Identifier` is only available on Telstra Account paid plans, not through credit card paid plans. **Q: How long does my dedicated number stay active for?** A. When you provision a dedicated number, by default it will be active for 30-days. You can use the `activeDays` parameter during the provisioning call to increment or decrement the number of days your dedicated number will remain active. **Q: What is the maximum sized MMS that I can send?** A. This will depend on the carrier that will receive the MMS. For Telstra it's up to 2MB, Optus up to 1.5MB and Vodafone only allows up to 500kB. You will need to check with international carriers for thier MMS size limits. **Q: Are SMILs supported by the Messaging API?** A. While there will be no error if you send an MMS with a SMIL presentation, the actual layout or sequence defined in the SMIL may not display as expected because most of the new smartphone devices ignore the SMIL presentation layer. SMIL was used in feature phones which had limited capability and SMIL allowed a *powerpoint type* presentation to be provided. Smartphones now have the capability to display video which is the better option for presentations. It is recommended that MMS messages should just drop the SMIL. **Q: How do I assign a delivery notification or callback URL?** A. You can assign a delivery notification or callback URL by adding the `notifyURL` parameter in the body of the request when you send a message. Once the message has been delivered, a notification will then be posted to this callback URL. **Q: What is the difference between the `notifyURL` parameter in the Provisoning call versus the `notifyURL` parameter in the Send Message call?** A. The `notifyURL` in the Provisoning call will be the URL where replies to the provisioned number will be posted. On the other hand, the `notifyURL` in the Send Message call will be the URL where the delivery notification will be posted, e.g. when an SMS has already been delivered to the recipient. # Getting Started Below are the steps to get started with the Telstra Messaging API. 1. Generate an OAuth2 token using your `Client key` and `Client secret`. 2. Use the Provisioning call to create a subscription and receive a dedicated number. 3. Send a message to a specific mobile number. ## Run in Postman \"Run ## Sample Apps - [Perl Sample App](https://github.com/telstra/MessagingAPI-perl-sample-app) - [Happy Chat App](https://github.com/telstra/messaging-sample-code-happy-chat) - [PHP Sample App](https://github.com/developersteve/telstra-messaging-php) ## SDK Repos - [Messaging API - PHP SDK](https://github.com/telstra/MessagingAPI-SDK-php) - [Messaging API - Python SDK](https://github.com/telstra/MessagingAPI-SDK-python) - [Messaging API - Ruby SDK](https://github.com/telstra/MessagingAPI-SDK-ruby) - [Messaging API - NodeJS SDK](https://github.com/telstra/MessagingAPI-SDK-node) - [Messaging API - .Net2 SDK](https://github.com/telstra/MessagingAPI-SDK-dotnet) - [Messaging API - Java SDK](https://github.com/telstra/MessagingAPI-SDK-Java) ## Blog Posts For more information on the Messaging API, you can read these blog posts: - [Callbacks Part 1](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-1) - [Callbacks Part 2](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-2) +#The Telstra Messaging API specification -OpenAPI spec version: 2.2.6 +The version of the OpenAPI document: 2.2.9 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.0.1 +OpenAPI Generator version: 4.2.3-SNAPSHOT =end @@ -32,13 +32,13 @@ expect(@instance).to be_instance_of(Telstra_Messaging::SendMmsRequest) end end - describe 'test attribute "from"' do + describe 'test attribute "to"' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end - describe 'test attribute "to"' do + describe 'test attribute "from"' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end diff --git a/spec/models/send_sms_multi_request_spec.rb b/spec/models/send_sms_multi_request_spec.rb new file mode 100644 index 0000000..085d553 --- /dev/null +++ b/spec/models/send_sms_multi_request_spec.rb @@ -0,0 +1,47 @@ +=begin +#Telstra Messaging API + +#The Telstra Messaging API specification + +The version of the OpenAPI document: 2.2.9 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 4.2.3-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Telstra_Messaging::SendSmsMultiRequest +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'SendSmsMultiRequest' do + before do + # run before each test + @instance = Telstra_Messaging::SendSmsMultiRequest.new + end + + after do + # run after each test + end + + describe 'test an instance of SendSmsMultiRequest' do + it 'should create an instance of SendSmsMultiRequest' do + expect(@instance).to be_instance_of(Telstra_Messaging::SendSmsMultiRequest) + end + end + describe 'test attribute "sms_multi"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "notify_url"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/models/send_sms_request_spec.rb b/spec/models/send_sms_request_spec.rb index 7bbddcf..c85f398 100644 --- a/spec/models/send_sms_request_spec.rb +++ b/spec/models/send_sms_request_spec.rb @@ -1,12 +1,12 @@ =begin #Telstra Messaging API -# # Introduction Send and receive SMS and MMS messages globally using Telstra’s enterprise grade Messaging API. It also allows your application to track the delivery status of both sent and received messages. Get your dedicated Australian number, and start sending and receiving messages today. # Features The Telstra Messaging API provides the features below. | Feature | Description | | --- | --- | | `Dedicated Number` | Provision a mobile number for your account to be used as `from` address in the API | | `Send Messages` | Sending SMS or MMS messages | | `Receive Messages` | Telstra will deliver messages sent to a dedicated number or to the `notifyURL` defined by you | | `Broadcast Messages` | Invoke a single API call to send a message to a list of numbers provided in `to` | | `Delivery Status` | Query the delivery status of your messages | | `Callbacks` | Provide a notification URL and Telstra will notify your app when a message status changes | | `Alphanumeric Identifier` | Differentiate yourself by providing an alphanumeric string in `from`. This feature is only available on paid plans | | `Concatenation` | Send messages up to 1900 characters long and Telstra will automaticaly segment and reassemble them | | `Reply Request` | Create a chat session by associating `messageId` and `to` number to track responses received from a mobile number. We will store this association for 8 days | | `Character set` | Accepts all Unicode characters as part of UTF-8 | | `Bounce-back response` | See if your SMS hits an unreachable or unallocated number (Australia Only) | | `Queuing` | Messaging API will automatically queue and deliver each message at a compliant rate. | | `Emoji Encoding` | The API supports the encoding of the full range of emojis. Emojis in the reply messages will be in their UTF-8 format. | ## Delivery Notification or Callbacks The API provides several methods for notifying when a message has been delivered to the destination. 1. When you send a message there is an opportunity to specify a `notifyURL`. Once the message has been delivered the API will make a call to this URL to advise of the message status. 2. If you do not specify a URL you can always call the `GET /status` API to get the status of the message. # Getting Access to the API 1. Register at [https://dev.telstra.com](https://dev.telstra.com). 2. After registration, login to [https://dev.telstra.com](https://dev.telstra.com) and navigate to the **My apps** page. 3. Create your application by clicking the **Add new app** button 4. Select **API Free Trial** Product when configuring your application. This Product includes the Telstra Messaging API as well as other free trial APIs. Your application will be approved automatically. 5. There is a maximum of 1000 free messages per developer. Additional messages and features can be purchased from [https://dev.telstra.com](https://dev.telstra.com). 6. Note your `Client key` and `Client secret` as these will be needed to provision a number for your application and for authentication. Now head over to **Getting Started** where you can find a postman collection as well as some links to sample apps and SDKs to get you started. Happy Messaging! # Frequently Asked Questions **Q: Is creating a subscription via the Provisioning call a required step?** A. Yes. You will only be able to start sending messages if you have a provisioned dedicated number. Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: When trying to send an SMS I receive a `400 Bad Request` response. How can I fix this?** A. You need to make sure you have a provisioned dedicated number before you can send an SMS. If you do not have a provisioned dedicated number and you try to send a message via the API, you will get the error below in the response:
{   \"status\":\"400\",   \"code\":\"DELIVERY-IMPOSSIBLE\",   \"message\":\"Invalid \\'from\\' address specified\" }
Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: Can I send a broadcast message using the Telstra Messaging API?** A. Yes. Recipient numbers can be in the form of an array of strings if a broadcast message needs to be sent, allowing you to send to multiple mobile numbers in one API call. A sample request body for this will be: `{\"to\":[\"+61412345678\",\"+61487654321\"],\"body\":\"Test Message\"}` **Q: Can I use `Alphanumeric Identifier` from my paid plan via credit card?** A. `Alphanumeric Identifier` is only available on Telstra Account paid plans, not through credit card paid plans. **Q: How long does my dedicated number stay active for?** A. When you provision a dedicated number, by default it will be active for 30-days. You can use the `activeDays` parameter during the provisioning call to increment or decrement the number of days your dedicated number will remain active. **Q: What is the maximum sized MMS that I can send?** A. This will depend on the carrier that will receive the MMS. For Telstra it's up to 2MB, Optus up to 1.5MB and Vodafone only allows up to 500kB. You will need to check with international carriers for thier MMS size limits. **Q: Are SMILs supported by the Messaging API?** A. While there will be no error if you send an MMS with a SMIL presentation, the actual layout or sequence defined in the SMIL may not display as expected because most of the new smartphone devices ignore the SMIL presentation layer. SMIL was used in feature phones which had limited capability and SMIL allowed a *powerpoint type* presentation to be provided. Smartphones now have the capability to display video which is the better option for presentations. It is recommended that MMS messages should just drop the SMIL. **Q: How do I assign a delivery notification or callback URL?** A. You can assign a delivery notification or callback URL by adding the `notifyURL` parameter in the body of the request when you send a message. Once the message has been delivered, a notification will then be posted to this callback URL. **Q: What is the difference between the `notifyURL` parameter in the Provisoning call versus the `notifyURL` parameter in the Send Message call?** A. The `notifyURL` in the Provisoning call will be the URL where replies to the provisioned number will be posted. On the other hand, the `notifyURL` in the Send Message call will be the URL where the delivery notification will be posted, e.g. when an SMS has already been delivered to the recipient. # Getting Started Below are the steps to get started with the Telstra Messaging API. 1. Generate an OAuth2 token using your `Client key` and `Client secret`. 2. Use the Provisioning call to create a subscription and receive a dedicated number. 3. Send a message to a specific mobile number. ## Run in Postman \"Run ## Sample Apps - [Perl Sample App](https://github.com/telstra/MessagingAPI-perl-sample-app) - [Happy Chat App](https://github.com/telstra/messaging-sample-code-happy-chat) - [PHP Sample App](https://github.com/developersteve/telstra-messaging-php) ## SDK Repos - [Messaging API - PHP SDK](https://github.com/telstra/MessagingAPI-SDK-php) - [Messaging API - Python SDK](https://github.com/telstra/MessagingAPI-SDK-python) - [Messaging API - Ruby SDK](https://github.com/telstra/MessagingAPI-SDK-ruby) - [Messaging API - NodeJS SDK](https://github.com/telstra/MessagingAPI-SDK-node) - [Messaging API - .Net2 SDK](https://github.com/telstra/MessagingAPI-SDK-dotnet) - [Messaging API - Java SDK](https://github.com/telstra/MessagingAPI-SDK-Java) ## Blog Posts For more information on the Messaging API, you can read these blog posts: - [Callbacks Part 1](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-1) - [Callbacks Part 2](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-2) +#The Telstra Messaging API specification -OpenAPI spec version: 2.2.6 +The version of the OpenAPI document: 2.2.9 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.0.1 +OpenAPI Generator version: 4.2.3-SNAPSHOT =end diff --git a/spec/models/status_spec.rb b/spec/models/status_spec.rb index 875202a..4b8c058 100644 --- a/spec/models/status_spec.rb +++ b/spec/models/status_spec.rb @@ -1,12 +1,12 @@ =begin #Telstra Messaging API -# # Introduction Send and receive SMS and MMS messages globally using Telstra’s enterprise grade Messaging API. It also allows your application to track the delivery status of both sent and received messages. Get your dedicated Australian number, and start sending and receiving messages today. # Features The Telstra Messaging API provides the features below. | Feature | Description | | --- | --- | | `Dedicated Number` | Provision a mobile number for your account to be used as `from` address in the API | | `Send Messages` | Sending SMS or MMS messages | | `Receive Messages` | Telstra will deliver messages sent to a dedicated number or to the `notifyURL` defined by you | | `Broadcast Messages` | Invoke a single API call to send a message to a list of numbers provided in `to` | | `Delivery Status` | Query the delivery status of your messages | | `Callbacks` | Provide a notification URL and Telstra will notify your app when a message status changes | | `Alphanumeric Identifier` | Differentiate yourself by providing an alphanumeric string in `from`. This feature is only available on paid plans | | `Concatenation` | Send messages up to 1900 characters long and Telstra will automaticaly segment and reassemble them | | `Reply Request` | Create a chat session by associating `messageId` and `to` number to track responses received from a mobile number. We will store this association for 8 days | | `Character set` | Accepts all Unicode characters as part of UTF-8 | | `Bounce-back response` | See if your SMS hits an unreachable or unallocated number (Australia Only) | | `Queuing` | Messaging API will automatically queue and deliver each message at a compliant rate. | | `Emoji Encoding` | The API supports the encoding of the full range of emojis. Emojis in the reply messages will be in their UTF-8 format. | ## Delivery Notification or Callbacks The API provides several methods for notifying when a message has been delivered to the destination. 1. When you send a message there is an opportunity to specify a `notifyURL`. Once the message has been delivered the API will make a call to this URL to advise of the message status. 2. If you do not specify a URL you can always call the `GET /status` API to get the status of the message. # Getting Access to the API 1. Register at [https://dev.telstra.com](https://dev.telstra.com). 2. After registration, login to [https://dev.telstra.com](https://dev.telstra.com) and navigate to the **My apps** page. 3. Create your application by clicking the **Add new app** button 4. Select **API Free Trial** Product when configuring your application. This Product includes the Telstra Messaging API as well as other free trial APIs. Your application will be approved automatically. 5. There is a maximum of 1000 free messages per developer. Additional messages and features can be purchased from [https://dev.telstra.com](https://dev.telstra.com). 6. Note your `Client key` and `Client secret` as these will be needed to provision a number for your application and for authentication. Now head over to **Getting Started** where you can find a postman collection as well as some links to sample apps and SDKs to get you started. Happy Messaging! # Frequently Asked Questions **Q: Is creating a subscription via the Provisioning call a required step?** A. Yes. You will only be able to start sending messages if you have a provisioned dedicated number. Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: When trying to send an SMS I receive a `400 Bad Request` response. How can I fix this?** A. You need to make sure you have a provisioned dedicated number before you can send an SMS. If you do not have a provisioned dedicated number and you try to send a message via the API, you will get the error below in the response:
{   \"status\":\"400\",   \"code\":\"DELIVERY-IMPOSSIBLE\",   \"message\":\"Invalid \\'from\\' address specified\" }
Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: Can I send a broadcast message using the Telstra Messaging API?** A. Yes. Recipient numbers can be in the form of an array of strings if a broadcast message needs to be sent, allowing you to send to multiple mobile numbers in one API call. A sample request body for this will be: `{\"to\":[\"+61412345678\",\"+61487654321\"],\"body\":\"Test Message\"}` **Q: Can I use `Alphanumeric Identifier` from my paid plan via credit card?** A. `Alphanumeric Identifier` is only available on Telstra Account paid plans, not through credit card paid plans. **Q: How long does my dedicated number stay active for?** A. When you provision a dedicated number, by default it will be active for 30-days. You can use the `activeDays` parameter during the provisioning call to increment or decrement the number of days your dedicated number will remain active. **Q: What is the maximum sized MMS that I can send?** A. This will depend on the carrier that will receive the MMS. For Telstra it's up to 2MB, Optus up to 1.5MB and Vodafone only allows up to 500kB. You will need to check with international carriers for thier MMS size limits. **Q: Are SMILs supported by the Messaging API?** A. While there will be no error if you send an MMS with a SMIL presentation, the actual layout or sequence defined in the SMIL may not display as expected because most of the new smartphone devices ignore the SMIL presentation layer. SMIL was used in feature phones which had limited capability and SMIL allowed a *powerpoint type* presentation to be provided. Smartphones now have the capability to display video which is the better option for presentations. It is recommended that MMS messages should just drop the SMIL. **Q: How do I assign a delivery notification or callback URL?** A. You can assign a delivery notification or callback URL by adding the `notifyURL` parameter in the body of the request when you send a message. Once the message has been delivered, a notification will then be posted to this callback URL. **Q: What is the difference between the `notifyURL` parameter in the Provisoning call versus the `notifyURL` parameter in the Send Message call?** A. The `notifyURL` in the Provisoning call will be the URL where replies to the provisioned number will be posted. On the other hand, the `notifyURL` in the Send Message call will be the URL where the delivery notification will be posted, e.g. when an SMS has already been delivered to the recipient. # Getting Started Below are the steps to get started with the Telstra Messaging API. 1. Generate an OAuth2 token using your `Client key` and `Client secret`. 2. Use the Provisioning call to create a subscription and receive a dedicated number. 3. Send a message to a specific mobile number. ## Run in Postman \"Run ## Sample Apps - [Perl Sample App](https://github.com/telstra/MessagingAPI-perl-sample-app) - [Happy Chat App](https://github.com/telstra/messaging-sample-code-happy-chat) - [PHP Sample App](https://github.com/developersteve/telstra-messaging-php) ## SDK Repos - [Messaging API - PHP SDK](https://github.com/telstra/MessagingAPI-SDK-php) - [Messaging API - Python SDK](https://github.com/telstra/MessagingAPI-SDK-python) - [Messaging API - Ruby SDK](https://github.com/telstra/MessagingAPI-SDK-ruby) - [Messaging API - NodeJS SDK](https://github.com/telstra/MessagingAPI-SDK-node) - [Messaging API - .Net2 SDK](https://github.com/telstra/MessagingAPI-SDK-dotnet) - [Messaging API - Java SDK](https://github.com/telstra/MessagingAPI-SDK-Java) ## Blog Posts For more information on the Messaging API, you can read these blog posts: - [Callbacks Part 1](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-1) - [Callbacks Part 2](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-2) +#The Telstra Messaging API specification -OpenAPI spec version: 2.2.6 +The version of the OpenAPI document: 2.2.9 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.0.1 +OpenAPI Generator version: 4.2.3-SNAPSHOT =end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 00829e4..93f18f0 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,12 +1,12 @@ =begin #Telstra Messaging API -# # Introduction Send and receive SMS and MMS messages globally using Telstra’s enterprise grade Messaging API. It also allows your application to track the delivery status of both sent and received messages. Get your dedicated Australian number, and start sending and receiving messages today. # Features The Telstra Messaging API provides the features below. | Feature | Description | | --- | --- | | `Dedicated Number` | Provision a mobile number for your account to be used as `from` address in the API | | `Send Messages` | Sending SMS or MMS messages | | `Receive Messages` | Telstra will deliver messages sent to a dedicated number or to the `notifyURL` defined by you | | `Broadcast Messages` | Invoke a single API call to send a message to a list of numbers provided in `to` | | `Delivery Status` | Query the delivery status of your messages | | `Callbacks` | Provide a notification URL and Telstra will notify your app when a message status changes | | `Alphanumeric Identifier` | Differentiate yourself by providing an alphanumeric string in `from`. This feature is only available on paid plans | | `Concatenation` | Send messages up to 1900 characters long and Telstra will automaticaly segment and reassemble them | | `Reply Request` | Create a chat session by associating `messageId` and `to` number to track responses received from a mobile number. We will store this association for 8 days | | `Character set` | Accepts all Unicode characters as part of UTF-8 | | `Bounce-back response` | See if your SMS hits an unreachable or unallocated number (Australia Only) | | `Queuing` | Messaging API will automatically queue and deliver each message at a compliant rate. | | `Emoji Encoding` | The API supports the encoding of the full range of emojis. Emojis in the reply messages will be in their UTF-8 format. | ## Delivery Notification or Callbacks The API provides several methods for notifying when a message has been delivered to the destination. 1. When you send a message there is an opportunity to specify a `notifyURL`. Once the message has been delivered the API will make a call to this URL to advise of the message status. 2. If you do not specify a URL you can always call the `GET /status` API to get the status of the message. # Getting Access to the API 1. Register at [https://dev.telstra.com](https://dev.telstra.com). 2. After registration, login to [https://dev.telstra.com](https://dev.telstra.com) and navigate to the **My apps** page. 3. Create your application by clicking the **Add new app** button 4. Select **API Free Trial** Product when configuring your application. This Product includes the Telstra Messaging API as well as other free trial APIs. Your application will be approved automatically. 5. There is a maximum of 1000 free messages per developer. Additional messages and features can be purchased from [https://dev.telstra.com](https://dev.telstra.com). 6. Note your `Client key` and `Client secret` as these will be needed to provision a number for your application and for authentication. Now head over to **Getting Started** where you can find a postman collection as well as some links to sample apps and SDKs to get you started. Happy Messaging! # Frequently Asked Questions **Q: Is creating a subscription via the Provisioning call a required step?** A. Yes. You will only be able to start sending messages if you have a provisioned dedicated number. Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: When trying to send an SMS I receive a `400 Bad Request` response. How can I fix this?** A. You need to make sure you have a provisioned dedicated number before you can send an SMS. If you do not have a provisioned dedicated number and you try to send a message via the API, you will get the error below in the response:
{   \"status\":\"400\",   \"code\":\"DELIVERY-IMPOSSIBLE\",   \"message\":\"Invalid \\'from\\' address specified\" }
Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired. **Q: Can I send a broadcast message using the Telstra Messaging API?** A. Yes. Recipient numbers can be in the form of an array of strings if a broadcast message needs to be sent, allowing you to send to multiple mobile numbers in one API call. A sample request body for this will be: `{\"to\":[\"+61412345678\",\"+61487654321\"],\"body\":\"Test Message\"}` **Q: Can I use `Alphanumeric Identifier` from my paid plan via credit card?** A. `Alphanumeric Identifier` is only available on Telstra Account paid plans, not through credit card paid plans. **Q: How long does my dedicated number stay active for?** A. When you provision a dedicated number, by default it will be active for 30-days. You can use the `activeDays` parameter during the provisioning call to increment or decrement the number of days your dedicated number will remain active. **Q: What is the maximum sized MMS that I can send?** A. This will depend on the carrier that will receive the MMS. For Telstra it's up to 2MB, Optus up to 1.5MB and Vodafone only allows up to 500kB. You will need to check with international carriers for thier MMS size limits. **Q: Are SMILs supported by the Messaging API?** A. While there will be no error if you send an MMS with a SMIL presentation, the actual layout or sequence defined in the SMIL may not display as expected because most of the new smartphone devices ignore the SMIL presentation layer. SMIL was used in feature phones which had limited capability and SMIL allowed a *powerpoint type* presentation to be provided. Smartphones now have the capability to display video which is the better option for presentations. It is recommended that MMS messages should just drop the SMIL. **Q: How do I assign a delivery notification or callback URL?** A. You can assign a delivery notification or callback URL by adding the `notifyURL` parameter in the body of the request when you send a message. Once the message has been delivered, a notification will then be posted to this callback URL. **Q: What is the difference between the `notifyURL` parameter in the Provisoning call versus the `notifyURL` parameter in the Send Message call?** A. The `notifyURL` in the Provisoning call will be the URL where replies to the provisioned number will be posted. On the other hand, the `notifyURL` in the Send Message call will be the URL where the delivery notification will be posted, e.g. when an SMS has already been delivered to the recipient. # Getting Started Below are the steps to get started with the Telstra Messaging API. 1. Generate an OAuth2 token using your `Client key` and `Client secret`. 2. Use the Provisioning call to create a subscription and receive a dedicated number. 3. Send a message to a specific mobile number. ## Run in Postman \"Run ## Sample Apps - [Perl Sample App](https://github.com/telstra/MessagingAPI-perl-sample-app) - [Happy Chat App](https://github.com/telstra/messaging-sample-code-happy-chat) - [PHP Sample App](https://github.com/developersteve/telstra-messaging-php) ## SDK Repos - [Messaging API - PHP SDK](https://github.com/telstra/MessagingAPI-SDK-php) - [Messaging API - Python SDK](https://github.com/telstra/MessagingAPI-SDK-python) - [Messaging API - Ruby SDK](https://github.com/telstra/MessagingAPI-SDK-ruby) - [Messaging API - NodeJS SDK](https://github.com/telstra/MessagingAPI-SDK-node) - [Messaging API - .Net2 SDK](https://github.com/telstra/MessagingAPI-SDK-dotnet) - [Messaging API - Java SDK](https://github.com/telstra/MessagingAPI-SDK-Java) ## Blog Posts For more information on the Messaging API, you can read these blog posts: - [Callbacks Part 1](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-1) - [Callbacks Part 2](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-2) +#The Telstra Messaging API specification -OpenAPI spec version: 2.2.6 +The version of the OpenAPI document: 2.2.9 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.0.1 +OpenAPI Generator version: 4.2.3-SNAPSHOT =end