---
updatedAt: 2025-03-19T23:24:43.000Z
agentTools:
  projectIndex: https://sdk.sendon.io/llms.txt
---

# [SDK] 카카오 대체문자 이미지 업로드

```javascript JavaScript
import { Sendon } from '@alipeople/sendon-sdk-typescript'
import fs from 'fs'

const sendon = new Sendon({
  id: 'SENDON_ID',
  apikey: 'SENDON_APIKEY',
  debug: false,
})

async function example() {
  const buffer = fs.readFileSync('./images/sample.jpg')
  const file = new File([buffer], 'sample.jpg', { type: 'image/jpeg' })
  const result = await sendon.kakao.uploadFallbackImage([file])

  console.log(`Response: ${JSON.stringify(result, null, 2)}`)
}

example()
```

```json Response Example
{
  "code": 200,
  "message": "성공",
  "data": {
    "imageIds": [
      "IMAGE_ID_1",
    ]
  }
}
```

# Sendon 인스턴스 생성

<!-- javascript@3-7 -->

- SDK를 초기화하고 인증 정보(ID, API Key)를 설정합니다.
- 개발 환경에서는 debug 옵션을 활성화하여 로깅을 확인할 수 있습니다.

# 카카오 대체 발송 이미지 업로드 요청

<!-- javascript@10-12 -->

- 로컬 파일 시스템에서 이미지를 읽어와 File 객체로 변환합니다
- 알림톡/친구톡 발송 실패시 사용할 대체 발송용 이미지를 업로드합니다
- 최대 3장까지 한 번에 업로드가 가능합니다
- 배열 형태로 여러 이미지를 전달할 수 있습니다
- 업로드된 이미지는 MMS 대체발송 시 사용할 수 있는 imageIds 값으로 반환됩니다
- 대체발송 설정 시 fallback 옵션의 custom.images 속성에 이 imageIds를 사용합니다