Telstra_Messaging 1.0.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/README.md +253 -0
  4. data/Rakefile +10 -0
  5. data/Telstra_Messaging.gemspec +45 -0
  6. data/docs/AuthenticationApi.md +58 -0
  7. data/docs/DeleteNumberRequest.md +8 -0
  8. data/docs/GetSubscriptionResponse.md +10 -0
  9. data/docs/InboundPollResponse.md +13 -0
  10. data/docs/MMSContent.md +10 -0
  11. data/docs/Message.md +11 -0
  12. data/docs/MessageSentResponse.md +11 -0
  13. data/docs/MessagingApi.md +310 -0
  14. data/docs/OAuthResponse.md +10 -0
  15. data/docs/OutboundPollResponse.md +11 -0
  16. data/docs/ProvisionNumberRequest.md +9 -0
  17. data/docs/ProvisionNumberResponse.md +10 -0
  18. data/docs/ProvisioningApi.md +156 -0
  19. data/docs/SendMmsRequest.md +13 -0
  20. data/docs/SendSMSRequest.md +15 -0
  21. data/docs/Status.md +7 -0
  22. data/lib/Telstra_Messaging.rb +55 -0
  23. data/lib/Telstra_Messaging/api/authentication_api.rb +92 -0
  24. data/lib/Telstra_Messaging/api/messaging_api.rb +331 -0
  25. data/lib/Telstra_Messaging/api/provisioning_api.rb +174 -0
  26. data/lib/Telstra_Messaging/api_client.rb +389 -0
  27. data/lib/Telstra_Messaging/api_error.rb +38 -0
  28. data/lib/Telstra_Messaging/configuration.rb +209 -0
  29. data/lib/Telstra_Messaging/models/delete_number_request.rb +186 -0
  30. data/lib/Telstra_Messaging/models/get_subscription_response.rb +204 -0
  31. data/lib/Telstra_Messaging/models/inbound_poll_response.rb +235 -0
  32. data/lib/Telstra_Messaging/models/message.rb +229 -0
  33. data/lib/Telstra_Messaging/models/message_sent_response.rb +233 -0
  34. data/lib/Telstra_Messaging/models/mms_content.rb +219 -0
  35. data/lib/Telstra_Messaging/models/o_auth_response.rb +204 -0
  36. data/lib/Telstra_Messaging/models/outbound_poll_response.rb +213 -0
  37. data/lib/Telstra_Messaging/models/provision_number_request.rb +194 -0
  38. data/lib/Telstra_Messaging/models/provision_number_response.rb +204 -0
  39. data/lib/Telstra_Messaging/models/send_mms_request.rb +261 -0
  40. data/lib/Telstra_Messaging/models/send_sms_request.rb +264 -0
  41. data/lib/Telstra_Messaging/models/status.rb +36 -0
  42. data/lib/Telstra_Messaging/version.rb +15 -0
  43. data/spec/api/authentication_api_spec.rb +49 -0
  44. data/spec/api/messaging_api_spec.rb +109 -0
  45. data/spec/api/provisioning_api_spec.rb +70 -0
  46. data/spec/api_client_spec.rb +226 -0
  47. data/spec/configuration_spec.rb +42 -0
  48. data/spec/models/delete_number_request_spec.rb +41 -0
  49. data/spec/models/get_subscription_response_spec.rb +53 -0
  50. data/spec/models/inbound_poll_response_spec.rb +71 -0
  51. data/spec/models/message_sent_response_spec.rb +65 -0
  52. data/spec/models/message_spec.rb +59 -0
  53. data/spec/models/mms_content_spec.rb +53 -0
  54. data/spec/models/o_auth_response_spec.rb +53 -0
  55. data/spec/models/outbound_poll_response_spec.rb +59 -0
  56. data/spec/models/provision_number_request_spec.rb +53 -0
  57. data/spec/models/provision_number_response_spec.rb +41 -0
  58. data/spec/models/send_mms_request_spec.rb +71 -0
  59. data/spec/models/send_sms_request_spec.rb +83 -0
  60. data/spec/models/status_spec.rb +35 -0
  61. data/spec/spec_helper.rb +111 -0
  62. metadata +413 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 185e59133e2b9de5d0ecbceab28745be7facc7e6e3c8f3631e6c62ade5004d52
4
+ data.tar.gz: bed16ee4378e311471ce11e4ae5a54e0c9c6c98db29e44747d620cb43a4cde07
5
+ SHA512:
6
+ metadata.gz: 2cdfe687d2f08f68988dc23e001811814a858455e9f0811724990f5942c064668bbbc6719c7c128eb2ed85f5decc71e9d29bd3cefeb68fa3b45417dcf93da15e
7
+ data.tar.gz: 22b6964fdfc20e1b4fc6ff81e37830bb90391c5f72540c1f2234bc1e01f6230e4996eaa887ecd76af4d082c9971b0838d8b6435515b3c8adb175635e131b50be
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :development, :test do
6
+ gem 'rake', '~> 12.0.0'
7
+ end
@@ -0,0 +1,253 @@
1
+ # Telstra_Messaging
2
+
3
+ Telstra_Messaging - the Ruby gem for the Telstra Messaging API
4
+
5
+
6
+ # Introduction
7
+
8
+
9
+ # Features
10
+
11
+ The Telstra Messaging API provides the features below.
12
+ | Feature | Description |
13
+ | --- | --- |
14
+ | `Dedicated Number` | Provision a mobile number for your account to be used as `from` address in the API |
15
+ | `Send Messages` | Sending SMS or MMS messages |
16
+ | `Receive Messages` | Telstra will deliver messages sent to a dedicated number or to the `notifyURL` defined by you |
17
+ | `Broadcast Messages` | Invoke a single API call to send a message to a list of numbers provided in `to` |
18
+ | `Delivery Status` | Query the delivery status of your messages |
19
+ | `Callbacks` | Provide a notification URL and Telstra will notify your app when a message status changes |
20
+ | `Alphanumeric Identifier` | Differentiate yourself by providing an alphanumeric string in `from`. This feature is only available on paid plans |
21
+ | `Concatenation` | Send messages up to 1900 characters long and Telstra will automaticaly segment and reassemble them |
22
+ | `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 |
23
+ | `Character set` | Accepts all Unicode characters as part of UTF-8 |
24
+ | `Bounce-back response` | See if your SMS hits an unreachable or unallocated number (Australia Only) |
25
+ | `Queuing` | Messaging API will automatically queue and deliver each message at a compliant rate. |
26
+ | `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. |
27
+
28
+ ## Delivery Notification or Callbacks
29
+
30
+ The API provides several methods for notifying when a message has been delivered to the destination.
31
+
32
+ 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.
33
+ 2. If you do not specify a URL you can always call the `GET /status` API to get the status of the message.
34
+
35
+ # Getting Access to the API
36
+
37
+ 1. Register at [https://dev.telstra.com](https://dev.telstra.com).
38
+ 2. After registration, login to [https://dev.telstra.com](https://dev.telstra.com) and navigate to the **My apps** page.
39
+ 3. Create your application by clicking the **Add new app** button
40
+ 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.
41
+ 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).
42
+ 6. Note your `Client key` and `Client secret` as these will be needed to provision a number for your application and for authentication.
43
+
44
+ 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.
45
+
46
+ Happy Messaging!
47
+
48
+ # Frequently Asked Questions
49
+
50
+ **Q: Is creating a subscription via the Provisioning call a required step?**
51
+
52
+ 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.
53
+
54
+ **Q: When trying to send an SMS I receive a `400 Bad Request` response. How can I fix this?**
55
+
56
+ A. You need to make sure you have a provisioned dedicated number before you can send an SMS.
57
+ 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:
58
+
59
+ <pre><code class=\"language-sh\">{
60
+ \"status\":\"400\",
61
+ \"code\":\"DELIVERY-IMPOSSIBLE\",
62
+ \"message\":\"Invalid \\'from\\' address specified\"
63
+ }</code></pre>
64
+
65
+ Use Provisioning to create a dedicated number subscription, or renew your dedicated number if it has expired.
66
+
67
+ **Q: How long does my dedicated number stay active for?**
68
+
69
+ A. When you provision a dedicated number, by default it will be active for 30 days.
70
+ You can use the `activeDays` parameter during the provisioning call to increment or decrement the number of days your dedicated number will remain active.
71
+
72
+ 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`.
73
+
74
+ **Q: Can I send a broadcast message using the Telstra Messaging API?**
75
+
76
+ 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.
77
+ A sample request body for this will be: `{\"to\":[\"+61412345678\",\"+61487654321\"],\"body\":\"Test Message\"}`
78
+
79
+ **Q: Can I send SMS and MMS to all countries?**
80
+
81
+ 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.
82
+
83
+ **Q: Can I use `Alphanumeric Identifier` from my paid plan via credit card?**
84
+
85
+ A. `Alphanumeric Identifier` is only available on Telstra Account paid plans, not through credit card paid plans.
86
+
87
+ **Q: What is the maximum sized MMS that I can send?**
88
+
89
+ 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.
90
+
91
+ **Q: How is the size of an MMS calculated?**
92
+
93
+ A. Images are scaled up to approximately 4/3 when base64 encoded.
94
+ Additionally, there is approximately 200 bytes of overhead on each MMS.
95
+ 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).
96
+
97
+ **Q: How is an MMS classified as Small or Large?**
98
+
99
+ 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.
100
+
101
+ **Q: Are SMILs supported by the Messaging API?**
102
+
103
+ 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.
104
+
105
+ **Q: How do I assign a delivery notification or callback URL?**
106
+
107
+ 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.
108
+
109
+ **Q: What is the difference between the `notifyURL` parameter in the Provisoning call versus the `notifyURL` parameter in the Send Message call?**
110
+
111
+ A. The `notifyURL` in the Provisoning call will be the URL where replies to the provisioned number will be posted.
112
+ 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.
113
+
114
+ # Getting Started
115
+
116
+ Below are the steps to get started with the Telstra Messaging API.
117
+ 1. Generate an OAuth2 token using your `Client key` and `Client secret`.
118
+ 2. Use the Provisioning call to create a subscription and receive a dedicated number.
119
+ 3. Send a message to a specific mobile number.
120
+
121
+ ## Run in Postman
122
+ <a
123
+ href=\"https://app.getpostman.com/run-collection/ded00578f69a9deba256#?env%5BMessaging%20API%20Environments%5D=W3siZW5hYmxlZCI6dHJ1ZSwia2V5IjoiY2xpZW50X2lkIiwidmFsdWUiOiIiLCJ0eXBlIjoidGV4dCJ9LHsiZW5hYmxlZCI6dHJ1ZSwia2V5IjoiY2xpZW50X3NlY3JldCIsInZhbHVlIjoiIiwidHlwZSI6InRleHQifSx7ImVuYWJsZWQiOnRydWUsImtleSI6ImFjY2Vzc190b2tlbiIsInZhbHVlIjoiIiwidHlwZSI6InRleHQifSx7ImVuYWJsZWQiOnRydWUsImtleSI6Imhvc3QiLCJ2YWx1ZSI6InRhcGkudGVsc3RyYS5jb20iLCJ0eXBlIjoidGV4dCJ9LHsiZW5hYmxlZCI6dHJ1ZSwia2V5IjoiQXV0aG9yaXphdGlvbiIsInZhbHVlIjoiIiwidHlwZSI6InRleHQifSx7ImVuYWJsZWQiOnRydWUsImtleSI6Im9hdXRoX2hvc3QiLCJ2YWx1ZSI6InNhcGkudGVsc3RyYS5jb20iLCJ0eXBlIjoidGV4dCJ9LHsiZW5hYmxlZCI6dHJ1ZSwia2V5IjoibWVzc2FnZV9pZCIsInZhbHVlIjoiIiwidHlwZSI6InRleHQifV0=\"><img
124
+ src=\"https://run.pstmn.io/button.svg\" alt=\"Run in Postman\"/></a>
125
+
126
+ ## Sample Apps
127
+ - [Perl Sample App](https://github.com/telstra/MessagingAPI-perl-sample-app)
128
+ - [Happy Chat App](https://github.com/telstra/messaging-sample-code-happy-chat)
129
+ - [PHP Sample App](https://github.com/developersteve/telstra-messaging-php)
130
+
131
+ ## SDK Repos
132
+ - [Messaging API - PHP SDK](https://github.com/telstra/MessagingAPI-SDK-php)
133
+ - [Messaging API - Python SDK](https://github.com/telstra/MessagingAPI-SDK-python)
134
+ - [Messaging API - Ruby SDK](https://github.com/telstra/MessagingAPI-SDK-ruby)
135
+ - [Messaging API - NodeJS SDK](https://github.com/telstra/MessagingAPI-SDK-node)
136
+ - [Messaging API - .Net2 SDK](https://github.com/telstra/MessagingAPI-SDK-dotnet)
137
+ - [Messaging API - Java SDK](https://github.com/telstra/MessagingAPI-SDK-Java)
138
+
139
+ ## Blog Posts
140
+ For more information on the Messaging API, you can read these blog posts:
141
+ - [Callbacks Part 1](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-1)
142
+ - [Callbacks Part 2](https://dev.telstra.com/content/understanding-messaging-api-callbacks-part-2)
143
+
144
+
145
+
146
+ - API version: 2.2.9
147
+ - Package version: 1.0.6.1
148
+
149
+ ## Installation
150
+
151
+ ### Build a gem
152
+
153
+ To build the Ruby code into a gem:
154
+
155
+ ```shell
156
+ gem build Telstra_Messaging.gemspec
157
+ ```
158
+
159
+ Then either install the gem locally:
160
+
161
+ ```shell
162
+ gem install ./Telstra_Messaging-1.0.6.1.gem
163
+ ```
164
+ (for development, run `gem install --dev ./Telstra_Messaging-1.0.6.1.gem` to install the development dependencies)
165
+
166
+ or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
167
+
168
+ Finally add this to the Gemfile:
169
+
170
+ gem 'Telstra_Messaging', '~> 1.0.6.1'
171
+
172
+ ### Install from Git
173
+
174
+ If the Ruby gem is hosted at a git repository: https://github.com/Telstra/MessagingAPI-SDK-Ruby, then add the following in the Gemfile:
175
+
176
+ gem 'Telstra_Messaging', :git => 'https://github.com/Telstra/MessagingAPI-SDK-Ruby.git'
177
+
178
+ ### Include the Ruby code directly
179
+
180
+ Include the Ruby code directly using `-I` as follows:
181
+
182
+ ```shell
183
+ ruby -Ilib script.rb
184
+ ```
185
+
186
+ ## Getting Started
187
+
188
+ Please follow the [installation](#installation) procedure and then run the following code:
189
+ ```ruby
190
+ # Load the gem
191
+ require 'Telstra_Messaging'
192
+
193
+ api_instance = Telstra_Messaging::AuthenticationApi.new
194
+ client_id = 'client_id_example' # String |
195
+ client_secret = 'client_secret_example' # String |
196
+ grant_type = 'client_credentials' # String |
197
+
198
+ begin
199
+ #Generate OAuth2 token
200
+ result = api_instance.auth_token(client_id, client_secret, grant_type)
201
+ p result
202
+ rescue Telstra_Messaging::ApiError => e
203
+ puts "Exception when calling AuthenticationApi->auth_token: #{e}"
204
+ end
205
+
206
+ ```
207
+
208
+ ## Documentation for API Endpoints
209
+
210
+ All URIs are relative to *https://tapi.telstra.com/v2*
211
+
212
+ Class | Method | HTTP request | Description
213
+ ------------ | ------------- | ------------- | -------------
214
+ *Telstra_Messaging::AuthenticationApi* | [**auth_token**](docs/AuthenticationApi.md#auth_token) | **POST** /oauth/token | Generate OAuth2 token
215
+ *Telstra_Messaging::MessagingApi* | [**get_mms_status**](docs/MessagingApi.md#get_mms_status) | **GET** /messages/mms/{messageid}/status | Get MMS Status
216
+ *Telstra_Messaging::MessagingApi* | [**get_sms_status**](docs/MessagingApi.md#get_sms_status) | **GET** /messages/sms/{messageId}/status | Get SMS Status
217
+ *Telstra_Messaging::MessagingApi* | [**retrieve_mms_responses**](docs/MessagingApi.md#retrieve_mms_responses) | **GET** /messages/mms | Retrieve MMS Responses
218
+ *Telstra_Messaging::MessagingApi* | [**retrieve_sms_responses**](docs/MessagingApi.md#retrieve_sms_responses) | **GET** /messages/sms | Retrieve SMS Responses
219
+ *Telstra_Messaging::MessagingApi* | [**send_mms**](docs/MessagingApi.md#send_mms) | **POST** /messages/mms | Send MMS
220
+ *Telstra_Messaging::MessagingApi* | [**send_sms**](docs/MessagingApi.md#send_sms) | **POST** /messages/sms | Send SMS
221
+ *Telstra_Messaging::ProvisioningApi* | [**create_subscription**](docs/ProvisioningApi.md#create_subscription) | **POST** /messages/provisioning/subscriptions | Create Subscription
222
+ *Telstra_Messaging::ProvisioningApi* | [**delete_subscription**](docs/ProvisioningApi.md#delete_subscription) | **DELETE** /messages/provisioning/subscriptions | Delete Subscription
223
+ *Telstra_Messaging::ProvisioningApi* | [**get_subscription**](docs/ProvisioningApi.md#get_subscription) | **GET** /messages/provisioning/subscriptions | Get Subscription
224
+
225
+
226
+ ## Documentation for Models
227
+
228
+ - [Telstra_Messaging::DeleteNumberRequest](docs/DeleteNumberRequest.md)
229
+ - [Telstra_Messaging::GetSubscriptionResponse](docs/GetSubscriptionResponse.md)
230
+ - [Telstra_Messaging::InboundPollResponse](docs/InboundPollResponse.md)
231
+ - [Telstra_Messaging::MMSContent](docs/MMSContent.md)
232
+ - [Telstra_Messaging::Message](docs/Message.md)
233
+ - [Telstra_Messaging::MessageSentResponse](docs/MessageSentResponse.md)
234
+ - [Telstra_Messaging::OAuthResponse](docs/OAuthResponse.md)
235
+ - [Telstra_Messaging::OutboundPollResponse](docs/OutboundPollResponse.md)
236
+ - [Telstra_Messaging::ProvisionNumberRequest](docs/ProvisionNumberRequest.md)
237
+ - [Telstra_Messaging::ProvisionNumberResponse](docs/ProvisionNumberResponse.md)
238
+ - [Telstra_Messaging::SendMmsRequest](docs/SendMmsRequest.md)
239
+ - [Telstra_Messaging::SendSMSRequest](docs/SendSMSRequest.md)
240
+ - [Telstra_Messaging::Status](docs/Status.md)
241
+
242
+
243
+ ## Documentation for Authorisation
244
+
245
+
246
+ ### auth
247
+
248
+ - **Type**: OAuth
249
+ - **Flow**: application
250
+ - **Authorisation URL**:
251
+ - **Scopes**:
252
+ - NSMS: NSMS
253
+
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ begin
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+ task default: :spec
8
+ rescue LoadError
9
+ # no rspec available
10
+ end
@@ -0,0 +1,45 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ =begin
4
+ #Telstra Messaging API
5
+
6
+ # # Introduction <table><tbody><tr><td class = 'into_api' style='border:none;padding:0 0 0 0'><p>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.</p></td><td class = 'into_api_logo' style='width: 20%;border:none'><img class = 'api_logo' style='margin: -26px 0 0 0' src = 'https://test-telstra-retail-tdev.devportal.apigee.io/sites/default/files/messagingapi-icon.png'></td></tr></tbody></table> # 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: <pre><code class=\"language-sh\">{ \"status\":\"400\", \"code\":\"DELIVERY-IMPOSSIBLE\", \"message\":\"Invalid \\'from\\' address specified\" }</code></pre> 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 <a href=\"https://app.getpostman.com/run-collection/ded00578f69a9deba256#?env%5BMessaging%20API%20Environments%5D=W3siZW5hYmxlZCI6dHJ1ZSwia2V5IjoiY2xpZW50X2lkIiwidmFsdWUiOiIiLCJ0eXBlIjoidGV4dCJ9LHsiZW5hYmxlZCI6dHJ1ZSwia2V5IjoiY2xpZW50X3NlY3JldCIsInZhbHVlIjoiIiwidHlwZSI6InRleHQifSx7ImVuYWJsZWQiOnRydWUsImtleSI6ImFjY2Vzc190b2tlbiIsInZhbHVlIjoiIiwidHlwZSI6InRleHQifSx7ImVuYWJsZWQiOnRydWUsImtleSI6Imhvc3QiLCJ2YWx1ZSI6InRhcGkudGVsc3RyYS5jb20iLCJ0eXBlIjoidGV4dCJ9LHsiZW5hYmxlZCI6dHJ1ZSwia2V5IjoiQXV0aG9yaXphdGlvbiIsInZhbHVlIjoiIiwidHlwZSI6InRleHQifSx7ImVuYWJsZWQiOnRydWUsImtleSI6Im9hdXRoX2hvc3QiLCJ2YWx1ZSI6InNhcGkudGVsc3RyYS5jb20iLCJ0eXBlIjoidGV4dCJ9LHsiZW5hYmxlZCI6dHJ1ZSwia2V5IjoibWVzc2FnZV9pZCIsInZhbHVlIjoiIiwidHlwZSI6InRleHQifV0=\"><img src=\"https://run.pstmn.io/button.svg\" alt=\"Run in Postman\"/></a> ## 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)
7
+
8
+ OpenAPI spec version: 2.2.9
9
+
10
+ Generated by: https://openapi-generator.tech
11
+ OpenAPI Generator version: 3.2.0
12
+
13
+ =end
14
+
15
+ $:.push File.expand_path("../lib", __FILE__)
16
+ require "Telstra_Messaging/version"
17
+
18
+ Gem::Specification.new do |s|
19
+ s.name = "Telstra_Messaging"
20
+ s.version = Telstra_Messaging::VERSION
21
+ s.platform = Gem::Platform::RUBY
22
+ s.authors = ["Telstra"]
23
+ s.email = [""]
24
+ s.homepage = "https://dev.telstra.com"
25
+ s.summary = "Telstra Messaging API Ruby Gem"
26
+ s.description = " # Introduction <table><tbody><tr><td class = 'into_api' style='border:none;padding:0 0 0 0'><p>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.</p></td><td class = 'into_api_logo' style='width: 20%;border:none'><img class = 'api_logo' style='margin: -26px 0 0 0' src = 'https://test-telstra-retail-tdev.devportal.apigee.io/sites/default/files/messagingapi-icon.png'></td></tr></tbody></table> # 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: <pre><code class=\"language-sh\">{ \"status\":\"400\", \"code\":\"DELIVERY-IMPOSSIBLE\", \"message\":\"Invalid \\'from\\' address specified\" }</code></pre> 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 <a href=\"https://app.getpostman.com/run-collection/ded00578f69a9deba256#?env%5BMessaging%20API%20Environments%5D=W3siZW5hYmxlZCI6dHJ1ZSwia2V5IjoiY2xpZW50X2lkIiwidmFsdWUiOiIiLCJ0eXBlIjoidGV4dCJ9LHsiZW5hYmxlZCI6dHJ1ZSwia2V5IjoiY2xpZW50X3NlY3JldCIsInZhbHVlIjoiIiwidHlwZSI6InRleHQifSx7ImVuYWJsZWQiOnRydWUsImtleSI6ImFjY2Vzc190b2tlbiIsInZhbHVlIjoiIiwidHlwZSI6InRleHQifSx7ImVuYWJsZWQiOnRydWUsImtleSI6Imhvc3QiLCJ2YWx1ZSI6InRhcGkudGVsc3RyYS5jb20iLCJ0eXBlIjoidGV4dCJ9LHsiZW5hYmxlZCI6dHJ1ZSwia2V5IjoiQXV0aG9yaXphdGlvbiIsInZhbHVlIjoiIiwidHlwZSI6InRleHQifSx7ImVuYWJsZWQiOnRydWUsImtleSI6Im9hdXRoX2hvc3QiLCJ2YWx1ZSI6InNhcGkudGVsc3RyYS5jb20iLCJ0eXBlIjoidGV4dCJ9LHsiZW5hYmxlZCI6dHJ1ZSwia2V5IjoibWVzc2FnZV9pZCIsInZhbHVlIjoiIiwidHlwZSI6InRleHQifV0=\"><img src=\"https://run.pstmn.io/button.svg\" alt=\"Run in Postman\"/></a> ## 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) "
27
+ s.license = 'Apache-2.0'
28
+ s.required_ruby_version = ">= 1.9"
29
+
30
+ s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
31
+ s.add_runtime_dependency 'json', '~> 2.1', '>= 2.1.0'
32
+
33
+ s.add_development_dependency 'rspec', '~> 3.6', '>= 3.6.0'
34
+ s.add_development_dependency 'vcr', '~> 3.0', '>= 3.0.1'
35
+ s.add_development_dependency 'webmock', '~> 1.24', '>= 1.24.3'
36
+ s.add_development_dependency 'autotest', '~> 4.4', '>= 4.4.6'
37
+ s.add_development_dependency 'autotest-rails-pure', '~> 4.1', '>= 4.1.2'
38
+ s.add_development_dependency 'autotest-growl', '~> 0.2', '>= 0.2.16'
39
+ s.add_development_dependency 'autotest-fsevent', '~> 0.2', '>= 0.2.12'
40
+
41
+ s.files = `find *`.split("\n").uniq.sort.select { |f| !f.empty? }
42
+ s.test_files = `find spec/*`.split("\n")
43
+ s.executables = []
44
+ s.require_paths = ["lib"]
45
+ end
@@ -0,0 +1,58 @@
1
+ # Telstra_Messaging::AuthenticationApi
2
+
3
+ All URIs are relative to *https://tapi.telstra.com/v2*
4
+
5
+ Method | HTTP request | Description
6
+ ------------- | ------------- | -------------
7
+ [**auth_token**](AuthenticationApi.md#auth_token) | **POST** /oauth/token | Generate OAuth2 token
8
+
9
+
10
+ # **auth_token**
11
+ > OAuthResponse auth_token(client_id, client_secret, grant_type)
12
+
13
+ Generate OAuth2 token
14
+
15
+ 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.
16
+
17
+ ### Example
18
+ ```ruby
19
+ # load the gem
20
+ require 'Telstra_Messaging'
21
+
22
+ api_instance = Telstra_Messaging::AuthenticationApi.new
23
+ client_id = 'client_id_example' # String |
24
+ client_secret = 'client_secret_example' # String |
25
+ grant_type = 'client_credentials' # String |
26
+
27
+ begin
28
+ #Generate OAuth2 token
29
+ result = api_instance.auth_token(client_id, client_secret, grant_type)
30
+ p result
31
+ rescue Telstra_Messaging::ApiError => e
32
+ puts "Exception when calling AuthenticationApi->auth_token: #{e}"
33
+ end
34
+ ```
35
+
36
+ ### Parameters
37
+
38
+ Name | Type | Description | Notes
39
+ ------------- | ------------- | ------------- | -------------
40
+ **client_id** | **String**| |
41
+ **client_secret** | **String**| |
42
+ **grant_type** | **String**| | [default to &#39;client_credentials&#39;]
43
+
44
+ ### Return type
45
+
46
+ [**OAuthResponse**](OAuthResponse.md)
47
+
48
+ ### Authorization
49
+
50
+ No authorization required
51
+
52
+ ### HTTP request headers
53
+
54
+ - **Content-Type**: application/x-www-form-urlencoded
55
+ - **Accept**: application/json
56
+
57
+
58
+
@@ -0,0 +1,8 @@
1
+ # Telstra_Messaging::DeleteNumberRequest
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **empty_arr** | **Integer** | Empty Arr | [optional] [default to 0]
7
+
8
+
@@ -0,0 +1,10 @@
1
+ # Telstra_Messaging::GetSubscriptionResponse
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **active_days** | **String** | Number of active days | [optional]
7
+ **notify_url** | **String** | Notify url configured | [optional]
8
+ **destination_address** | **String** | The mobile phone number that was allocated | [optional]
9
+
10
+
@@ -0,0 +1,13 @@
1
+ # Telstra_Messaging::InboundPollResponse
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **status** | **String** | message status | [optional]
7
+ **destination_address** | **String** | The phone number (recipient) that the message was sent to (in E.164 format). | [optional]
8
+ **sender_address** | **String** | The phone number (sender) that the message was sent from (in E.164 format). | [optional]
9
+ **message** | **String** | Text of the message that was sent | [optional]
10
+ **message_id** | **String** | Message Id | [optional]
11
+ **sent_timestamp** | **String** | The date and time when the message was sent by recipient. | [optional]
12
+
13
+
@@ -0,0 +1,10 @@
1
+ # Telstra_Messaging::MMSContent
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **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\&quot; |
7
+ **filename** | **String** | The file name to be associated with the content. Some devices will display this file name with a placeholder for the content. |
8
+ **payload** | **String** | |
9
+
10
+
@@ -0,0 +1,11 @@
1
+ # Telstra_Messaging::Message
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **to** | **String** | Just a copy of the number the message is sent to. |
7
+ **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. |
8
+ **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 &#x60;messageId&#x60; will be different for each number that the message was sent to. |
9
+ **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]
10
+
11
+