No commit activity in last 3 years
No release in over 3 years
Telstra_Messaging - the Ruby gem for the Telstra Messaging API
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 4.4.6, ~> 4.4
>= 0.2.12, ~> 0.2
>= 0.2.16, ~> 0.2
>= 4.1.2, ~> 4.1
>= 3.6.0, ~> 3.6
>= 3.0.1, ~> 3.0
>= 1.24.3, ~> 1.24

Runtime

>= 2.1.0, ~> 2.1
>= 1.0.1, ~> 1.0
 Project Readme

Telstra_Messaging

Telstra_Messaging - the Ruby gem for the Telstra Messaging API

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.
  2. After registration, login to 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.
  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

<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"/>

Sample Apps

SDK Repos

Blog Posts

For more information on the Messaging API, you can read these blog posts:

Installation

Build a gem

To build the Ruby code into a gem:

gem build Telstra_Messaging.gemspec

Then either install the gem locally:

gem install ./Telstra_Messaging-1.0.6.gem

(for development, run gem install --dev ./Telstra_Messaging-1.0.6.gem to install the development dependencies)

or publish the gem to a gem hosting service, e.g. RubyGems.

Finally add this to the Gemfile:

gem 'Telstra_Messaging', '~> 1.0.6'

Install from Git

If the Ruby gem is hosted at a git repository: https://github.com/Telstra/MessagingAPI-SDK-Ruby, then add the following in the Gemfile:

gem 'Telstra_Messaging', :git => 'https://github.com/Telstra/MessagingAPI-SDK-Ruby.git'

Include the Ruby code directly

Include the Ruby code directly using -I as follows:

ruby -Ilib script.rb

Getting Started

Please follow the installation procedure and then run the following code:

# Load the gem
require 'Telstra_Messaging'

api_instance = Telstra_Messaging::AuthenticationApi.new
client_id = 'client_id_example' # String | 
client_secret = 'client_secret_example' # String | 
grant_type = 'client_credentials' # String | 

begin
  #Generate OAuth2 token
  result = api_instance.auth_token(client_id, client_secret, grant_type)
  p result
rescue Telstra_Messaging::ApiError => e
  puts "Exception when calling AuthenticationApi->auth_token: #{e}"
end

Documentation for API Endpoints

All URIs are relative to https://tapi.telstra.com/v2

Class Method HTTP request Description
Telstra_Messaging::AuthenticationApi auth_token POST /oauth/token Generate OAuth2 token
Telstra_Messaging::MessagingApi get_mms_status GET /messages/mms/{messageid}/status Get MMS Status
Telstra_Messaging::MessagingApi get_sms_status GET /messages/sms/{messageId}/status Get SMS Status
Telstra_Messaging::MessagingApi retrieve_mms_responses GET /messages/mms Retrieve MMS Responses
Telstra_Messaging::MessagingApi retrieve_sms_responses GET /messages/sms Retrieve SMS Responses
Telstra_Messaging::MessagingApi send_mms POST /messages/mms Send MMS
Telstra_Messaging::MessagingApi send_sms POST /messages/sms Send SMS
Telstra_Messaging::ProvisioningApi create_subscription POST /messages/provisioning/subscriptions Create Subscription
Telstra_Messaging::ProvisioningApi delete_subscription DELETE /messages/provisioning/subscriptions Delete Subscription
Telstra_Messaging::ProvisioningApi get_subscription GET /messages/provisioning/subscriptions Get Subscription

Documentation for Models

Documentation for Authorisation

auth

  • Type: OAuth
  • Flow: application
  • Authorisation URL:
  • Scopes:
    • NSMS: NSMS