# 발신번호 관리

## 1. CheckSenderNumber - 발신번호 등록여부 확인

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

- 카카오톡 발신번호 등록여부를 확인합니다.
- 발신번호 상태가 ‘사용’인 경우에만 응답 객체 Response의 변수 ‘code’가 1로 반환됩니다.

### 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 파라미터**

- senderNumber `type: string` `length: 20` `required: Y` `description: 발신번호`

**요청 예시**

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

### Response

**응답 본문**

- code `type: number` `length: -` `description: API 처리에 대한 응답코드`
  - `1`: 성공
- message `type: string` `length: -` `description: API 처리에 대한 응답메시지`

**응답 예시**

```json
{
    "code": 0,
    "message": "등록되지 않은 발신번호 입니다."
}
```

## 2. GetSenderNumberMgtURL - 발신번호 등록 팝업 URL

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

![발신번호 등록 팝업 URL 미리보기](https://developers.popbill.com/images/reference/kakaotalk/getSenderNumberMgtURL.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: 고정값 : SENDER`

**요청 예시**

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

### Response

**응답 본문**

- url `type: string` `length: -` `description: 발신번호 등록 팝업 URL`

**응답 예시**

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

## 3. GetSenderNumberList - 발신번호 목록 확인

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

- 팝빌에 등록한 연동회원의 카카오톡 발신번호 목록을 확인합니다.

### 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}/Message/SenderNumber' \
  --header 'Authorization: Bearer {token}'
```

### Response

**응답 본문**

- number `type: string` `length: 20` `description: 발신번호`
- representYN `type: boolean` `length: -` `description: 대표번호 지정여부`
  - `true`: 대표번호
  - `false`: 일반번호
- state `type: number` `length: 1` `description: 상태`
  - `0`: 대기
  - `1`: 사용
  - `2`: 중지
  - `5`: 반려
- memo `type: string` `length: 200` `description: 메모`

**응답 예시**

```json
[
    {
        "number": "16008536",
        "representYN": false,
        "state": 1,
        "memo": null
    }
]
```
