Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

TelstraMessaging

Telstra Messaging API

  • API version: 2.2.9

Automatically generated by the OpenAPI Generator

Requirements

Building the API client library requires:

  1. Java 1.7+
  2. Maven/Gradle

Installation

To install the API client library to your local Maven repository, simply execute:

mvn clean install

To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:

mvn clean deploy

Refer to the OSSRH Guide for more information.

Maven users

Add this dependency to your project's POM:

<dependency>
  <groupId>Telstra</groupId>
  <artifactId>TelstraMessaging</artifactId>
  <version>1.0.0</version>
  <scope>compile</scope>
</dependency>

Gradle users

Add this dependency to your project's build file:

compile "Telstra:TelstraMessaging:1.0.0"

Others

At first generate the JAR by executing:

mvn clean package

Then manually install the following JARs:

  • target/TelstraMessaging-1.0.0.jar
  • target/lib/*.jar

Getting Started

Please follow the installation instruction and execute the following Java code:

// Import classes:
import com.telstra.ApiClient;
import com.telstra.ApiException;
import com.telstra.Configuration;
import com.telstra.auth.*;
import com.telstra.messaging.*;

public class Example {
  public static void main(String[] args) {
    // Configure API base path
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://tapi.telstra.com/v2");

    // Configure OAuth2 access token for authorization
    OAuth auth = (OAuth) defaultClient.getAuthentication("auth");
    AuthenticationApi authenticationApi = new AuthenticationApi(defaultClient);
    String clientId = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
    String clientSecret = "xxxxxxxxxxxxxxxx";
    String grantType = "client_credentials";
    String scope = "NSMS";
    try {
      OAuthResponse oAuthResponse = authenticationApi.authToken(clientId, clientSecret, grantType, scope);
      auth.setAccessToken(oAuthResponse.getAccessToken());
    } catch (ApiException e) {
      System.err.println("Exception when calling AuthenticationApi#authToken");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }

    // Configure phone number subscription
    ProvisioningApi provisioningApiInstance = new ProvisioningApi(defaultClient);
    try {
      ProvisionNumberRequest provisionNumberRequest = new ProvisionNumberRequest();
      ProvisionNumberResponse result = provisioningApiInstance.createSubscription(provisionNumberRequest);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling ProvisioningApi#createSubscription");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }

    // Send SMS
    MessagingApi msgingApiInstance = new MessagingApi(defaultClient);
    try {
      SendSMSRequest sendSmsRequest = new SendSMSRequest();
      sendSmsRequest.to("+61xxxxxxxxx");
      sendSmsRequest.body("Hello from Java!");
      MessageSentResponseSms result = msgingApiInstance.sendSMS(sendSmsRequest);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling MessagingApi#sendSMS");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Documentation for API Endpoints

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

Class Method HTTP request Description
AuthenticationApi authToken POST /oauth/token Generate OAuth2 token
MessagingApi getMMSStatus GET /messages/mms/{messageid}/status Get MMS Status
MessagingApi getSMSStatus GET /messages/sms/{messageId}/status Get SMS Status
MessagingApi mMSHealthCheck GET /messages/mms/heathcheck MMS Health Check
MessagingApi retrieveMMSReplies GET /messages/mms Retrieve MMS Replies
MessagingApi retrieveSMSReplies GET /messages/sms Retrieve SMS Replies
MessagingApi sMSHealthCheck GET /messages/sms/heathcheck SMS Health Check
MessagingApi sMSMulti POST /messages/sms/multi Send Multiple SMS
MessagingApi sendMMS POST /messages/mms Send MMS
MessagingApi sendSMS POST /messages/sms Send SMS
ProvisioningApi createSubscription POST /messages/provisioning/subscriptions Create Subscription
ProvisioningApi deleteSubscription DELETE /messages/provisioning/subscriptions Delete Subscription
ProvisioningApi getSubscription GET /messages/provisioning/subscriptions Get Subscription

Documentation for Models

Documentation for Authorization

Authentication schemes defined for the API:

auth

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

Recommendation

It's recommended to create an instance of ApiClient per thread in a multithreaded environment to avoid any potential issues.

Author

You can’t perform that action at this time.