class Telstra_Messaging::MessagingApi
Attributes
Public Class Methods
# File lib/Telstra_Messaging/api/messaging_api.rb, line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end
Public Instance Methods
Get MMS Status
Get MMS Status
@param messageid Unique identifier of a message - it is the value returned from a previous POST call to api.telstra.com/v2/messages/mms @param [Hash] opts the optional parameters @return [Array<OutboundPollResponse>]
# File lib/Telstra_Messaging/api/messaging_api.rb, line 27 def get_mms_status(messageid, opts = {}) data, _status_code, _headers = get_mms_status_with_http_info(messageid, opts) data 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 api.telstra.com/v2/messages/mms @param [Hash] opts the optional parameters @return [Array<(Array<OutboundPollResponse>, Fixnum, Hash)>] Array<OutboundPollResponse> data, response status code and response headers
# File lib/Telstra_Messaging/api/messaging_api.rb, line 37 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 ...' end # verify the required parameter 'messageid' is set if @api_client.config.client_side_validation && messageid.nil? 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) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['auth'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'Array<OutboundPollResponse>') 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. <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>to
</td> <td>The number the message was sent to.</td> </tr> <tr> <td>receivedTimestamp
</td> <td>Time the message was sent to the API.</td> </tr> <tr> <td>sentTimestamp
</td> <td>Time handling of the message ended.</td> </tr> <tr> <td>deliveryStatus
</td> <td>The final state of the message.</td> </tr> <tr> <td>messageId
</td> <td>The same reference that was returned when the original message was sent.</td> </tr> <tr> <td>receivedTimestamp
</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 api.telstra.com/v2/messages/sms. @param [Hash] opts the optional parameters @return [Array<OutboundPollResponse>]
# File lib/Telstra_Messaging/api/messaging_api.rb, line 79 def get_sms_status(message_id, opts = {}) data, _status_code, _headers = get_sms_status_with_http_info(message_id, opts) data 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 api.telstra.com/v2/messages/sms. @param [Hash] opts the optional parameters @return [Array<(Array<OutboundPollResponse>, Fixnum, Hash)>] Array<OutboundPollResponse> data, response status code and response headers
# File lib/Telstra_Messaging/api/messaging_api.rb, line 89 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 ...' end # verify the required parameter 'message_id' is set if @api_client.config.client_side_validation && message_id.nil? 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) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['auth'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'Array<OutboundPollResponse>') 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 <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. | @param [Hash] opts the optional parameters @return [Array<MMSContent>]
# File lib/Telstra_Messaging/api/messaging_api.rb, line 130 def retrieve_mms_responses(opts = {}) data, _status_code, _headers = retrieve_mms_responses_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. | @param [Hash] opts the optional parameters @return [Array<(Array<MMSContent>, Fixnum, Hash)>] Array<MMSContent> data, response status code and response headers
# File lib/Telstra_Messaging/api/messaging_api.rb, line 139 def retrieve_mms_responses_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MessagingApi.retrieve_mms_responses ...' end # resource path local_var_path = '/messages/mms' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['auth'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'Array<MMSContent>') 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}" 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 <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]
# File lib/Telstra_Messaging/api/messaging_api.rb, line 176 def retrieve_sms_responses(opts = {}) data, _status_code, _headers = retrieve_sms_responses_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. | @param [Hash] opts the optional parameters @return [Array<(InboundPollResponse
, Fixnum, Hash)>] InboundPollResponse
data, response status code and response headers
# File lib/Telstra_Messaging/api/messaging_api.rb, line 185 def retrieve_sms_responses_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MessagingApi.retrieve_sms_responses ...' end # resource path local_var_path = '/messages/sms' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['auth'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'InboundPollResponse') 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}" end return data, status_code, headers end
@param [Hash] opts the optional parameters @return [MessageSentResponse]
# File lib/Telstra_Messaging/api/messaging_api.rb, line 224 def send_mms(send_mms_request, opts = {}) data, _status_code, _headers = send_mms_with_http_info(send_mms_request, opts) data end
@param [Hash] opts the optional parameters @return [Array<(MessageSentResponse
, Fixnum, Hash)>] MessageSentResponse
data, response status code and response headers
# File lib/Telstra_Messaging/api/messaging_api.rb, line 235 def send_mms_with_http_info(send_mms_request, 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" end # resource path local_var_path = '/messages/mms' # query parameters query_params = {} # header parameters 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 = {} # 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, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'MessageSentResponse') 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
@param [Hash] opts the optional parameters @return [MessageSentResponse]
# File lib/Telstra_Messaging/api/messaging_api.rb, line 280 def send_sms(send_sms_request, opts = {}) data, _status_code, _headers = send_sms_with_http_info(send_sms_request, opts) data end
@param [Hash] opts the optional parameters @return [Array<(MessageSentResponse
, Fixnum, Hash)>] MessageSentResponse
data, response status code and response headers
# File lib/Telstra_Messaging/api/messaging_api.rb, line 291 def send_sms_with_http_info(send_sms_request, 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" end # resource path local_var_path = '/messages/sms' # query parameters query_params = {} # header parameters 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 = {} # 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, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'MessageSentResponse') 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 return data, status_code, headers end