upload-kakao-brand-message-image
curl --request POST \
--url https://api.notifly.tech/v1/projects/{projectId}/messages/kakao-brand-message/images \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form file='@example-file' \
--form 'images=<string>' \
--form images.items='@example-file'import requests
url = "https://api.notifly.tech/v1/projects/{projectId}/messages/kakao-brand-message/images"
files = {
"file": ("example-file", open("example-file", "rb")),
"images.items": ("example-file", open("example-file", "rb"))
}
payload = { "images": "<string>" }
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<string>');
form.append('images', '<string>');
form.append('images.items', '{
"fileName": "example-file"
}');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.notifly.tech/v1/projects/{projectId}/messages/kakao-brand-message/images', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.notifly.tech/v1/projects/{projectId}/messages/kakao-brand-message/images",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"images\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"images.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.notifly.tech/v1/projects/{projectId}/messages/kakao-brand-message/images"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"images\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"images.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.notifly.tech/v1/projects/{projectId}/messages/kakao-brand-message/images")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"images\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"images.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.notifly.tech/v1/projects/{projectId}/messages/kakao-brand-message/images")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"images\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"images.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"data": {
"images": [
{
"url": "https://mud-kage.kakao.com/example/img_l.jpg"
}
]
},
"error": null
}{
"data": null,
"error": {
"code": "UNAUTHORIZED",
"message": "Invalid Authorization Token"
}
}{
"data": null,
"error": {
"code": "UNAUTHORIZED",
"message": "Invalid Authorization Token"
}
}{
"data": null,
"error": {
"code": "UNAUTHORIZED",
"message": "Invalid Authorization Token"
}
}카카오 브랜드 메시지 템플릿
브랜드 메시지 이미지 업로드
카카오 브랜드 메시지 템플릿에 사용할 이미지를 업로드합니다.
POST
/
v1
/
projects
/
{projectId}
/
messages
/
kakao-brand-message
/
images
upload-kakao-brand-message-image
curl --request POST \
--url https://api.notifly.tech/v1/projects/{projectId}/messages/kakao-brand-message/images \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form file='@example-file' \
--form 'images=<string>' \
--form images.items='@example-file'import requests
url = "https://api.notifly.tech/v1/projects/{projectId}/messages/kakao-brand-message/images"
files = {
"file": ("example-file", open("example-file", "rb")),
"images.items": ("example-file", open("example-file", "rb"))
}
payload = { "images": "<string>" }
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<string>');
form.append('images', '<string>');
form.append('images.items', '{
"fileName": "example-file"
}');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.notifly.tech/v1/projects/{projectId}/messages/kakao-brand-message/images', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.notifly.tech/v1/projects/{projectId}/messages/kakao-brand-message/images",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"images\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"images.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.notifly.tech/v1/projects/{projectId}/messages/kakao-brand-message/images"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"images\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"images.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.notifly.tech/v1/projects/{projectId}/messages/kakao-brand-message/images")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"images\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"images.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.notifly.tech/v1/projects/{projectId}/messages/kakao-brand-message/images")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"images\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"images.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"data": {
"images": [
{
"url": "https://mud-kage.kakao.com/example/img_l.jpg"
}
]
},
"error": null
}{
"data": null,
"error": {
"code": "UNAUTHORIZED",
"message": "Invalid Authorization Token"
}
}{
"data": null,
"error": {
"code": "UNAUTHORIZED",
"message": "Invalid Authorization Token"
}
}{
"data": null,
"error": {
"code": "UNAUTHORIZED",
"message": "Invalid Authorization Token"
}
}브랜드 메시지 템플릿 생성에 사용할 이미지를 카카오 비즈메시지에 먼저 업로드합니다. 응답의
data.images[].url 값을 템플릿 생성 요청의 이미지 필드에 넣어 사용합니다.이미지 유형마다 권장 크기와 허용 비율이 다릅니다.
지원 파일 형식은 JPG, PNG이며 파일당 최대 용량은 5MB입니다.
type | 용도 | 권장 크기 및 비율 |
|---|---|---|
image | 이미지형 및 커머스형 | 800 × 400px 권장, 가로 500px 이상, 3:4~2:1 |
wide-image | 와이드 이미지형 | 800 × 600px 권장, 가로 500px 이상, 1:1~2:1 |
wide-itemlist-first-image | 와이드 아이템리스트형 대표 이미지 | 가로 500px 이상, 2:1 |
wide-itemlist-image | 와이드 아이템리스트형 서브 이미지 | 가로 500px 이상, 1:1 |
carousel-image | 캐러셀 피드형 | 800 × 600px 또는 800 × 400px 권장, 가로 500px 이상, 3:4~2:1 |
carousel-commerce-image | 캐러셀 커머스형 | 800 × 600px 또는 800 × 400px 권장, 가로 500px 이상, 3:4~2:1. 모든 이미지의 비율을 동일하게 맞춰야 합니다. |
인증
POST /authenticate로 발급받은 인증 토큰을 Bearer 형식으로 전달합니다.
경로 매개변수
프로젝트 ID
본문
multipart/form-data
업로드 이미지 용도입니다. file은 단건 이미지 유형, images는 반복 multipart 필드가 필요한 다중 이미지 유형에 사용합니다.
사용 가능한 옵션:
image, wide-image, wide-itemlist-first-image, wide-itemlist-image, carousel-image, carousel-commerce-image image, wide-image, wide-itemlist-first-image 유형에서 사용하는 단건 이미지 파일입니다.
wide-itemlist-image, carousel-image, carousel-commerce-image 유형에서 사용하는 반복 이미지 파일 필드입니다.
⌘I
