cURL JAVA Go PHP NodeJS C# JavaScript python Ruby
Copy curl -X POST https://omni.ibapi.kr/v1/send/alimtalk \
-H "content-type: application/json" \
-H "Accept: application/json" \
-H "Authorization:Bearer 발급받은 토큰" \
-d '{"templateCode":"알림톡 템플릿 코드", "msgType":"AT", "text":"알림톡 메시지 내용", "senderKey":"카카오 비즈메시지 발신프로필키", "to":"수신번호", "ref":"참조필드"}'
Copy 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, "{\"senderKey\": \"발신 프로필키\", \"msgType\": \"알림톡 메시지 타입(AT/AI)\", \"to\": \"수신번호\", \"templateCode\": \"알림톡 템플릿코드\", \"text\": \"알림톡 메시지 내용\", \"ref\": \"참조필드\"}");
Request request = new Request . Builder ()
. url ( "https://omni.ibapi.kr/v1/send/alimtalk" )
. 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 ());
}
}
Copy package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main () {
url := "https://omni.ibapi.kr/v1/send/alimtalk"
method := "POST"
payload := strings.NewReader(`{"senderKey": "발신 프로필키", "msgType": "알림톡 메시지 타입(AT/AI)", "to": "수신번호", "templateCode": "알림톡 템플릿코드", "text": "알림톡 메시지 내용", "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))
}
Copy <? php
$curl = curl_init () ;
curl_setopt_array ( $curl , array(
CURLOPT_URL => 'https://omni.ibapi.kr/v1/send/alimtalk' ,
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 =>'{"senderKey": "발신 프로필키", "msgType": "알림톡 메시지 타입(AT/AI)", "to": "수신번호", "templateCode": "알림톡 템플릿코드", "text": "알림톡 메시지 내용", "ref": "참조필드"}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json' ,
'Accept: application/json' ,
'Authorization: Bearer 발급받은 토큰'
) ,
) ) ;
$response = curl_exec ( $curl ) ;
curl_close ( $curl ) ;
echo $response;
Copy var request = require ( 'request' );
var options = {
'method' : 'POST' ,
'url' : 'https://omni.ibapi.kr/v1/send/alimtalk' ,
'headers' : {
'Content-Type' : 'application/json' ,
'Accept' : 'application/json' ,
'Authorization' : 'Bearer 발급받은 토큰'
} ,
body : JSON .stringify ({
"senderKey" : "발신 프로필키" ,
"msgType" : "알림톡 메시지 타입(AT/AI)" ,
"to" : "수신번호" ,
"templateCode" : "알림톡 템플릿코드" ,
"text" : "알림톡 메시지 내용" ,
"ref" : "참조필드"
})
};
request (options , function (error , response) {
if (error) throw new Error (error);
console .log ( response .body);
});
Copy var client = new HttpClient ();
var request = new HttpRequestMessage ( HttpMethod . Post , "https://omni.ibapi.kr/v1/send/alimtalk" );
request . Headers . Add ( "Accept" , "application/json" );
request . Headers . Add ( "Authorization" , "Bearer 발급받은 토큰" );
var content = new StringContent("{\"senderKey\": \"발신 프로필키\", \"msgType\": \"알림톡 메시지 타입(AT/AI)\", \"to\": \"수신번호\", \"templateCode\": \"알림톡 템플릿코드\", \"text\": \"알림톡 메시지 내용\", \"ref\": \"참조필드\"}", null, "application/json");
request . Content = content;
var response = await client . SendAsync (request);
response . EnsureSuccessStatusCode ();
Console . WriteLine ( await response . Content . ReadAsStringAsync ());
Copy var myHeaders = new Headers ();
myHeaders .append ( "Content-Type" , "application/json" );
myHeaders .append ( "Accept" , "application/json" );
myHeaders .append ( "Authorization" , "Bearer 발급받은 토큰" );
var raw = JSON .stringify ({
"senderKey" : "발신 프로필키" ,
"msgType" : "알림톡 메시지 타입(AT/AI)" ,
"to" : "수신번호" ,
"templateCode" : "알림톡 템플릿코드" ,
"text" : "알림톡 메시지 내용" ,
"ref" : "참조필드"
});
var requestOptions = {
method : 'POST' ,
headers : myHeaders ,
body : raw ,
redirect : 'follow'
};
fetch ( "https://omni.ibapi.kr/v1/send/alimtalk" , requestOptions)
.then (response => response .text ())
.then (result => console .log (result))
.catch (error => console .log ( 'error' , error));
Copy import http . client
import json
conn = http . client . HTTPSConnection ( "omni.ibapi.kr" )
payload = json . dumps ({
"senderKey" : "발신 프로필키" ,
"msgType" : "알림톡 메시지 타입(AT/AI)" ,
"to" : "수신번호" ,
"templateCode" : "알림톡 템플릿코드" ,
"text" : "알림톡 메시지 내용" ,
"ref" : "참조필드"
})
headers = {
'Content-Type' : 'application/json' ,
'Accept' : 'application/json' ,
'Authorization' : 'Bearer 발급받은 토큰'
}
conn . request ( "POST" , "/v1/send/alimtalk" , payload, headers)
res = conn . getresponse ()
data = res . read ()
print (data. decode ( "utf-8" ))
Copy require "uri"
require "json"
require "net/http"
url = URI ( "https://omni.ibapi.kr/v1/send/alimtalk" )
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({
"senderKey" : "발신 프로필키" ,
"msgType" : "알림톡 메시지 타입(AT/AI)" ,
"to" : "수신번호" ,
"templateCode" : "알림톡 템플릿코드" ,
"text" : "알림톡 메시지 내용" ,
"ref" : "참조필드"
})
response = https . request(request)
puts response . read_body
cURL JAVA Go PHP NodeJS C# JavaScript python Ruby
Copy curl -X POST https://omni.ibapi.kr/v1/send/friendtalk \
-H "content-type: application/json" \
-H "Accept: application/json" \
-H "Authorization:Bearer 발급받은 토큰" \
-d '{"msgType":"FT", "text":"친구톡 메시지 내용", "senderKey":"카카오 비즈메시지 발신프로필키", "to":"수신번호", "ref":"참조필드"}'
Copy 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, "{\"senderKey\": \"발신 프로필키\", \"msgType\": \"친구톡 메시지 타입(FT/FI/FW)\", \"to\": \"수신번호\", \"text\": \"친구톡 메시지 내용\",\"ref\": \"참조필드\"}");
Request request = new Request . Builder ()
. url ( "https://omni.ibapi.kr/v1/send/friendtalk" )
. 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 ());
}
}
Copy package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main () {
url := "https://omni.ibapi.kr/v1/send/friendtalk"
method := "POST"
payload := strings.NewReader(`{"senderKey": "발신 프로필키", "msgType": "친구톡 메시지 타입(FT/FI/FW)", "to": "수신번호", "text": "친구톡 메시지 내용","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))
}
Copy <? php
$curl = curl_init () ;
curl_setopt_array ( $curl , array(
CURLOPT_URL => 'https://omni.ibapi.kr/v1/send/friendtalk' ,
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 =>'{"senderKey": "발신 프로필키", "msgType": "친구톡 메시지 타입(FT/FI/FW)", "to": "수신번호", "text": "친구톡 메시지 내용","ref": "참조필드"}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json' ,
'Accept: application/json' ,
'Authorization: Bearer 발급받은 토큰'
) ,
) ) ;
$response = curl_exec ( $curl ) ;
curl_close ( $curl ) ;
echo $response;
Copy var request = require ( 'request' );
var options = {
'method' : 'POST' ,
'url' : 'https://omni.ibapi.kr/v1/send/friendtalk' ,
'headers' : {
'Content-Type' : 'application/json' ,
'Accept' : 'application/json' ,
'Authorization' : 'Bearer 발급받은 토큰'
} ,
body : JSON .stringify ({
"senderKey" : "발신 프로필키" ,
"msgType" : "친구톡 메시지 타입(FT/FI/FW)" ,
"to" : "수신번호" ,
"text" : "친구톡 메시지 내용" ,
"ref" : "참조필드"
})
};
request (options , function (error , response) {
if (error) throw new Error (error);
console .log ( response .body);
});
Copy var client = new HttpClient ();
var request = new HttpRequestMessage ( HttpMethod . Post , "https://omni.ibapi.kr/v1/send/friendtalk" );
request . Headers . Add ( "Accept" , "application/json" );
request . Headers . Add ( "Authorization" , "Bearer 발급받은 토큰" );
var content = new StringContent("{\"senderKey\": \"발신 프로필키\", \"msgType\": \"친구톡 메시지 타입(FT/FI/FW)\", \"to\": \"수신번호\", \"text\": \"친구톡 메시지 내용\",\"ref\": \"참조필드\"}", null, "application/json");
request . Content = content;
var response = await client . SendAsync (request);
response . EnsureSuccessStatusCode ();
Console . WriteLine ( await response . Content . ReadAsStringAsync ());
Copy var myHeaders = new Headers ();
myHeaders .append ( "Content-Type" , "application/json" );
myHeaders .append ( "Accept" , "application/json" );
myHeaders .append ( "Authorization" , "Bearer 발급받은 토큰" );
var raw = JSON .stringify ({
"senderKey" : "발신 프로필키" ,
"msgType" : "친구톡 메시지 타입(FT/FI/FW)" ,
"to" : "수신번호" ,
"text" : "친구톡 메시지 내용" ,
"ref" : "참조필드"
});
var requestOptions = {
method : 'POST' ,
headers : myHeaders ,
body : raw ,
redirect : 'follow'
};
fetch ( "https://omni.ibapi.kr/v1/send/friendtalk" , requestOptions)
.then (response => response .text ())
.then (result => console .log (result))
.catch (error => console .log ( 'error' , error));
Copy import http . client
import json
conn = http . client . HTTPSConnection ( "omni.ibapi.kr" )
payload = json . dumps ({
"senderKey" : "발신 프로필키" ,
"msgType" : "친구톡 메시지 타입(FT/FI/FW)" ,
"to" : "수신번호" ,
"text" : "친구톡 메시지 내용" ,
"ref" : "참조필드"
})
headers = {
'Content-Type' : 'application/json' ,
'Accept' : 'application/json' ,
'Authorization' : 'Bearer 발급받은 토큰'
}
conn . request ( "POST" , "/v1/send/friendtalk" , payload, headers)
res = conn . getresponse ()
data = res . read ()
print (data. decode ( "utf-8" ))
Copy require "uri"
require "json"
require "net/http"
url = URI ( "https://omni.ibapi.kr/v1/send/friendtalk" )
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({
"senderKey" : "발신 프로필키" ,
"msgType" : "친구톡 메시지 타입(FT/FI/FW)" ,
"to" : "수신번호" ,
"text" : "친구톡 메시지 내용" ,
"ref" : "참조필드"
})
response = https . request(request)
puts response . read_body