문자
국내 문자(SMS, LMS, MMS) 메시지 발송 규격입니다.
SMS 최대 90byte, MMS 최대 2,000byte(제목 20byte) 까지 전송 가능 합니다.
MMS 이미지 메시지를 전송할 경우 사전에 이미지 파일 등록이 필요 합니다.
상세 Response 내용은 코드표를 참조해주시기 바랍니다.
EUC-KR에 없는 문자는 빈 값(' ') 또는 깨져서 전송 될 수 있습니다.
SMS 전송
curl -X POST https://omni.ibapi.kr/v1/send/sms \
-H "content-type: application/json" \
-H "Accept: application/json" \
-H "Authorization:Bearer 발급받은 토큰" \
-d '{"from":"발신번호","text":"메시지 내용", "to":"수신번호", "ref":"참조필드"}'
import java.io.*;
import okhttp3.*;
public class Main {
public static void main(String []args) throws IOException{
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"from\":\"발신번호\",\"text\":\"메시지 내용\", \"to\":\"수신번호\", \"ref\":\"참조필드\"}");
Request request = new Request.Builder()
.url("https://omni.ibapi.kr/v1/send/sms")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer 발급받은 토큰")
.build();
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
}
}
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://omni.ibapi.kr/v1/send/sms"
method := "POST"
payload := strings.NewReader(`{"from":"발신번호","text":"메시지 내용", "to":"수신번호", "ref":"참조필드"}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Accept", "application/json")
req.Header.Add("Authorization", "Bearer 발급받은 토큰")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://omni.ibapi.kr/v1/send/sms',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{"from":"발신번호","text":"메시지 내용", "to":"수신번호", "ref":"참조필드"}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Accept: application/json',
'Authorization: Bearer 발급받은 토큰'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://omni.ibapi.kr/v1/send/sms',
'headers': {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer 발급받은 토큰'
},
body: JSON.stringify({
"from": "발신번호",
"text": "메시지 내용",
"to": "수신번호",
"ref": "참조필드"
})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://omni.ibapi.kr/v1/send/sms");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", "Bearer 발급받은 토큰");
var content = new StringContent("{\"from\":\"발신번호\",\"text\":\"메시지 내용\", \"to\":\"수신번호\", \"ref\":\"참조필드\"}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Accept", "application/json");
myHeaders.append("Authorization", "Bearer 발급받은 토큰");
var raw = JSON.stringify({
"from": "발신번호",
"text": "메시지 내용",
"to": "수신번호",
"ref": "참조필드"
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://omni.ibapi.kr/v1/send/sms", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
import http.client
import json
conn = http.client.HTTPSConnection("omni.ibapi.kr")
payload = json.dumps({
"from": "발신번호",
"text": "메시지 내용",
"to": "수신번호",
"ref": "참조필드"
})
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer 발급받은 토큰'
}
conn.request("POST", "/v1/send/sms", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require "uri"
require "json"
require "net/http"
url = URI("https://omni.ibapi.kr/v1/send/sms")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Accept"] = "application/json"
request["Authorization"] = "Bearer 발급받은 토큰"
request.body = JSON.dump({
"from": "발신번호",
"text": "메시지 내용",
"to": "수신번호",
"ref": "참조필드"
})
response = https.request(request)
puts response.read_body
Request
Header
Name | Type | Description |
---|---|---|
Authorization | String | schema + “ “ + token |
Content-Type | String | application/json |
Accept | String | application/json |
Body
Name | Type | Required | Description |
---|---|---|---|
from | String | YES | 발신번호 |
to | String | YES | 수신번호 |
text | String(90) | YES | 메시지 내용 |
ref | String(200) | NO | 참조필드 |
originCID | String(9) | NO | 최초 발신사업자 식별코드 |
Response
Header
Name | Type | Description |
---|---|---|
Content-Type | String | application/json |
Body
Name | Type | Description |
---|---|---|
code | String(4) | API호출 결과 코드 |
result | String | API호출 결과 설명 |
msgKey | String | 메시지 키 |
ref | String(200) | 참조필드(요청 시 입력한 데이터) |
MMS 전송
curl -X POST https://omni.ibapi.kr/v1/send/mms \
-H "content-type: application/json" \
-H "Accept: application/json" \
-H "Authorization:Bearer 발급받은 토큰" \
-d '{"from":"발신번호", "title":"메시지제목", "text":"메시지 내용", "fileKey":["파일키1"], "to":"수신번호", "ref":"참조필드"}'
import java.io.*;
import okhttp3.*;
public class Main {
public static void main(String []args) throws IOException{
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"from\":\"발신번호\", \"title\":\"메시지제목\", \"text\":\"메시지 내용\", \"fileKey\":[\"파일키1\"], \"to\":\"수신번호\", \"ref\":\"참조필드\"}");
Request request = new Request.Builder()
.url("https://omni.ibapi.kr/v1/send/mms")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer 발급받은 토큰")
.build();
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
}
}
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://omni.ibapi.kr/v1/send/mms"
method := "POST"
payload := strings.NewReader(`{"from":"발신번호", "title":"메시지제목", "text":"메시지 내용", "fileKey":["파일키1"], "to":"수신번호", "ref":"참조필드"}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Accept", "application/json")
req.Header.Add("Authorization", "Bearer 발급받은 토큰")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://omni.ibapi.kr/v1/send/mms',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{"from":"발신번호", "title":"메시지제목", "text":"메시지 내용", "fileKey":["파일키1"], "to":"수신번호", "ref":"참조필드"}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Accept: application/json',
'Authorization: Bearer 발급받은 토큰'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://omni.ibapi.kr/v1/send/mms',
'headers': {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer 발급받은 토큰'
},
body: JSON.stringify({
"from": "발신번호",
"title": "메시지제목",
"text": "메시지 내용",
"fileKey": [
"파일키1"
],
"to": "수신번호",
"ref": "참조필드"
})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://omni.ibapi.kr/v1/send/mms");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", "Bearer 발급받은 토큰");
var content = new StringContent("{\"from\":\"발신번호\", \"title\":\"메시지제목\", \"text\":\"메시지 내용\", \"fileKey\":[\"파일키1\"], \"to\":\"수신번호\", \"ref\":\"참조필드\"}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Accept", "application/json");
myHeaders.append("Authorization", "Bearer 발급받은 토큰");
var raw = JSON.stringify({
"from": "발신번호",
"title": "메시지제목",
"text": "메시지 내용",
"fileKey": [
"파일키1"
],
"to": "수신번호",
"ref": "참조필드"
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://omni.ibapi.kr/v1/send/mms", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
import http.client
import json
conn = http.client.HTTPSConnection("omni.ibapi.kr")
payload = json.dumps({
"from": "발신번호",
"title": "메시지제목",
"text": "메시지 내용",
"fileKey": [
"파일키1"
],
"to": "수신번호",
"ref": "참조필드"
})
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer 발급받은 토큰'
}
conn.request("POST", "/v1/send/mms", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require "uri"
require "json"
require "net/http"
url = URI("https://omni.ibapi.kr/v1/send/mms")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Accept"] = "application/json"
request["Authorization"] = "Bearer 발급받은 토큰"
request.body = JSON.dump({
"from": "발신번호",
"title": "메시지제목",
"text": "메시지 내용",
"fileKey": [
"파일키1"
],
"to": "수신번호",
"ref": "참조필드"
})
response = https.request(request)
puts response.read_body
Request
Header
Name | Type | Description |
---|---|---|
Authorization | String | schema + “ “ + token |
Content-Type | String | application/json |
Accept | String | application/json |
Body
Name | Type | Required | Description |
---|---|---|---|
from | String | YES | 발신번호 |
to | String | YES | 수신번호 |
text | String(2000) | YES | 메시지 내용(2000byte) |
title | String(40) | NO | 메시지 제목(40byte) |
fileKey | String Array | NO | 파일 키(최대 3개) |
ref | String(200) | NO | 참조필드 |
originCID | String(9) | NO | 최초 발신사업자 식별코드 |
Response
Header
Name | Type | Description |
---|---|---|
Content-Type | String | application/json |
Body
Name | Type | Description |
---|---|---|
code | String(4) | API호출 결과 코드 |
result | String | API호출 결과 설명 |
msgKey | String | 메시지 키 |
ref | String(200) | 참조필드(요청 시 입력한 데이터) |