# 전송결과

## 1. GetMessages - 카카오톡 전송내역 확인

팝빌에서 반환받은 접수번호를 통해 카카오톡 전송상태 및 결과를 확인합니다.

```vb
Function GetMessages(corpNum As String, receiptNum As String, Optional userID As String = "") As PBKakaoSentResult
```

### 요청

**Parameters**

- corpNum `type: String` `length: 10` `required: Y` `description: 팝빌회원 사업자번호 ('-' 제외)`
- receiptNum `type: String` `length: 18` `required: Y` `description: 팝빌에서 할당한 접수번호`
- userID `type: String` `length: 50` `required: N` `description: 팝빌회원 아이디`

### 응답

**PBKakaoSentResult**

- contentType `type: Integer` `length: -` `description: 카카오톡 유형`
  - `1`: 알림톡
  - `4`: 알림톡 이미지
- templateCode `type: String` `length: 12` `description: 템플릿 코드`
  - 알림톡 전송 시 반환
- plusFriendID `type: String` `length: 30` `description: 검색용 아이디`
- sendNum `type: String` `length: 20` `description: 발신번호`
- altSubject `type: String` `length: 64` `description: 대체문자 제목`
  - 단위 : byte
- altContent `type: String` `length: 2,000` `description: 대체문자 내용`
  - 단위 : byte
- altSendType `type: String` `length: 1` `description: 대체문자 유형`
  - `null`: 미전송
  - `C`: 카카오톡과 동일 내용 전송
  - `A`: 대체문자 내용 전송
- reserveDT `type: String` `length: 14` `description: 예약일시`
  - 형식 : yyyyMMddHHmmss
- adsYN `type: Boolean` `length: -` `description: 광고메시지 전송 여부`
  - `true`: 광고
  - `false`: 일반
- sendCnt `type: String` `length: -` `description: 전송건수`
- successCnt `type: String` `length: -` `description: 성공건수`
- failCnt `type: String` `length: -` `description: 실패건수`
- altCnt `type: String` `length: -` `description: 대체문자 건수`
- cancelCnt `type: String` `length: -` `description: 취소건수`
- btns `type: PBKakaoButton[ ]` `length: 5` `description: 버튼 목록`
  - 최대 : 5개
  - n `type: String` `length: 14` `description: 버튼명`
  - t `type: String` `length: 2` `description: 버튼유형`
    - `WL`: 웹링크
    - `AL`: 앱링크
    - `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 웹링크 적용
- msgs `type: PBKakaoSentDetail[ ]` `length: 1,000` `description: 전송결과 정보`
  - state `type: Integer` `length: 1` `description: 상태코드`
    - [\[참고\] 팝빌 상태코드](https://developers.popbill.com/reference/kakaotalk/vba/response-code#state-code)
  - sendDT `type: String` `length: 14` `description: 전송일시`
    - 형식 : yyyyMMddHHmmss
  - result `type: Integer` `length: 3` `description: 카카오 결과코드`
    - [\[참고\] 카카오 결과코드(카카오톡)](https://developers.popbill.com/reference/kakaotalk/vba/response-code#kakao-result-code)
    - {state} = 3 경우 카카오톡 전송결과 확인 가능
  - resultDT `type: String` `length: 14` `description: 전송결과 수신일시`
    - 형식 : yyyyMMddHHmmss
  - contentType `type: Integer` `length: -` `description: 카카오톡 유형`
    - `1`: 알림톡
    - `4`: 알림톡 이미지
  - receiveNum `type: String` `length: 20` `description: 수신번호`
  - receiveName `type: String` `length: 70` `description: 수신자명`
  - content `type: String` `length: 1,300` `description: 카카오톡 내용`
  - altSubject `type: String` `length: 64` `description: 대체문자 제목`
    - 단위 : byte
  - altContent `type: String` `length: 2,000` `description: 대체문자 내용`
    - 단위 : byte
  - altContentType `type: Integer` `length: 1` `description: 대체문자 전송타입`
    - `4`: 단문
    - `6`: 장문
  - altSendDT `type: String` `length: 14` `description: 대체문자 전송일시`
    - 형식 : yyyyMMddHHmmss
  - altResult `type: Integer` `length: 3` `description: 대체문자 통신사 결과코드`
    - [\[참고\] 통신사 결과코드(대체문자)](https://developers.popbill.com/reference/kakaotalk/vba/response-code#telecom-result-code)
  - altResultDT `type: String` `length: 14` `description: 대체문자 전송결과 수신일시`
    - 형식 : yyyyMMddHHmmss
  - receiptNum `type: String` `length: 18` `description: 접수번호`
  - requestNum `type: String` `length: 36` `description: 요청번호`
  - interOPRefKey `type: String` `length: 20` `description: 파트너 지정키`
    - 카카오톡 대량/동보전송시 파트너가 개별건마다 입력할 수 있는 값

### 예외

**Err**

- LastErrCode `type: Long` `length: -` `description: API 처리 실패에 대한 오류코드`
  - 음의 정수 8자리 숫자값 [\[참고\] 오류코드](https://developers.popbill.com/error-code)
- LastErrMessage `type: String` `length: -` `description: API 처리 실패에 대한 오류메시지`

## 2. GetMessagesRN - 카카오톡 전송내역 확인 (요청번호 할당)

파트너가 할당한 요청번호를 통해 카카오톡 전송상태 및 결과를 확인합니다.

```vb
Function GetMessagesRN(corpNum As String, requestNum As String, Optional userID As String = "") As PBKakaoSentResult
```

### 요청

**Parameters**

- corpNum `type: String` `length: 10` `required: Y` `description: 팝빌회원 사업자번호 ('-' 제외)`
- requestNum `type: String` `length: 36` `required: Y` `description: 파트너가 할당한 요청번호`
- userID `type: String` `length: 50` `required: N` `description: 팝빌회원 아이디`

### 응답

**PBKakaoSentResult**

- contentType `type: Integer` `length: -` `description: 카카오톡 유형`
  - `1`: 알림톡
  - `4`: 알림톡 이미지
- templateCode `type: String` `length: 12` `description: 템플릿 코드`
  - 알림톡 전송 시 반환
- plusFriendID `type: String` `length: 30` `description: 검색용 아이디`
- sendNum `type: String` `length: 20` `description: 발신번호`
- altSubject `type: String` `length: 64` `description: 대체문자 제목`
  - 단위 : byte
- altContent `type: String` `length: 2,000` `description: 대체문자 내용`
  - 단위 : byte
- altSendType `type: String` `length: 1` `description: 대체문자 유형`
  - `null`: 미전송
  - `C`: 카카오톡과 동일 내용 전송
  - `A`: 대체문자 내용 전송
- reserveDT `type: String` `length: 14` `description: 예약일시`
  - 형식 : yyyyMMddHHmmss
- adsYN `type: Boolean` `length: -` `description: 광고메시지 전송 여부`
  - `true`: 광고
  - `false`: 일반
- sendCnt `type: String` `length: -` `description: 전송건수`
- successCnt `type: String` `length: -` `description: 성공건수`
- failCnt `type: String` `length: -` `description: 실패건수`
- altCnt `type: String` `length: -` `description: 대체문자 건수`
- cancelCnt `type: String` `length: -` `description: 취소건수`
- btns `type: PBKakaoButton[ ]` `length: 5` `description: 버튼 목록`
  - 최대 : 5개
  - n `type: String` `length: 14` `description: 버튼명`
  - t `type: String` `length: 2` `description: 버튼유형`
    - `WL`: 웹링크
    - `AL`: 앱링크
    - `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 웹링크 적용
- msgs `type: PBKakaoSentDetail[ ]` `length: 1,000` `description: 전송결과 정보`
  - state `type: Integer` `length: 1` `description: 상태코드`
    - [\[참고\] 팝빌 상태코드](https://developers.popbill.com/reference/kakaotalk/vba/response-code#state-code)
  - sendDT `type: String` `length: 14` `description: 전송일시`
    - 형식 : yyyyMMddHHmmss
  - result `type: Integer` `length: 3` `description: 카카오 결과코드`
    - [\[참고\] 카카오 결과코드(카카오톡)](https://developers.popbill.com/reference/kakaotalk/vba/response-code#kakao-result-code)
    - {state} = 3 경우 카카오톡 전송결과 확인 가능
  - resultDT `type: String` `length: 14` `description: 전송결과 수신일시`
    - 형식 : yyyyMMddHHmmss
  - contentType `type: Integer` `length: -` `description: 카카오톡 유형`
    - `1`: 알림톡
    - `4`: 알림톡 이미지
  - receiveNum `type: String` `length: 20` `description: 수신번호`
  - receiveName `type: String` `length: 70` `description: 수신자명`
  - content `type: String` `length: 1,300` `description: 카카오톡 내용`
  - altSubject `type: String` `length: 64` `description: 대체문자 제목`
    - 단위 : byte
  - altContent `type: String` `length: 2,000` `description: 대체문자 내용`
    - 단위 : byte
  - altContentType `type: Integer` `length: 1` `description: 대체문자 전송타입`
    - `4`: 단문
    - `6`: 장문
  - altSendDT `type: String` `length: 14` `description: 대체문자 전송일시`
    - 형식 : yyyyMMddHHmmss
  - altResult `type: Integer` `length: 3` `description: 대체문자 통신사 결과코드`
    - [\[참고\] 통신사 결과코드(대체문자)](https://developers.popbill.com/reference/kakaotalk/vba/response-code#telecom-result-code)
  - altResultDT `type: String` `length: 14` `description: 대체문자 전송결과 수신일시`
    - 형식 : yyyyMMddHHmmss
  - receiptNum `type: String` `length: 18` `description: 접수번호`
  - requestNum `type: String` `length: 36` `description: 요청번호`
  - interOPRefKey `type: String` `length: 20` `description: 파트너 지정키`
    - 카카오톡 대량/동보전송시 파트너가 개별건마다 입력할 수 있는 값

### 예외

**Err**

- LastErrCode `type: Long` `length: -` `description: API 처리 실패에 대한 오류코드`
  - 음의 정수 8자리 숫자값 [\[참고\] 오류코드](https://developers.popbill.com/error-code)
- LastErrMessage `type: String` `length: -` `description: API 처리 실패에 대한 오류메시지`

## 3. Search - 전송내역 목록 조회

검색조건에 해당하는 카카오톡 전송내역을 조회합니다. (조회기간 단위 : 최대 2개월)

- 카카오톡 접수일시로부터 12개월 이내 접수건만 조회할 수 있습니다.

```vb
Function Search(corpNum As String, sDate As String, eDate As String, state As Collection, item As Collection, reserveYN As String, SenderYN As Boolean, page As Integer, perpage As Integer, order As String, Optional qString As String = "") As PBKakaoSearchResult
```

> 매개변수 page, perpage, order를 이용하여 페이징 기능을 구현할 수 있습니다.

### 요청

**Parameters**

- corpNum `type: String` `length: 10` `required: Y` `description: 팝빌회원 사업자번호 ('-' 제외)`
- sDate `type: String` `length: 8` `required: Y` `description: 검색 시작일자`
  - 형식 : yyyyMMdd
- eDate `type: String` `length: 8` `required: Y` `description: 검색 종료일자`
  - 형식 : yyyyMMdd
- state `type: Collection` `length: -` `required: N` `description: 전송상태 (다중 선택 가능)`
  - `0`: 전송대기
  - `1`: 전송중
  - `2`: 전송성공
  - `3`: 대체문자 전송성공
  - `4`: 전송실패
  - `5`: 예약취소
- item `type: Collection` `length: -` `required: N` `description: 검색대상`
  - `ATS`: 알림톡
  - 기본값 : 전체조회
- reserveYN `type: String` `length: 1` `required: N` `description: 전송유형별 조회 (택 1)`
  - `0`: 즉시전송건
  - `1`: 예약전송건
  - 기본값 : 전체조회
- SenderYN `type: Boolean` `length: -` `required: N` `description: 사용자권한별 조회`
  - `true`: 팝빌회원 아이디(userID)로 전송한 카카오톡만 조회
  - `false`: 전송한 카카오톡 전체 조회 : 기본값
- page `type: Integer` `length: -` `required: N` `description: 목록 페이지번호`
  - 기본값 : 1
- perpage `type: Integer` `length: -` `required: N` `description: 페이지당 표시할 목록 건수`
  - 최대 : 1,000건
  - 기본값 : 500건
- order `type: String` `length: 1` `required: N` `description: 카카오톡 접수일시를 기준으로 하는 목록 정렬 방향`
  - `D`: 내림차순 : 기본값
  - `A`: 오름차순
- qString `type: String` `length: 70` `required: N` `description: 조회 검색어(수신자명, 수신번호)`
  - 기본값 : 전체조회

### 응답

**PBKakaoSearchResult**

- code `type: long` `length: -` `description: API 처리에 대한 응답코드`
  - `1`: 성공
- message `type: String` `length: -` `description: API 처리에 대한 응답메시지`
- total `type: Integer` `length: -` `description: 총 검색결과 건수`
- perPage `type: Integer` `length: -` `description: 페이지 당 목록 건수`
- pageNum `type: Integer` `length: -` `description: 페이지 번호`
- pageCount `type: Integer` `length: -` `description: 페이지 개수`
- list `type: PBKakaoSentDetail[ ]` `length: 1,000` `description: 전송결과 정보`
  - state `type: Integer` `length: 1` `description: 상태코드`
    - [\[참고\] 팝빌 상태코드](https://developers.popbill.com/reference/kakaotalk/vba/response-code#state-code)
  - sendDT `type: String` `length: 14` `description: 전송일시`
    - 형식 : yyyyMMddHHmmss
  - result `type: Integer` `length: 3` `description: 카카오 결과코드`
    - [\[참고\] 카카오 결과코드(카카오톡)](https://developers.popbill.com/reference/kakaotalk/vba/response-code#kakao-result-code)
    - {state} = 3 경우 카카오톡 전송결과 확인 가능
  - resultDT `type: String` `length: 14` `description: 전송결과 수신일시`
    - 형식 : yyyyMMddHHmmss
  - contentType `type: Integer` `length: -` `description: 카카오톡 유형`
    - `1`: 알림톡
    - `4`: 알림톡 이미지
  - receiveNum `type: String` `length: 20` `description: 수신번호`
  - receiveName `type: String` `length: 70` `description: 수신자명`
  - content `type: String` `length: 1,300` `description: 카카오톡 내용`
  - altSubject `type: String` `length: 64` `description: 대체문자 제목`
    - 단위 : byte
  - altContent `type: String` `length: 2,000` `description: 대체문자 내용`
    - 단위 : byte
  - altContentType `type: Integer` `length: 1` `description: 대체문자 전송타입`
    - `4`: 단문
    - `6`: 장문
  - altSendDT `type: String` `length: 14` `description: 대체문자 전송일시`
    - 형식 : yyyyMMddHHmmss
  - altResult `type: Integer` `length: 3` `description: 대체문자 통신사 결과코드`
    - [\[참고\] 통신사 결과코드(대체문자)](https://developers.popbill.com/reference/kakaotalk/vba/response-code#telecom-result-code)
  - altResultDT `type: String` `length: 14` `description: 대체문자 전송결과 수신일시`
    - 형식 : yyyyMMddHHmmss
  - receiptNum `type: String` `length: 18` `description: 접수번호`
  - requestNum `type: String` `length: 36` `description: 요청번호`
  - interOPRefKey `type: String` `length: 20` `description: 파트너 지정키`
    - 카카오톡 대량/동보전송시 파트너가 개별건마다 입력할 수 있는 값

### 예외

**Err**

- LastErrCode `type: Long` `length: -` `description: API 처리 실패에 대한 오류코드`
  - 음의 정수 8자리 숫자값 [\[참고\] 오류코드](https://developers.popbill.com/error-code)
- LastErrMessage `type: String` `length: -` `description: API 처리 실패에 대한 오류메시지`

## 4. GetSentListURL - 카카오톡 전송내역 팝업 URL

![카카오톡 전송내역 팝업 URL 미리보기](https://developers.popbill.com/images/reference/kakaotalk/getSentListURL.png)

**카카오톡 전송내역 팝업 URL을 반환합니다.**

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

```vb
Function GetSentListURL(corpNum As String, userID As String) As String
```

### 요청

**Parameters**

- corpNum `type: String` `length: 10` `required: Y` `description: 팝빌회원 사업자번호 ('-' 제외)`
- userID `type: String` `length: 50` `required: N` `description: 팝빌회원 아이디`

### 응답

String - 요청에 대한 응답 URL

### 예외

**Err**

- LastErrCode `type: Long` `length: -` `description: API 처리 실패에 대한 오류코드`
  - 음의 정수 8자리 숫자값 [\[참고\] 오류코드](https://developers.popbill.com/error-code)
- LastErrMessage `type: String` `length: -` `description: API 처리 실패에 대한 오류메시지`
