sendgo-fastapi 1.2.1__tar.gz → 1.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sendgo_fastapi-1.2.1/sendgo_fastapi.egg-info → sendgo_fastapi-1.3.0}/PKG-INFO +108 -2
- {sendgo_fastapi-1.2.1 → sendgo_fastapi-1.3.0}/README.md +106 -0
- {sendgo_fastapi-1.2.1 → sendgo_fastapi-1.3.0}/pyproject.toml +2 -2
- {sendgo_fastapi-1.2.1 → sendgo_fastapi-1.3.0/sendgo_fastapi.egg-info}/PKG-INFO +108 -2
- {sendgo_fastapi-1.2.1 → sendgo_fastapi-1.3.0}/sendgo_fastapi.egg-info/requires.txt +1 -1
- {sendgo_fastapi-1.2.1 → sendgo_fastapi-1.3.0}/LICENSE +0 -0
- {sendgo_fastapi-1.2.1 → sendgo_fastapi-1.3.0}/sendgo_fastapi/__init__.py +0 -0
- {sendgo_fastapi-1.2.1 → sendgo_fastapi-1.3.0}/sendgo_fastapi/dependencies.py +0 -0
- {sendgo_fastapi-1.2.1 → sendgo_fastapi-1.3.0}/sendgo_fastapi/settings.py +0 -0
- {sendgo_fastapi-1.2.1 → sendgo_fastapi-1.3.0}/sendgo_fastapi.egg-info/SOURCES.txt +0 -0
- {sendgo_fastapi-1.2.1 → sendgo_fastapi-1.3.0}/sendgo_fastapi.egg-info/dependency_links.txt +0 -0
- {sendgo_fastapi-1.2.1 → sendgo_fastapi-1.3.0}/sendgo_fastapi.egg-info/top_level.txt +0 -0
- {sendgo_fastapi-1.2.1 → sendgo_fastapi-1.3.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sendgo-fastapi
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.0
|
|
4
4
|
Summary: Sendgo FastAPI 확장 — 카카오 알림톡/브랜드메시지, SMS/LMS/MMS
|
|
5
5
|
Author-email: Sendgo <dev@sendgo.io>
|
|
6
6
|
License: MIT
|
|
@@ -19,7 +19,7 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
19
19
|
Requires-Python: >=3.10
|
|
20
20
|
Description-Content-Type: text/markdown
|
|
21
21
|
License-File: LICENSE
|
|
22
|
-
Requires-Dist: sendgo-python>=1.
|
|
22
|
+
Requires-Dist: sendgo-python>=1.3
|
|
23
23
|
Requires-Dist: fastapi>=0.110
|
|
24
24
|
Requires-Dist: pydantic-settings>=2.0
|
|
25
25
|
Dynamic: license-file
|
|
@@ -446,8 +446,114 @@ A. `app.dependency_overrides[get_sendgo] = lambda: mock_client`로 의존성을
|
|
|
446
446
|
사용 예시와 파라미터는 [코어 README](https://github.com/send-go) 와
|
|
447
447
|
[SDK 가이드](https://sendgo.io/ko/sdk) 를 참고하세요.
|
|
448
448
|
|
|
449
|
+
## 관리 API — 채널·템플릿·발신번호 등록 (v2 전용)
|
|
450
|
+
|
|
451
|
+
코어(`sendgo-python`)의 관리 서비스가 주입받은 클라이언트에 그대로 붙어
|
|
452
|
+
있습니다. 콘솔에서만 되던 등록·심사를 라우트에서 처리할 수 있습니다.
|
|
453
|
+
|
|
454
|
+
| 접근 | 하는 일 | 계정 |
|
|
455
|
+
| --- | --- | --- |
|
|
456
|
+
| `.kakao_senders` | 카카오 채널 인증·등록·동기화, 브랜드메시지 M/N 신청 | 기업 |
|
|
457
|
+
| `.notice_templates` | 알림톡 템플릿 CRUD, 검수 요청·취소, 승인 취소, 휴면 해제 | 기업 |
|
|
458
|
+
| `.brand_templates` | 브랜드메시지 템플릿 CRUD, 동기화, 가져오기 | 기업 |
|
|
459
|
+
| `.sender_registration` | 발신번호 등록 신청, 중복 확인, 유형 안내 | 개인·기업 |
|
|
460
|
+
| `.message_templates` | 문자 상용구 템플릿 CRUD | 개인·기업 |
|
|
461
|
+
| `.kakao_images` | 카카오 이미지 업로드 — 템플릿용 URL 발급 | 기업 |
|
|
462
|
+
| `.rejected_numbers` | 수신거부(080) 번호 조회 | 개인·기업 |
|
|
463
|
+
| `.webhook` | 이벤트 웹훅 구독 — 심사 결과 수신 | 개인·기업 |
|
|
464
|
+
|
|
465
|
+
> **sendgo.io 콘솔에 들어올 일이 없습니다.** 휴대폰 발신번호는 PASS 대신
|
|
466
|
+
> 신분증 사본을 받아 sendgo 운영자가 대신 심사합니다. 사람이 개입하는 지점은
|
|
467
|
+
> 카카오 채널 인증번호 하나뿐이고, 그것도 여러분 화면에서 입력받으면 됩니다.
|
|
468
|
+
> 심사가 붙는 것들은 비동기라 웹훅으로 결과를 받으세요.
|
|
469
|
+
|
|
470
|
+
```python
|
|
471
|
+
from fastapi import APIRouter, BackgroundTasks, HTTPException, UploadFile
|
|
472
|
+
from sendgo import SendgoError
|
|
473
|
+
from sendgo_fastapi import SendgoDep
|
|
474
|
+
|
|
475
|
+
router = APIRouter(prefix="/onboarding")
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
@router.post("/channel/code")
|
|
479
|
+
async def request_channel_code(yellow_id: str, phone: str, sendgo: SendgoDep):
|
|
480
|
+
"""1단계 — 카카오가 관리자 휴대폰으로 인증번호를 SMS 발송한다."""
|
|
481
|
+
return sendgo.kakao_senders.request_token(yellow_id, phone)
|
|
482
|
+
|
|
483
|
+
|
|
484
|
+
@router.post("/channel")
|
|
485
|
+
async def register_channel(yellow_id: str, phone: str, code: str, sendgo: SendgoDep):
|
|
486
|
+
"""2단계 — 사용자가 입력한 인증번호로 발신프로필 생성."""
|
|
487
|
+
created = sendgo.kakao_senders.create(
|
|
488
|
+
token=code,
|
|
489
|
+
yellow_id=yellow_id,
|
|
490
|
+
phone_number=phone,
|
|
491
|
+
category_code="001001",
|
|
492
|
+
)
|
|
493
|
+
return created["data"]["sender"]
|
|
494
|
+
|
|
495
|
+
|
|
496
|
+
@router.post("/templates")
|
|
497
|
+
async def provision_template(kakao_sender_key: str, sendgo: SendgoDep):
|
|
498
|
+
try:
|
|
499
|
+
created = sendgo.notice_templates.create(
|
|
500
|
+
kakao_sender_key=kakao_sender_key,
|
|
501
|
+
template_name="주문 접수 안내",
|
|
502
|
+
template_content="#{name}님, 주문 #{orderNo}이 접수되었습니다.",
|
|
503
|
+
template_message_type="BA",
|
|
504
|
+
template_emphasize_type="NONE",
|
|
505
|
+
category_code="001001",
|
|
506
|
+
message_purpose="order_delivery",
|
|
507
|
+
legal_basis="transaction",
|
|
508
|
+
benefit_origin="none",
|
|
509
|
+
expiry_type="none",
|
|
510
|
+
)
|
|
511
|
+
except SendgoError as exc:
|
|
512
|
+
# POLICY_VALIDATION_FAILED 면 errors["reasons"] 에 한국어 사유가 담긴다
|
|
513
|
+
raise HTTPException(status_code=422, detail=exc.errors) from exc
|
|
514
|
+
|
|
515
|
+
code = created["data"]["template"]["templateCode"]
|
|
516
|
+
sendgo.notice_templates.request_inspection(code)
|
|
517
|
+
|
|
518
|
+
return {"templateCode": code, "inspectionStatus": "REQ"}
|
|
519
|
+
|
|
520
|
+
|
|
521
|
+
@router.post("/senders")
|
|
522
|
+
async def register_sender(alias: str, phone: str, csu: UploadFile, sendgo: SendgoDep):
|
|
523
|
+
"""발신번호 등록 신청. 접수만 되고(PENDING) 운영자 승인 후 쓸 수 있다."""
|
|
524
|
+
return sendgo.sender_registration.create(
|
|
525
|
+
sender_alias=alias,
|
|
526
|
+
sender_number_type="team_main",
|
|
527
|
+
phone_e164=phone,
|
|
528
|
+
files={"csuCertificate": (csu.filename, csu.file, csu.content_type)},
|
|
529
|
+
)
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
검수 결과는 비동기입니다. `BackgroundTasks` 나 별도 스케줄러에서
|
|
533
|
+
`notice_templates.sync(code)` 를 돌려 `inspectionStatus` 가 `APR` 이 되는지
|
|
534
|
+
확인하세요 — 요청 핸들러 안에서 기다리면 안 됩니다.
|
|
535
|
+
|
|
536
|
+
전체 파라미터는 [sendgo-python README](https://github.com/send-go/python) 를 참고하세요.
|
|
537
|
+
|
|
538
|
+
---
|
|
539
|
+
|
|
449
540
|
## 변경 사항
|
|
450
541
|
|
|
542
|
+
### 1.3.0 (2026-09-11)
|
|
543
|
+
|
|
544
|
+
- **관리 API 노출** — 코어 1.3.0 의 `kakao_senders` · `notice_templates` ·
|
|
545
|
+
`brand_templates` · `sender_registration` · `message_templates` 를
|
|
546
|
+
`SendgoDep` 으로 주입받은 클라이언트에서 그대로 쓸 수 있습니다.
|
|
547
|
+
콘솔에서만 되던 채널 등록, 알림톡 템플릿 검수 요청, 발신번호 심사 접수를
|
|
548
|
+
라우트에서 처리합니다. `UploadFile` 을 그대로 서류로 넘길 수 있습니다.
|
|
549
|
+
- `sendgo-python` 을 `>=1.3` 으로 올렸습니다.
|
|
550
|
+
- **이벤트 웹훅** 추가 — 발신번호 승인, 알림톡 검수 결과, 채널 차단,
|
|
551
|
+
브랜드메시지 타겟팅 결과를 구독해 받습니다. 서명은 받은 원본 바이트로
|
|
552
|
+
검증합니다(SDK 에 검증 헬퍼 포함).
|
|
553
|
+
- **카카오 이미지 업로드** 추가 — 브랜드메시지 템플릿의 `imageUrl` 은 카카오가
|
|
554
|
+
호스팅하는 URL 이어야 하는데, 그 URL 을 얻는 길이 콘솔에만 있었습니다.
|
|
555
|
+
- **수신거부(080) 조회** 추가 — 자기 DB 의 수신 상태를 맞출 수 있습니다.
|
|
556
|
+
|
|
451
557
|
### 1.2.1 (2026-08-14)
|
|
452
558
|
|
|
453
559
|
- 레지스트리 목록에 노출되는 패키지 설명에서 친구톡을 브랜드메시지로 교체했습니다.
|
|
@@ -420,8 +420,114 @@ A. `app.dependency_overrides[get_sendgo] = lambda: mock_client`로 의존성을
|
|
|
420
420
|
사용 예시와 파라미터는 [코어 README](https://github.com/send-go) 와
|
|
421
421
|
[SDK 가이드](https://sendgo.io/ko/sdk) 를 참고하세요.
|
|
422
422
|
|
|
423
|
+
## 관리 API — 채널·템플릿·발신번호 등록 (v2 전용)
|
|
424
|
+
|
|
425
|
+
코어(`sendgo-python`)의 관리 서비스가 주입받은 클라이언트에 그대로 붙어
|
|
426
|
+
있습니다. 콘솔에서만 되던 등록·심사를 라우트에서 처리할 수 있습니다.
|
|
427
|
+
|
|
428
|
+
| 접근 | 하는 일 | 계정 |
|
|
429
|
+
| --- | --- | --- |
|
|
430
|
+
| `.kakao_senders` | 카카오 채널 인증·등록·동기화, 브랜드메시지 M/N 신청 | 기업 |
|
|
431
|
+
| `.notice_templates` | 알림톡 템플릿 CRUD, 검수 요청·취소, 승인 취소, 휴면 해제 | 기업 |
|
|
432
|
+
| `.brand_templates` | 브랜드메시지 템플릿 CRUD, 동기화, 가져오기 | 기업 |
|
|
433
|
+
| `.sender_registration` | 발신번호 등록 신청, 중복 확인, 유형 안내 | 개인·기업 |
|
|
434
|
+
| `.message_templates` | 문자 상용구 템플릿 CRUD | 개인·기업 |
|
|
435
|
+
| `.kakao_images` | 카카오 이미지 업로드 — 템플릿용 URL 발급 | 기업 |
|
|
436
|
+
| `.rejected_numbers` | 수신거부(080) 번호 조회 | 개인·기업 |
|
|
437
|
+
| `.webhook` | 이벤트 웹훅 구독 — 심사 결과 수신 | 개인·기업 |
|
|
438
|
+
|
|
439
|
+
> **sendgo.io 콘솔에 들어올 일이 없습니다.** 휴대폰 발신번호는 PASS 대신
|
|
440
|
+
> 신분증 사본을 받아 sendgo 운영자가 대신 심사합니다. 사람이 개입하는 지점은
|
|
441
|
+
> 카카오 채널 인증번호 하나뿐이고, 그것도 여러분 화면에서 입력받으면 됩니다.
|
|
442
|
+
> 심사가 붙는 것들은 비동기라 웹훅으로 결과를 받으세요.
|
|
443
|
+
|
|
444
|
+
```python
|
|
445
|
+
from fastapi import APIRouter, BackgroundTasks, HTTPException, UploadFile
|
|
446
|
+
from sendgo import SendgoError
|
|
447
|
+
from sendgo_fastapi import SendgoDep
|
|
448
|
+
|
|
449
|
+
router = APIRouter(prefix="/onboarding")
|
|
450
|
+
|
|
451
|
+
|
|
452
|
+
@router.post("/channel/code")
|
|
453
|
+
async def request_channel_code(yellow_id: str, phone: str, sendgo: SendgoDep):
|
|
454
|
+
"""1단계 — 카카오가 관리자 휴대폰으로 인증번호를 SMS 발송한다."""
|
|
455
|
+
return sendgo.kakao_senders.request_token(yellow_id, phone)
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
@router.post("/channel")
|
|
459
|
+
async def register_channel(yellow_id: str, phone: str, code: str, sendgo: SendgoDep):
|
|
460
|
+
"""2단계 — 사용자가 입력한 인증번호로 발신프로필 생성."""
|
|
461
|
+
created = sendgo.kakao_senders.create(
|
|
462
|
+
token=code,
|
|
463
|
+
yellow_id=yellow_id,
|
|
464
|
+
phone_number=phone,
|
|
465
|
+
category_code="001001",
|
|
466
|
+
)
|
|
467
|
+
return created["data"]["sender"]
|
|
468
|
+
|
|
469
|
+
|
|
470
|
+
@router.post("/templates")
|
|
471
|
+
async def provision_template(kakao_sender_key: str, sendgo: SendgoDep):
|
|
472
|
+
try:
|
|
473
|
+
created = sendgo.notice_templates.create(
|
|
474
|
+
kakao_sender_key=kakao_sender_key,
|
|
475
|
+
template_name="주문 접수 안내",
|
|
476
|
+
template_content="#{name}님, 주문 #{orderNo}이 접수되었습니다.",
|
|
477
|
+
template_message_type="BA",
|
|
478
|
+
template_emphasize_type="NONE",
|
|
479
|
+
category_code="001001",
|
|
480
|
+
message_purpose="order_delivery",
|
|
481
|
+
legal_basis="transaction",
|
|
482
|
+
benefit_origin="none",
|
|
483
|
+
expiry_type="none",
|
|
484
|
+
)
|
|
485
|
+
except SendgoError as exc:
|
|
486
|
+
# POLICY_VALIDATION_FAILED 면 errors["reasons"] 에 한국어 사유가 담긴다
|
|
487
|
+
raise HTTPException(status_code=422, detail=exc.errors) from exc
|
|
488
|
+
|
|
489
|
+
code = created["data"]["template"]["templateCode"]
|
|
490
|
+
sendgo.notice_templates.request_inspection(code)
|
|
491
|
+
|
|
492
|
+
return {"templateCode": code, "inspectionStatus": "REQ"}
|
|
493
|
+
|
|
494
|
+
|
|
495
|
+
@router.post("/senders")
|
|
496
|
+
async def register_sender(alias: str, phone: str, csu: UploadFile, sendgo: SendgoDep):
|
|
497
|
+
"""발신번호 등록 신청. 접수만 되고(PENDING) 운영자 승인 후 쓸 수 있다."""
|
|
498
|
+
return sendgo.sender_registration.create(
|
|
499
|
+
sender_alias=alias,
|
|
500
|
+
sender_number_type="team_main",
|
|
501
|
+
phone_e164=phone,
|
|
502
|
+
files={"csuCertificate": (csu.filename, csu.file, csu.content_type)},
|
|
503
|
+
)
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
검수 결과는 비동기입니다. `BackgroundTasks` 나 별도 스케줄러에서
|
|
507
|
+
`notice_templates.sync(code)` 를 돌려 `inspectionStatus` 가 `APR` 이 되는지
|
|
508
|
+
확인하세요 — 요청 핸들러 안에서 기다리면 안 됩니다.
|
|
509
|
+
|
|
510
|
+
전체 파라미터는 [sendgo-python README](https://github.com/send-go/python) 를 참고하세요.
|
|
511
|
+
|
|
512
|
+
---
|
|
513
|
+
|
|
423
514
|
## 변경 사항
|
|
424
515
|
|
|
516
|
+
### 1.3.0 (2026-09-11)
|
|
517
|
+
|
|
518
|
+
- **관리 API 노출** — 코어 1.3.0 의 `kakao_senders` · `notice_templates` ·
|
|
519
|
+
`brand_templates` · `sender_registration` · `message_templates` 를
|
|
520
|
+
`SendgoDep` 으로 주입받은 클라이언트에서 그대로 쓸 수 있습니다.
|
|
521
|
+
콘솔에서만 되던 채널 등록, 알림톡 템플릿 검수 요청, 발신번호 심사 접수를
|
|
522
|
+
라우트에서 처리합니다. `UploadFile` 을 그대로 서류로 넘길 수 있습니다.
|
|
523
|
+
- `sendgo-python` 을 `>=1.3` 으로 올렸습니다.
|
|
524
|
+
- **이벤트 웹훅** 추가 — 발신번호 승인, 알림톡 검수 결과, 채널 차단,
|
|
525
|
+
브랜드메시지 타겟팅 결과를 구독해 받습니다. 서명은 받은 원본 바이트로
|
|
526
|
+
검증합니다(SDK 에 검증 헬퍼 포함).
|
|
527
|
+
- **카카오 이미지 업로드** 추가 — 브랜드메시지 템플릿의 `imageUrl` 은 카카오가
|
|
528
|
+
호스팅하는 URL 이어야 하는데, 그 URL 을 얻는 길이 콘솔에만 있었습니다.
|
|
529
|
+
- **수신거부(080) 조회** 추가 — 자기 DB 의 수신 상태를 맞출 수 있습니다.
|
|
530
|
+
|
|
425
531
|
### 1.2.1 (2026-08-14)
|
|
426
532
|
|
|
427
533
|
- 레지스트리 목록에 노출되는 패키지 설명에서 친구톡을 브랜드메시지로 교체했습니다.
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "sendgo-fastapi"
|
|
7
|
-
version = "1.
|
|
7
|
+
version = "1.3.0"
|
|
8
8
|
description = "Sendgo FastAPI 확장 — 카카오 알림톡/브랜드메시지, SMS/LMS/MMS"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = {text = "MIT"}
|
|
@@ -23,7 +23,7 @@ classifiers = [
|
|
|
23
23
|
]
|
|
24
24
|
requires-python = ">=3.10"
|
|
25
25
|
dependencies = [
|
|
26
|
-
"sendgo-python>=1.
|
|
26
|
+
"sendgo-python>=1.3",
|
|
27
27
|
"fastapi>=0.110",
|
|
28
28
|
"pydantic-settings>=2.0",
|
|
29
29
|
]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sendgo-fastapi
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.0
|
|
4
4
|
Summary: Sendgo FastAPI 확장 — 카카오 알림톡/브랜드메시지, SMS/LMS/MMS
|
|
5
5
|
Author-email: Sendgo <dev@sendgo.io>
|
|
6
6
|
License: MIT
|
|
@@ -19,7 +19,7 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
19
19
|
Requires-Python: >=3.10
|
|
20
20
|
Description-Content-Type: text/markdown
|
|
21
21
|
License-File: LICENSE
|
|
22
|
-
Requires-Dist: sendgo-python>=1.
|
|
22
|
+
Requires-Dist: sendgo-python>=1.3
|
|
23
23
|
Requires-Dist: fastapi>=0.110
|
|
24
24
|
Requires-Dist: pydantic-settings>=2.0
|
|
25
25
|
Dynamic: license-file
|
|
@@ -446,8 +446,114 @@ A. `app.dependency_overrides[get_sendgo] = lambda: mock_client`로 의존성을
|
|
|
446
446
|
사용 예시와 파라미터는 [코어 README](https://github.com/send-go) 와
|
|
447
447
|
[SDK 가이드](https://sendgo.io/ko/sdk) 를 참고하세요.
|
|
448
448
|
|
|
449
|
+
## 관리 API — 채널·템플릿·발신번호 등록 (v2 전용)
|
|
450
|
+
|
|
451
|
+
코어(`sendgo-python`)의 관리 서비스가 주입받은 클라이언트에 그대로 붙어
|
|
452
|
+
있습니다. 콘솔에서만 되던 등록·심사를 라우트에서 처리할 수 있습니다.
|
|
453
|
+
|
|
454
|
+
| 접근 | 하는 일 | 계정 |
|
|
455
|
+
| --- | --- | --- |
|
|
456
|
+
| `.kakao_senders` | 카카오 채널 인증·등록·동기화, 브랜드메시지 M/N 신청 | 기업 |
|
|
457
|
+
| `.notice_templates` | 알림톡 템플릿 CRUD, 검수 요청·취소, 승인 취소, 휴면 해제 | 기업 |
|
|
458
|
+
| `.brand_templates` | 브랜드메시지 템플릿 CRUD, 동기화, 가져오기 | 기업 |
|
|
459
|
+
| `.sender_registration` | 발신번호 등록 신청, 중복 확인, 유형 안내 | 개인·기업 |
|
|
460
|
+
| `.message_templates` | 문자 상용구 템플릿 CRUD | 개인·기업 |
|
|
461
|
+
| `.kakao_images` | 카카오 이미지 업로드 — 템플릿용 URL 발급 | 기업 |
|
|
462
|
+
| `.rejected_numbers` | 수신거부(080) 번호 조회 | 개인·기업 |
|
|
463
|
+
| `.webhook` | 이벤트 웹훅 구독 — 심사 결과 수신 | 개인·기업 |
|
|
464
|
+
|
|
465
|
+
> **sendgo.io 콘솔에 들어올 일이 없습니다.** 휴대폰 발신번호는 PASS 대신
|
|
466
|
+
> 신분증 사본을 받아 sendgo 운영자가 대신 심사합니다. 사람이 개입하는 지점은
|
|
467
|
+
> 카카오 채널 인증번호 하나뿐이고, 그것도 여러분 화면에서 입력받으면 됩니다.
|
|
468
|
+
> 심사가 붙는 것들은 비동기라 웹훅으로 결과를 받으세요.
|
|
469
|
+
|
|
470
|
+
```python
|
|
471
|
+
from fastapi import APIRouter, BackgroundTasks, HTTPException, UploadFile
|
|
472
|
+
from sendgo import SendgoError
|
|
473
|
+
from sendgo_fastapi import SendgoDep
|
|
474
|
+
|
|
475
|
+
router = APIRouter(prefix="/onboarding")
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
@router.post("/channel/code")
|
|
479
|
+
async def request_channel_code(yellow_id: str, phone: str, sendgo: SendgoDep):
|
|
480
|
+
"""1단계 — 카카오가 관리자 휴대폰으로 인증번호를 SMS 발송한다."""
|
|
481
|
+
return sendgo.kakao_senders.request_token(yellow_id, phone)
|
|
482
|
+
|
|
483
|
+
|
|
484
|
+
@router.post("/channel")
|
|
485
|
+
async def register_channel(yellow_id: str, phone: str, code: str, sendgo: SendgoDep):
|
|
486
|
+
"""2단계 — 사용자가 입력한 인증번호로 발신프로필 생성."""
|
|
487
|
+
created = sendgo.kakao_senders.create(
|
|
488
|
+
token=code,
|
|
489
|
+
yellow_id=yellow_id,
|
|
490
|
+
phone_number=phone,
|
|
491
|
+
category_code="001001",
|
|
492
|
+
)
|
|
493
|
+
return created["data"]["sender"]
|
|
494
|
+
|
|
495
|
+
|
|
496
|
+
@router.post("/templates")
|
|
497
|
+
async def provision_template(kakao_sender_key: str, sendgo: SendgoDep):
|
|
498
|
+
try:
|
|
499
|
+
created = sendgo.notice_templates.create(
|
|
500
|
+
kakao_sender_key=kakao_sender_key,
|
|
501
|
+
template_name="주문 접수 안내",
|
|
502
|
+
template_content="#{name}님, 주문 #{orderNo}이 접수되었습니다.",
|
|
503
|
+
template_message_type="BA",
|
|
504
|
+
template_emphasize_type="NONE",
|
|
505
|
+
category_code="001001",
|
|
506
|
+
message_purpose="order_delivery",
|
|
507
|
+
legal_basis="transaction",
|
|
508
|
+
benefit_origin="none",
|
|
509
|
+
expiry_type="none",
|
|
510
|
+
)
|
|
511
|
+
except SendgoError as exc:
|
|
512
|
+
# POLICY_VALIDATION_FAILED 면 errors["reasons"] 에 한국어 사유가 담긴다
|
|
513
|
+
raise HTTPException(status_code=422, detail=exc.errors) from exc
|
|
514
|
+
|
|
515
|
+
code = created["data"]["template"]["templateCode"]
|
|
516
|
+
sendgo.notice_templates.request_inspection(code)
|
|
517
|
+
|
|
518
|
+
return {"templateCode": code, "inspectionStatus": "REQ"}
|
|
519
|
+
|
|
520
|
+
|
|
521
|
+
@router.post("/senders")
|
|
522
|
+
async def register_sender(alias: str, phone: str, csu: UploadFile, sendgo: SendgoDep):
|
|
523
|
+
"""발신번호 등록 신청. 접수만 되고(PENDING) 운영자 승인 후 쓸 수 있다."""
|
|
524
|
+
return sendgo.sender_registration.create(
|
|
525
|
+
sender_alias=alias,
|
|
526
|
+
sender_number_type="team_main",
|
|
527
|
+
phone_e164=phone,
|
|
528
|
+
files={"csuCertificate": (csu.filename, csu.file, csu.content_type)},
|
|
529
|
+
)
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
검수 결과는 비동기입니다. `BackgroundTasks` 나 별도 스케줄러에서
|
|
533
|
+
`notice_templates.sync(code)` 를 돌려 `inspectionStatus` 가 `APR` 이 되는지
|
|
534
|
+
확인하세요 — 요청 핸들러 안에서 기다리면 안 됩니다.
|
|
535
|
+
|
|
536
|
+
전체 파라미터는 [sendgo-python README](https://github.com/send-go/python) 를 참고하세요.
|
|
537
|
+
|
|
538
|
+
---
|
|
539
|
+
|
|
449
540
|
## 변경 사항
|
|
450
541
|
|
|
542
|
+
### 1.3.0 (2026-09-11)
|
|
543
|
+
|
|
544
|
+
- **관리 API 노출** — 코어 1.3.0 의 `kakao_senders` · `notice_templates` ·
|
|
545
|
+
`brand_templates` · `sender_registration` · `message_templates` 를
|
|
546
|
+
`SendgoDep` 으로 주입받은 클라이언트에서 그대로 쓸 수 있습니다.
|
|
547
|
+
콘솔에서만 되던 채널 등록, 알림톡 템플릿 검수 요청, 발신번호 심사 접수를
|
|
548
|
+
라우트에서 처리합니다. `UploadFile` 을 그대로 서류로 넘길 수 있습니다.
|
|
549
|
+
- `sendgo-python` 을 `>=1.3` 으로 올렸습니다.
|
|
550
|
+
- **이벤트 웹훅** 추가 — 발신번호 승인, 알림톡 검수 결과, 채널 차단,
|
|
551
|
+
브랜드메시지 타겟팅 결과를 구독해 받습니다. 서명은 받은 원본 바이트로
|
|
552
|
+
검증합니다(SDK 에 검증 헬퍼 포함).
|
|
553
|
+
- **카카오 이미지 업로드** 추가 — 브랜드메시지 템플릿의 `imageUrl` 은 카카오가
|
|
554
|
+
호스팅하는 URL 이어야 하는데, 그 URL 을 얻는 길이 콘솔에만 있었습니다.
|
|
555
|
+
- **수신거부(080) 조회** 추가 — 자기 DB 의 수신 상태를 맞출 수 있습니다.
|
|
556
|
+
|
|
451
557
|
### 1.2.1 (2026-08-14)
|
|
452
558
|
|
|
453
559
|
- 레지스트리 목록에 노출되는 패키지 설명에서 친구톡을 브랜드메시지로 교체했습니다.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|