# 알림톡 템플릿

## 1. GetATSTemplateMgtURL - 알림톡 템플릿 등록 팝업 URL

| HTTP Method | 테스트(Sandbox)                                   | 운영(Production)                            |
| ----------- | ---------------------------------------------- | ----------------------------------------- |
| GET         | <https://popbill-test.linkhub.co.kr/KakaoTalk> | <https://popbill.linkhub.co.kr/KakaoTalk> |

![알림톡 템플릿 등록 팝업 URL 미리보기](https://developers.popbill.com/images/reference/kakaotalk/getATSTemplateMgtURL.png)

**알림톡 템플릿을 등록하는 팝업 URL을 반환합니다.**

- 권장 사이즈 : width = 1,200px (최소 1,000px) / height = 800px
- 반환되는 URL은 30초 동안만 사용이 가능합니다.
- 반환되는 URL에서만 유효한 세션을 포함하고 있습니다.

### Request

**요청 헤더**

- Authorization `required: Y` `description: 인증 토큰`
  - [\[참고\] 인증 및 헤더 설정](https://developers.popbill.com/api-reference/kakaotalk/getting-started/authorization)
- Accept-Language `required: N` `description: 응답 언어 설정`
  - `ko-KR`: 기본값
  - `en-US`
- Accept-Encoding `required: N` `description: 응답 압축 방식`
  - `gzip`
- X-PB-UserID `required: N` `description: 팝빌회원 아이디`

**Query 파라미터**

- TG `type: string` `length: -` `required: Y` `description: 고정값 : TEMPLATE`

**요청 예시**

```bash
curl --request GET \
  --url 'https://{domain}/KakaoTalk?TG=TEMPLATE' \
  --header 'Authorization: Bearer {token}'
```

### Response

**응답 본문**

- url `type: string` `length: -` `description: 알림톡 템플릿 등록 팝업 URL`

**응답 예시**

```json
{
    "url": "https://test.popbill.com/App/API?T=IRXSGITDREOTPOIRLPUHCB4BSBC4...NX7BMAR3="
}
```

## 2. GetATSTemplate - 알림톡 템플릿 정보 확인

| HTTP Method | 테스트(Sandbox)                                                                 | 운영(Production)                                                          |
| ----------- | ---------------------------------------------------------------------------- | ----------------------------------------------------------------------- |
| GET         | <https://popbill-test.linkhub.co.kr/KakaoTalk/GetATSTemplate/{templateCode}> | <https://popbill.linkhub.co.kr/KakaoTalk/GetATSTemplate/{templateCode}> |

- 알림톡 템플릿 정보를 확인합니다.

### Request

**요청 헤더**

- Authorization `required: Y` `description: 인증 토큰`
  - [\[참고\] 인증 및 헤더 설정](https://developers.popbill.com/api-reference/kakaotalk/getting-started/authorization)
- Accept-Language `required: N` `description: 응답 언어 설정`
  - `ko-KR`: 기본값
  - `en-US`
- Accept-Encoding `required: N` `description: 응답 압축 방식`
  - `gzip`
- X-PB-UserID `required: N` `description: 팝빌회원 아이디`

**Path 파라미터**

- templateCode `type: string` `length: 12` `required: Y` `description: 템플릿 코드`

**요청 예시**

```bash
curl --request GET \
  --url 'https://{domain}/KakaoTalk/GetATSTemplate/{templateCode}' \
  --header 'Authorization: Bearer {token}'
```

### Response

**응답 본문**

- templateCode `type: string` `length: 12` `description: 템플릿 코드`
- templateName `type: string` `length: 20` `description: 템플릿 제목`
- emphasizeTitle `type: string` `length: 50` `description: 강조표기 타이틀`
- emphasizeSubtitle `type: string` `length: 50` `description: 강조표기 보조 문구`
- template `type: string` `length: 1,300` `description: 템플릿 내용`
- plusFriendID `type: string` `length: 30` `description: 검색용 아이디`
- ads `type: string` `length: 80` `description: 광고 메시지`
- appendix `type: string` `length: 500` `description: 부가 메시지`
- secureYN `type: boolean` `length: -` `description: 보안템플릿 여부`
  - `true`: 보안템플릿
  - `false`: 일반템플릿
- state `type: string` `length: 1` `description: 템플릿 상태`
  - `0`: 임시저장
  - `2`: 심사중
  - `3`: 승인
  - `4`: 반려
  - `5`: 정지
  - `7`: 휴면
  - `8`: 삭제
- stateDT `type: string` `length: 14` `description: 템플릿 상태 일시`
  - 형식 : yyyyMMddHHmmss
- btns `type: array` `length: 5` `description: 버튼 목록`
  - n `type: string` `length: 14` `description: 버튼명`
  - t `type: string` `length: 2` `description: 버튼유형`
    - `WL`: 웹링크
    - `AL`: 앱링크
    - `TN`: 전화걸기
    - `DS`: 배송조회
    - `MD`: 메시지전달
    - `BK`: 봇키워드
    - `AC`: 채널추가
  - u1 `type: string` `length: 1,000` `description: 버튼링크`
    - {t} = "AL" 경우 iOS 앱링크 적용
    - {t} = "WL" 경우 Mobile 웹링크 적용
  - u2 `type: string` `length: 1,000` `description: 버튼링크`
    - {t} = "AL" 경우 Android 앱링크 적용
    - {t} = "WL" 경우 PC 웹링크 적용
  - tg `type: string` `length: 3` `description: 아웃 링크`
    - `out`: 디바이스 기본 브라우저
    - 기본값 : 카카오톡 인앱 브라우저 사용
  - telNum `type: string` `length: 14` `description: 전화걸기 번호`

**응답 예시**

```json
{
    "templateCode": "025100000033",
    "templateName": "템플릿 테스트_1014",
    "emphasizeTitle": "",
    "emphasizeSubtitle": "",
    "template": "테스트 메일을 작성합니다. #{변수}",
    "plusFriendID": "@팝빌",
    "secureYN": false,
    "state": "2",
    "stateDT": "20251014115508",
    "btns": []
}
```

## 3. ListATSTemplate - 알림톡 템플릿 목록 확인

| HTTP Method | 테스트(Sandbox)                                                   | 운영(Production)                                            |
| ----------- | -------------------------------------------------------------- | --------------------------------------------------------- |
| GET         | <https://popbill-test.linkhub.co.kr/KakaoTalk/ListATSTemplate> | <https://popbill.linkhub.co.kr/KakaoTalk/ListATSTemplate> |

- “승인” 상태의 알림톡 템플릿 목록을 확인합니다.

### Request

**요청 헤더**

- Authorization `required: Y` `description: 인증 토큰`
  - [\[참고\] 인증 및 헤더 설정](https://developers.popbill.com/api-reference/kakaotalk/getting-started/authorization)
- Accept-Language `required: N` `description: 응답 언어 설정`
  - `ko-KR`: 기본값
  - `en-US`
- Accept-Encoding `required: N` `description: 응답 압축 방식`
  - `gzip`
- X-PB-UserID `required: N` `description: 팝빌회원 아이디`

**요청 예시**

```bash
curl --request GET \
  --url 'https://{domain}/KakaoTalk/ListATSTemplate' \
  --header 'Authorization: Bearer {token}'
```

### Response

**응답 본문**

- templateCode `type: string` `length: 12` `description: 템플릿 코드`
- templateName `type: string` `length: 20` `description: 템플릿 제목`
- emphasizeTitle `type: string` `length: 50` `description: 강조표기 타이틀`
- emphasizeSubtitle `type: string` `length: 50` `description: 강조표기 보조 문구`
- template `type: string` `length: 1,300` `description: 템플릿 내용`
- plusFriendID `type: string` `length: 30` `description: 검색용 아이디`
- ads `type: string` `length: 80` `description: 광고 메시지`
- appendix `type: string` `length: 500` `description: 부가 메시지`
- secureYN `type: boolean` `length: -` `description: 보안템플릿 여부`
  - `true`: 보안템플릿
  - `false`: 일반템플릿
- state `type: string` `length: 1` `description: 템플릿 상태`
  - `0`: 임시저장
  - `2`: 심사중
  - `3`: 승인
  - `4`: 반려
  - `5`: 정지
  - `7`: 휴면
  - `8`: 삭제
- stateDT `type: string` `length: 14` `description: 템플릿 상태 일시`
  - 형식 : yyyyMMddHHmmss
- btns `type: array` `length: 5` `description: 버튼 목록`
  - n `type: string` `length: 14` `description: 버튼명`
  - t `type: string` `length: 2` `description: 버튼유형`
    - `WL`: 웹링크
    - `AL`: 앱링크
    - `TN`: 전화걸기
    - `DS`: 배송조회
    - `MD`: 메시지전달
    - `BK`: 봇키워드
    - `AC`: 채널추가
  - u1 `type: string` `length: 1,000` `description: 버튼링크`
    - {t} = "AL" 경우 iOS 앱링크 적용
    - {t} = "WL" 경우 Mobile 웹링크 적용
  - u2 `type: string` `length: 1,000` `description: 버튼링크`
    - {t} = "AL" 경우 Android 앱링크 적용
    - {t} = "WL" 경우 PC 웹링크 적용
  - tg `type: string` `length: 3` `description: 아웃 링크`
    - `out`: 디바이스 기본 브라우저
    - 기본값 : 카카오톡 인앱 브라우저 사용
  - telNum `type: string` `length: 14` `description: 전화걸기 번호`

**응답 예시**

```json
[
    {
        "templateCode": "025100000634",
        "templateName": "10월 배포테스트 템플릿 신청",
        "template": "테스트",
        "plusFriendID": "@팝빌",
        "btns": [],
        "secureYN": true,
        "state": "3",
        "stateDT": "20251022123400",
        "emphasizeTitle": "테스트",
        "emphasizeSubtitle": "테스트"
    }
]
```
