Telstra_Messaging
TelstraMessaging - JavaScript client for Telstra_Messaging
- API version: 2.2.9
- Package version: 1.0.6
Installation
Node.js
Fornpm
To publish the library as a npm,
Then install it via:
npm install Telstra_Messaging --save
Local development
To use the library locally without publishing to a remote npm registry, first install the dependencies by changing
into the directory containing package.json
(and this README). Let's call this JAVASCRIPT_CLIENT_DIR
. Then run:
npm install
Next, link it globally in npm with the following, also from JAVASCRIPT_CLIENT_DIR
:
npm link
Finally, switch to the directory you want to use your Telstra_Messaging from, and run:
npm link /path/to/<JAVASCRIPT_CLIENT_DIR>
You should now be able to require('Telstra_Messaging')
in javascript files from the directory you ran the last
command above from.
git
If the library is hosted at a git repository, e.g. https://github.com/Telstra/MessagingAPI-SDK-node then install it via:
npm install Telstra/MessagingAPI-SDK-node --save
For browser
The library also works in the browser environment via npm and browserify. After following
the above steps with Node.js and installing browserify with npm install -g browserify
,
perform the following (assuming main.js is your entry file, that's to say your javascript file where you actually
use this library):
browserify main.js > bundle.js
Then include bundle.js in the HTML pages.
Webpack Configuration
Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:
module: {
rules: [
{
parser: {
amd: false
}
}
]
}
Getting Started
Please follow the installation instruction and execute the following JS code:
var TelstraMessaging = require('Telstra_Messaging');
var api = new TelstraMessaging.AuthenticationApi()
var clientId = "clientId_example"; // {String}
var clientSecret = "clientSecret_example"; // {String}
var grantType = "'client_credentials'"; // {String}
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
api.authToken(clientId, clientSecret, grantType, callback);
Documentation for API Endpoints
All URIs are relative to https://tapi.telstra.com/v2
Class | Method | HTTP request | Description |
---|---|---|---|
TelstraMessaging.AuthenticationApi | authToken | POST /oauth/token | Generate OAuth2 token |
TelstraMessaging.MessagingApi | getMMSStatus | GET /messages/mms/{messageid}/status | Get MMS Status |
TelstraMessaging.MessagingApi | getSMSStatus | GET /messages/sms/{messageId}/status | Get SMS Status |
TelstraMessaging.MessagingApi | retrieveMMSResponses | GET /messages/mms | Retrieve MMS Responses |
TelstraMessaging.MessagingApi | retrieveSMSResponses | GET /messages/sms | Retrieve SMS Responses |
TelstraMessaging.MessagingApi | sendMMS | POST /messages/mms | Send MMS |
TelstraMessaging.MessagingApi | sendSMS | POST /messages/sms | Send SMS |
TelstraMessaging.ProvisioningApi | createSubscription | POST /messages/provisioning/subscriptions | Create Subscription |
TelstraMessaging.ProvisioningApi | deleteSubscription | DELETE /messages/provisioning/subscriptions | Delete Subscription |
TelstraMessaging.ProvisioningApi | getSubscription | GET /messages/provisioning/subscriptions | Get Subscription |
Documentation for Models
- TelstraMessaging.DeleteNumberRequest
- TelstraMessaging.GetSubscriptionResponse
- TelstraMessaging.InboundPollResponse
- TelstraMessaging.MMSContent
- TelstraMessaging.Message
- TelstraMessaging.MessageSentResponse
- TelstraMessaging.OAuthResponse
- TelstraMessaging.OutboundPollResponse
- TelstraMessaging.ProvisionNumberRequest
- TelstraMessaging.ProvisionNumberResponse
- TelstraMessaging.SendMmsRequest
- TelstraMessaging.SendSMSRequest
- TelstraMessaging.Status
Documentation for Authorisation
auth
- Type: OAuth
- Flow: application
- Authorisation URL:
-
Scopes:
- NSMS: NSMS