var api = require('./api.js');
var smsApi = new api.SMSApi("USERNAME", "API_KEY");
var smsMessage = new api.SmsMessage();
smsMessage.source = "sdk";
smsMessage.to = "+0451111111";
smsMessage.body = "test message";
var smsCollection = new api.SmsMessageCollection();
smsCollection.messages = [smsMessage];
smsApi.smsSendPost(smsCollection).then(function(response) {
console.log(response.body);
}).catch(function(err){
console.error(err.body);
});
from __future__ import print_function
import clicksend_client
from clicksend_client import SmsMessage
from clicksend_client.rest import ApiException
# Configure HTTP basic authorization: BasicAuth
configuration = clicksend_client.Configuration()
configuration.username = 'USERNAME'
configuration.password = 'API_KEY'
# create an instance of the API class
api_instance = clicksend_client.SMSApi(clicksend_client.ApiClient(configuration))
# If you want to explicitly set from, add the key _from to the message.
sms_message = SmsMessage(source="php",
body="Jelly liquorice marshmallow candy carrot cake 4Eyffjs1vL.",
to="+61411111111",
schedule=1436874701)
sms_messages = clicksend_client.SmsMessageCollection(messages=[sms_message])
try:
# Send sms message(s)
api_response = api_instance.sms_send_post(sms_messages)
print(api_response)
except ApiException as e:
print("Exception when calling SMSApi->sms_send_post: %s\n" % e)
package ClickSend;
import java.util.Arrays;
import java.util.List;
import ClickSend.Api.SmsApi;
import ClickSend.Model.SmsMessage;
import ClickSend.Model.SmsMessageCollection;
public class send_sms {
public static void main(String[] args) {
ApiClient defaultClient = new ApiClient();
defaultClient.setUsername("USERNAME");
defaultClient.setPassword("API_KEY");
SmsApi apiInstance = new SmsApi(defaultClient);
SmsMessage smsMessage = new SmsMessage();
smsMessage.body("body");
smsMessage.to("to");
smsMessage.source("source");
List<SmsMessage> smsMessageList = Arrays.asList(smsMessage);
// SmsMessageCollection | SmsMessageCollection model
SmsMessageCollection smsMessages = new SmsMessageCollection();
smsMessages.messages(smsMessageList);
try {
String result = apiInstance.smsSendPost(smsMessages);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling SmsApi#smsSendPost");
e.printStackTrace();
}
}
}
using IO.ClickSend.ClickSend.Api;
using IO.ClickSend.Client;
using IO.ClickSend.ClickSend.Model;
var configuration = new Configuration()
{
Username = USERNAME,
Password = API_KEY
};
var smsApi = new SMSApi(configuration);
var listOfSms = new List<SmsMessage>
{
new SmsMessage(
to: "+61411111111",
body: "test message",
source: "sdk"
)
};
var smsCollection = new SmsMessageCollection(listOfSms);
var response = smsApi.SmsSendPost(smsCollection);
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure HTTP basic authorization: BasicAuth
$config = ClickSend\Configuration::getDefaultConfiguration()
->setUsername('USERNAME')
->setPassword('API_KEY');
$apiInstance = new ClickSend\Api\SMSApi(new GuzzleHttp\Client(),$config);
$msg = new \ClickSend\Model\SmsMessage();
$msg->setBody("test body");
$msg->setTo("0451111111");
$msg->setSource("sdk");
// \ClickSend\Model\SmsMessageCollection | SmsMessageCollection model
$sms_messages = new \ClickSend\Model\SmsMessageCollection();
$sms_messages->setMessages([$msg]);
try {
$result = $apiInstance->smsSendPost($sms_messages);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling SMSApi->smsSendPost: ', $e->getMessage(), PHP_EOL;
}
?>
# load the gem
require 'clicksend_client'
require 'json'
# setup authorization
ClickSendClient.configure do |config|
# Configure HTTP basic authorization: BasicAuth
config.username = 'USERNAME'
config.password = 'API_KEY'
end
api_instance = ClickSendClient::SMSApi.new
# SmsMessageCollection | SmsMessageCollection model
sms_messages = ClickSendClient::SmsMessageCollection.new
sms_messages.messages = [
ClickSendClient::SmsMessage.new(
"to": "+61411111111",
"source": "sdk",
"body": "body"
),
ClickSendClient::SmsMessage.new(
"to": "+61422222222",
"source": "sdk",
"body": "body"
)
]
begin
# Send sms message(s)
result = api_instance.sms_send_post(sms_messages)
p JSON.parse(result)
rescue ClickSendClient::ApiError => e
puts "Exception when calling SMSApi->sms_send_post: #{e.response_body}"
end
import Alamofire
if let authHeader = Request.authorizationHeader(user: "USERNAME", password: "PASSWORD") {
ClickSendClientAPI.customHeaders = [authHeader.key : authHeader.value]
}
let message1 = SmsMessage(body: "Chocolate bar icing icing oat cake carrot cake jelly cotton MWEvciEPIr.",
to: "+0451111111",
source: "swift")
let message2 = SmsMessage(body: "Chocolate bar icing icing oat cake carrot cake jelly cotton MWEvciEPIr.",
source: "swift",
listId: 1234)
let smsCollection = SmsMessageCollection(messages: [message1, message2])
SMSAPI.smsSendPost(smsMessages: smsCollection) { (dataString, error) in
guard let dataString = dataString else {
print(error!)
return
}
if let data = dataString.data(using: String.Encoding.utf8) {
do {
if let dictonary = try (JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary) {
print(dictonary)
} else {
print("bad json")
}
} catch let error as NSError {
print(error)
}
}
}