Sample Codes

청기와랩의 SMS OpenAPI 샘플 코드들은 GitHub (https://github.com/bluehouselab/sms-openapi) 에서 다운 받으실 수 있습니다.

Git를 이용한 샘플코드 프로젝트 체크아웃:

$ git clone https://github.com/BlueHouseLab/sms-openapi.git

또는 샘플코드 Zip 아카이브 파일 다운 받기:

$ wget https://github.com/BlueHouseLab/sms-openapi/archive/master.zip

cURL

curl 은 많은 Unix 기반 Platform에 기본으로 탑재된 command line http client 입니다. 각종 Linux 배포판, BSD 배포판 및 Mac OS X에서 테스트 용도로 활용 가능 합니다.

env.sh - 발급 받은 appid, apikey 및 수발신 번호를 설정해 주세요.

#!/bin/bash
APPID=example
APIKEY=c5dd7e7dkjp27377l903c42c032b413b
HOST=https://api.bluehouselab.com:443

sendsms.sh - sms 발송

#!/bin/bash

SENDER=01000000000 # FIXME MUST BE CHANGED AS REAL PHONE NUMBER
RECEIVER=01000000000 # FIXME MUST BE CHANGED AS REAL PHONE NUMBER

. env.sh # load env

curl -i -u $APPID:$APIKEY \
     -X POST $HOST/smscenter/v1.0/sendsms \
     -H "Content-Type: application/json;charset=utf-8" \
     -d '{"sender": "'$SENDER'", "receivers": ["'$RECEIVER'"], "content": "나는 유리를 먹을 수 있어요. 그래도 아프지 않아요"}'

실행 예

$ ./sendsms.sh
HTTP/1.0 200 OK
Date: Thu, 03 Jul 2014 17:15:16 GMT
Content-Type: application/json; charset=utf-8

{"filtered": [], "reserved": null, "sent": [["01000000000", "201407040215163682530"]]}

result.sh - 발송 확인 예제, sendsms.sh 의 결과로 받은 발송ID를 인자로 주어야 함

#!/bin/bash
. env.sh # load env

if [ $# != 1 ]; then
	echo Usage $0 deliveryid
	exit 1
fi

DELIVERYID=$1

curl -i -u $APPID:$APIKEY $HOST/smscenter/v1.0/result/$DELIVERYID 

실행 예

$ ./result.sh 201407040215163682530
HTTP/1.0 200 OK
Date: Thu, 03 Jul 2014 17:20:55 GMT
Content-Type: application/json; charset=utf-8

{"status": "0", "destination": "01000000000", "sent_time": "2014-07-03T17:15:20Z"}

Python

Python 예제는 Standard Library인 httplib 모듈을 이용하여 작성 되었습니다. httplib 모듈은 SSL Certificate Verification 과정이 생략된 HTTP Client 모듈 이므로 개발 참고용으로만 사용하세요. 실제 개발에는 보안을 위해 Requests 모듈을 추천 합니다.

conf.py - 발급 받은 appid, apikey 및 수발신 번호를 설정해 주세요.

# -*- coding: utf-8 -*-
import base64

appid = 'example'
apikey = 'c5dd7e7dkjp27377l903c42c032b413b'
address = 'api.bluehouselab.com'

sender = '01000000000'        # FIXME - MUST BE CHANGED AS REAL PHONE NUMBER
receivers = ['01000000000', ] # FIXME - MUST BE CHANGED AS REAL PHONE NUMBERS
content = u'나는 유리를 먹을 수 있어요. 그래도 아프지 않아요'

credential = "Basic "+base64.encodestring(appid+':'+apikey).strip()
headers = {
  "Content-type": "application/json;charset=utf-8",
  "Authorization": credential,
}

sendsms.py - sms 발송

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import json
from conf import address, sender, receivers, headers, content

c = httplib.HTTPSConnection(address)

path = "/smscenter/v1.0/sendsms"
value = {
    'sender'     : sender,
    'receivers'  : receivers,
    'content'    : content,
}
data = json.dumps(value, ensure_ascii=False).encode('utf-8')

c.request("POST", path, data, headers)
r = c.getresponse()

print r.status, r.reason
print r.read()

실행 예

$ python sendsms.py
200 OK
{"filtered": [], "reserved": null, "sent": [["01000000000", "201407040043284939320"]]}

result.py - 발송 확인 예제, sendsms.py 의 결과로 받은 발송ID를 인자로 주어야 함

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import json
import sys

from conf import address, sender, receivers, headers, content

c = httplib.HTTPSConnection(address)

if len(sys.argv) == 1:
    print 'Usage:\n python %s deliveryid' % sys.argv[0]
    sys.exit(1)

deliveryid = sys.argv[1]
path = "/smscenter/v1.0/result/"+deliveryid

c.request("GET", path, '', headers)
r = c.getresponse()

print r.status, r.reason
print r.read()

실행 예

$ python result.py 201407040043284939320
200 OK
{"status": "0", "destination": "01000000000", "sent_time": "2014-07-03T15:43:31Z"}

Python (Requests)

Requests 모듈을 이용한 더 안전하고 Human을 위한 예제 구현 입니다.

sendsms.py - sms 발송

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests
import json
from conf import appid, apikey, sender, receivers, content

url = 'https://api.bluehouselab.com/smscenter/v1.0/sendsms'
params = {
    'sender'     : sender,
    'receivers'  : receivers,
    'content'    : content,
}
headers = {'Content-type': 'application/json; charset=utf-8',}
r = requests.post(url, data=json.dumps(params),
                auth=(appid, apikey), headers=headers)

print r.status_code, r.reason
if r.status_code == 200:
    print r.json()

실행 예

$ python sendsms.py
200 OK
{"filtered": [], "reserved": null, "sent": [["01000000000", "201407040043284939320"]]}

result.py - 발송 확인 예제, sendsms.py 의 결과로 받은 발송ID를 인자로 주어야 함

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import requests
import sys
from conf import appid, apikey, sender, receivers, content

if len(sys.argv) == 1:
    print 'Usage:\n python %s deliveryid' % sys.argv[0]
    sys.exit(1)

deliveryid = sys.argv[1]

url = 'https://api.bluehouselab.com/smscenter/v1.0/result/'+deliveryid
params = {
    'sender'     : sender,
    'receivers'  : receivers,
    'content'    : content,
}
headers = {'Content-type': 'application/json; charset=utf-8',}
r = requests.get(url, auth=(appid, apikey), headers=headers)

print r.status_code, r.reason
if r.status_code == 200:
    print r.json()

실행 예

$ python result.py 201407040043284939320
200 OK
{"status": "0", "destination": "01000000000", "sent_time": "2014-07-03T15:43:31Z"}

Ruby

sendsms.rb - sms 발송

#!/usr/bin/env ruby

require 'net/https'
require 'uri'
require 'json'
require './conf.rb'

uri = URI.parse('https://api.bluehouselab.com/smscenter/v1.0/sendsms')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
req = Net::HTTP::Post.new(uri.request_uri, initheader={'Content-Type' =>'application/json; charset=utf-8'})

req.basic_auth Conf::APPID, Conf::APIKEY
req.body = {
  sender: Conf::SENDER,
  receivers: Conf::RECEIVERS,
  content: Conf::CONTENT
}.to_json


resp = http.request(req)
puts resp.code
puts resp.body

실행 예

$ ruby sendsms.rb
200
{"filtered": [], "reserved": null, "sent": [["01000000000", "201407201409478863550"]]]}

result.rb - 발송 확인 예제, sendsms.rb 의 결과로 받은 발송ID를 인자로 주어야 함

#!/usr/bin/env ruby

require 'net/https'
require 'uri'
require './conf.rb'
if ARGV.size != 1
	puts 'Usage:'
	puts ' '+__FILE__+' delivery-id'
	exit
end
did = ARGV[0]

uri = URI.parse('https://api.bluehouselab.com/smscenter/v1.0/result/'+did)

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
req = Net::HTTP::Get.new(uri.request_uri)
req.basic_auth Conf::APPID, Conf::APIKEY

resp = http.request(req)
puts resp.code
puts resp.body

실행 예

$ ./result.rb 201407201409478863550
200
{"status": "0", "destination": "01000000000", "sent_time": "2014-07-20T05:09:51Z"}

PHP

sendsms.php - sms 발송

<?php
include "conf.php";

$data = array(
			"sender" => $SENDER,
			"receivers" => $RECEIVERS,
			"content" => $CONTENT,
		);

$ch = curl_init("https://api.bluehouselab.com/smscenter/v1.0/sendsms");
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_USERPWD, "$APPID:$APIKEY");
curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Content-Type: application/json; charset=utf-8"));
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));



$response = curl_exec($ch);
$response_header = curl_getinfo($ch);
echo $response_header["http_code"]."\n";
print_r(json_decode($response, true));
curl_close($ch);
?>

실행 예

$ php sendsms.php
200
Array
(
    [filtered] => Array
        (
        )
    [reserved] =>
    [sent] => Array
        (
            [0] => Array
                (
                    [0] => 01000000000
                    [1] => 201408010307369291320
                )
        )
)

result.php - 발송 확인 예제, sendsms.php 의 결과로 받은 발송ID를 인자로 주어야 함

<?php
include "conf.php";

if ($argc != 2) {
	error_log("Usage:\n  ".$argv[0]." delivery-id");
	exit(1);
}
$delivery_id = $argv[1];

$ch = curl_init("https://api.bluehouselab.com/smscenter/v1.0/result/".$delivery_id);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_USERPWD, "$APPID:$APIKEY");

$response = curl_exec($ch);
$response_header = curl_getinfo($ch);
echo $response_header["http_code"]."\n";
print_r(json_decode($response, true));
curl_close($ch);
?>

실행 예

$ php result.php 201408010307369291320
200
Array
(
    [status] => 0
    [destination] => 01000000000
    [sent_time] => 2014-07-31T18:07:38Z
)

Javascript (Node.js)

sendsms.js - sms 발송

var c = require('./conf');
var https = require("https");
var credential = 'Basic '+new Buffer(c.APPID+':'+c.APIKEY).toString('base64');


var data = {
  "sender"     : c.SENDER,
  "receivers"  : c.RECEIVERS,
  "content"    : c.CONTENT
}
var body = JSON.stringify(data);

var options = {
  host: 'api.bluehouselab.com',
  port: 443,
  path: '/smscenter/v1.0/sendsms',
  headers: {
    'Authorization': credential,
    'Content-Type': 'application/json; charset=utf-8',
    'Content-Length': Buffer.byteLength(body)
  },
  method: 'POST'
};
var req = https.request(options, function(res) {
  console.log(res.statusCode);
  var body = "";
  res.on('data', function(d) {
    body += d;
  });
  res.on('end', function(d) {
  	if(res.statusCode==200)
		console.log(JSON.parse(body));
	else
		console.log(body);
  });
});
req.write(body);
req.end();
req.on('error', function(e) {
	console.error(e);
});

실행 예

$ node sendsms.js
200
{ filtered: [],
  reserved: null,
  sent: [ [ '01000000000', '201408021612156351310' ] ] }

result.js - 발송 확인 예제, sendsms.js 의 결과로 받은 발송ID를 인자로 주어야 함

var c = require('./conf');
var https = require("https");
var credential = 'Basic '+new Buffer(c.APPID+':'+c.APIKEY).toString('base64');
if(process.argv.length != 3) {
	console.log('Usage: ');
	console.log(' node result.js delivery-id');
	process.exit(1);
}
var deliveryid = process.argv[2];

var options = {
  host: 'api.bluehouselab.com',
  port: 443,
  path: '/smscenter/v1.0/result/'+deliveryid,
  headers: {
    'Authorization': credential,
  },
  method: 'GET'
};
var req = https.request(options, function(res) {
  console.log(res.statusCode);
  var body = "";
  res.on('data', function(d) {
    body += d;
  });
  res.on('end', function(d) {
  	if(res.statusCode==200)
		console.log(JSON.parse(body));
	else
		console.log(body);
  });
});
req.end();
req.on('error', function(e) {
	console.error(e);
});

실행 예

$ node result.js 201408021612156351310
200
{ status: '10001',
  destination: '01000000000',
  sent_time: '2014-08-01T18:14:35Z' }

Java (Android)

Java 예제는 Apache 프로젝트의 Http Component 를 사용하여 작성 하였 습니다. Mac, Linux, Win32 등의 일반적인 Java 개발 환경 뿐만 아니라, Apache Http Component가 기본 탑재 되어 있는 Android (API level 1) 에도 적용 가능한 샘플 입니다.

빌드 (Linux/Mac/Win32) - GNU make 명령을 이용하여 Java 코드들을 컴파일 합니다. Makefile 을 참고 하세요.

$ make

Sendsms.java - sms 발송

import org.apache.http.client.protocol.HttpClientContext;



/* XXX didn't use org.json to be simple
import org.json.JSONObject; 
*/

public final class SendSMS {
    public static void main(String[] args) {
        String hostname = "api.bluehouselab.com";
        String url = "https://"+hostname+"/smscenter/v1.0/sendsms";

        CredentialsProvider credsProvider = new BasicCredentialsProvider();
        credsProvider.setCredentials(
            new AuthScope(hostname, 443, AuthScope.ANY_REALM),
            new UsernamePasswordCredentials(Config.appid, Config.apikey)
        );

        // Create AuthCache instance
        AuthCache authCache = new BasicAuthCache();
        authCache.put(new HttpHost(hostname, 443, "https"), new BasicScheme());

        // Add AuthCache to the execution context
        HttpClientContext context = HttpClientContext.create();
        context.setCredentialsProvider(credsProvider);
        context.setAuthCache(authCache);

        DefaultHttpClient client = new DefaultHttpClient();

        try {
            HttpPost httpPost = new HttpPost(url);
            httpPost.setHeader("Content-type", "application/json; charset=utf-8");
            String json = "{\"sender\":\""+Config.sender+"\",\"receivers\":[\""+Config.receiver+"\"],\"content\":\""+Config.content+"\"}";

            StringEntity se = new StringEntity(json, "UTF-8");
            httpPost.setEntity(se);

            HttpResponse httpResponse = client.execute(httpPost, context);
            System.out.println(httpResponse.getStatusLine().getStatusCode());

            InputStream inputStream = httpResponse.getEntity().getContent();
            if(inputStream != null) {
                BufferedReader bufferedReader = new BufferedReader( new InputStreamReader(inputStream));
                String line = "";
                while((line = bufferedReader.readLine()) != null)
                    System.out.println(line);
                inputStream.close();
            }
        } catch (Exception e) {
            System.err.println("Error: "+e.getLocalizedMessage());
        } finally {
            client.getConnectionManager().shutdown();
        }

    }
}

실행 예

$ ./sendsms # bash shell script to execute java with require params
200
{"filtered": [], "reserved": null, "sent": [["01000000000", "201408030412368846800"]]}

Result.java - 발송 확인 예제, SendSMS.java 의 결과로 받은 발송ID를 인자로 주어야 함

import org.apache.http.client.AuthCache;
import org.apache.http.HttpHost;
import org.apache.http.client.protocol.HttpClientContext;


public final class Result {
    public static void main(String[] args) {
        if(args.length != 1) {
            System.err.println("Usage:");
            System.err.println("  ./result delivery-id");
            return;
        }
        String hostname = "api.bluehouselab.com";
        String url = "https://"+hostname+"/smscenter/v1.0/result/"+args[0];

        CredentialsProvider credsProvider = new BasicCredentialsProvider();
        credsProvider.setCredentials(
            new AuthScope(hostname, 443, AuthScope.ANY_REALM),
            new UsernamePasswordCredentials(Config.appid, Config.apikey)
        );

        // Create AuthCache instance
        AuthCache authCache = new BasicAuthCache();
        authCache.put(new HttpHost(hostname, 443, "https"), new BasicScheme());

        // Add AuthCache to the execution context
        HttpClientContext context = HttpClientContext.create();
        context.setCredentialsProvider(credsProvider);
        context.setAuthCache(authCache);

        DefaultHttpClient client = new DefaultHttpClient();

        try {
            HttpGet httpGet = new HttpGet(url);

            HttpResponse httpResponse = client.execute(httpGet, context);
            System.out.println(httpResponse.getStatusLine().getStatusCode());

            InputStream inputStream = httpResponse.getEntity().getContent();
            if(inputStream != null) {
                BufferedReader bufferedReader = new BufferedReader( new InputStreamReader(inputStream));
                String line = "";
                while((line = bufferedReader.readLine()) != null)
                    System.out.println(line);
                inputStream.close();
            }
        } catch (Exception e) {
            System.err.println("Error: "+e.getLocalizedMessage());
        } finally {
            client.getConnectionManager().shutdown();
        }

    }
}

실행 예

$ ./result 201408030412368846800 # bash shell script to execute java
200
{"status": 0, "destination": "01000000000", "sent_time": "2014-08-02T19:12:35Z"}

C (libcurl)

C 예제는 libcurl 라이브러리를 HTTP Client 로 사용하였습니다. libcurl은 Linux/BSD/Win32 환경에서 가장 많이 사용되는 통신 모듈 중 하나로 이식성이 우수 하며 여러 프로젝트에서 사용되어 안정성 및 그 우수성을 인정 받고 있는 오픈 소스 라이브러리 입니다.

빌드 (Linux/Mac/Win32) - GNU make 및 pkg-config 명령을 이용하여 빌드 합니다. Win32 환경에서는 cygwin 또는 msys 환경에서 쉽게 빌드 하실 수 있습니다.

$ make
cc -Wall -O2 -o sendsms.o -c sendsms.c `pkg-config --cflags libcurl`
cc -o sendsms sendsms.o `pkg-config --libs libcurl`
cc -Wall -O2 -o result.o -c result.c `pkg-config --cflags libcurl`
cc -o result result.o `pkg-config --libs libcurl`

sendsms.c - sms 발송

int main(void)
{
  CURL *handle;
  CURLcode res;
  char post_body[BUFSIZ] = {0, };
  char responsebuf[BUFSIZ] = {0, };
 
  curl_global_init(CURL_GLOBAL_DEFAULT);
 
  handle = curl_easy_init();
  if(handle) {
    curl_easy_setopt(handle, CURLOPT_URL, "https://api.bluehouselab.com/smscenter/v1.0/sendsms");
    curl_easy_setopt(handle, CURLOPT_USERNAME, APPID);
    curl_easy_setopt(handle, CURLOPT_PASSWORD, APIKEY);

    curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, write_callback);
    curl_easy_setopt(handle, CURLOPT_WRITEDATA, responsebuf);



    sprintf(post_body, "{\"sender\":\"%s\",\"receivers\":[\"%s\"],\"content\":\"%s\"}", SENDER, RECEIVER, CONTENT);
    curl_easy_setopt(handle, CURLOPT_POST, 1); 
    curl_easy_setopt(handle, CURLOPT_POSTFIELDS, post_body); 
    curl_easy_setopt(handle, CURLOPT_POSTFIELDSIZE, strlen(post_body));
 
    res = curl_easy_perform(handle);
    if(res != CURLE_OK)
      fprintf(stderr, "curl_easy_perform() failed: %s\n",
              curl_easy_strerror(res));
    else {
        long status_code = 0;
        curl_easy_getinfo (handle, CURLINFO_RESPONSE_CODE, &status_code);
        printf("%ld\n", status_code);
        printf("%s\n", responsebuf);

    }
 
    curl_easy_cleanup(handle);
  }
 
  curl_global_cleanup();
 
  return 0;
}

실행 예

$ ./sendsms
200
{"filtered": [], "reserved": null, "sent": [["01000000000", "201408030412368846800"]]}

result.c - 발송 확인 예제, sendsms.c 의 결과로 받은 발송ID를 인자로 주어야 함

int main(int argc, char** argv)
{
  CURL *handle;
  CURLcode res;
  char responsebuf[BUFSIZ] = {0, };
  char url[BUFSIZ] = {0, };
  char *deliveryid = NULL;

  if(argc != 2) {
      fprintf(stderr, "Usage: \n");
      fprintf(stderr, "  %s delivery-id\n", argv[0]);
      return 1;
  }
  deliveryid = argv[1];
 
  curl_global_init(CURL_GLOBAL_DEFAULT);
 
  handle = curl_easy_init();
  if(handle) {
    sprintf(url,
            "https://api.bluehouselab.com/smscenter/v1.0/result/%s",
            deliveryid);
    curl_easy_setopt(handle, CURLOPT_URL, url);
    curl_easy_setopt(handle, CURLOPT_USERNAME, APPID);
    curl_easy_setopt(handle, CURLOPT_PASSWORD, APIKEY);

    curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, write_callback);
    curl_easy_setopt(handle, CURLOPT_WRITEDATA, responsebuf);


    res = curl_easy_perform(handle);
    if(res != CURLE_OK)
      fprintf(stderr, "curl_easy_perform() failed: %s\n",
              curl_easy_strerror(res));
    else {
        long status_code = 0;
        curl_easy_getinfo (handle, CURLINFO_RESPONSE_CODE, &status_code);
        printf("%ld\n", status_code);
        printf("%s\n", responsebuf);

    }
 
    curl_easy_cleanup(handle);
  }
 
  curl_global_cleanup();
 
  return 0;
}

실행 예

$ ./result 201408030412368846800
200
{"status": 0, "destination": "01000000000", "sent_time": "2014-08-02T19:12:35Z"}

C++ (Qt5)

C++ 예제는 Qt5 를 HTTP Client 로 사용하였습니다. Qt 는 오랜 기간 동안 오픈소스 소프트웨어 발전에 기여한 훌륭한 GUI 프레임워크 입니다. LGPL라이센스로 Linux(X11/Wayland), Mac(X11/Cocoa), Win32, iOS, Android, SailFish OS 환경에서 모두 사용 가능합니다. 이 예제는 GUI를 사용하지 않고 Console 환경에서 SMS를 발송 할수 있도록 심플하게 작성 되었습니다.

빌드 (Linux/Mac/Win32) - GNU make 및 Qt5의 qmake 명령을 이용하여 빌드 합니다.

$ make

sendsms.cpp - sms 발송

void SMSClient::sendSMS()
{
    QUrl url("https://api.bluehouselab.com/smscenter/v1.0/sendsms");
    QNetworkRequest request(url);
    request.setHeader(QNetworkRequest::ContentTypeHeader,
                        QVariant("application/json; charset=utf-8"));

    QJsonDocument json;
    QJsonObject obj;
    obj["sender"] = QString(SENDER);
    QJsonArray receivers;
    receivers.push_back(QString(RECEIVER));
    obj["receivers"] = receivers;
    obj["content"] = QString(CONTENT);
    json.setObject(obj);
    manager.post(request, json.toJson());
}

실행 예

$ ./sendsms
"{"filtered": [], "reserved": null, "sent": [["01000000000", "201408032346305478310"]]}"

result.cpp - 발송 확인 예제, sendsms.cpp 의 결과로 받은 발송ID를 인자로 주어야 함

void SMSClient::checkResult()
{
    QStringList args = QCoreApplication::instance()->arguments();
    QString program = args.takeFirst();
    if (args.isEmpty()) {
        qCritical() << "Usage";
        qCritical() << QString("  %1 delivery-id").arg(program);
        QCoreApplication::instance()->quit();
        return;
    }
    QString deliveryid = args.takeFirst();
    QUrl url(QString("https://api.bluehouselab.com/smscenter/v1.0/result/%1").arg(deliveryid));
    QNetworkRequest request(url);
    manager.get(request);
}

실행 예

$ ./result 201408032346305478310
200
"{"status": 0, "destination": "01000000000", "sent_time": "2014-08-03T14:46:29Z"}"

C# (Mono/.NET)

C# 예제는 System.Net.WebClient 를 사용하여 간단하게 작성 되었습니다. 또한 오픈소스 .NET 프레임워크인 Mono 환경에서 작성 및 테스트 되었습니다. Mono를 통해 Windows는 물론 Linux, Mac OS X 환경에서도 테스트 가능 합니다.

빌드 (Linux/Mac) - GNU make를 이용하여 빌드 합니다.

$ make

sendsms.cs - sms 발송

class SendSMS
{
    static void Main(string[] args)
    {
        string url = "https://api.bluehouselab.com/smscenter/v1.0/sendsms";
        string appid = "example";
        string apikey = "c5dd7e7dkjp27377l903c42c032b413b";

        string json = @"{
            ""sender"": ""01000000000"",
            ""receivers"": [""01000000000""],
            ""content"": ""나는 유리를 먹을 수 있어요. 그래도 아프지 않아요""}";

        WebClient client = new WebClient();
        NetworkCredential creds = new NetworkCredential(appid, apikey);
        client.Credentials = creds;
        client.Headers[HttpRequestHeader.ContentType] = "application/json; charset=utf-8";

        try
        {
            string response = client.UploadString(url, json);
            Console.WriteLine(response);
        }
        catch (WebException e)
        {
            HttpStatusCode status = ((HttpWebResponse)e.Response).StatusCode;
            Console.WriteLine("{0}", (int)status);
            Console.WriteLine("{0}", status.ToString());
        }
    }
}

실행 예 (Mac OS X)

$ mono sendsms.exe
{"filtered": [], "reserved": null, "sent": [["01000000000", "201409130128257158920"]]}

result.cs - 발송 확인 예제, sendsms.cs 의 결과로 받은 발송ID를 인자로 주어야 함

class Result
{
    static void Main(string[] args)
    {
        if(args.Length != 1)
        {
            Console.WriteLine("Usage:");
            Console.WriteLine("  result.exe deliveryid");
            return;
        }
        string url = "https://api.bluehouselab.com/smscenter/v1.0/result/"+args[0];
        string appid = "example";
        string apikey = "c5dd7e7dkjp27377l903c42c032b413b";

        WebClient client = new WebClient();
        NetworkCredential creds = new NetworkCredential(appid, apikey);
        client.Credentials = creds;

        try
        {
            byte[] response = client.DownloadData(url);
            Console.WriteLine(Encoding.UTF8.GetString(response));
        }
        catch (WebException e)
        {
            HttpStatusCode status = ((HttpWebResponse)e.Response).StatusCode;
            Console.WriteLine("{0}", (int)status);
            Console.WriteLine("{0}", status.ToString());
        }
    }
}

실행 예 (Mac OS X)

$ mono result.exe 201409130128257158920
{"status": "10001", "destination": "01000000000", "sent_time": "2014-09-12t16:28:25z"}