튜토리얼
팝빌 Webhook 메시지 수신을 Django 프레임워크를 통해 구현한 View 함수 예제코드입니다.
수신 URL에 대한 Django URL 매핑 설정은 연동사 환경에 따라 상이할 수 있습니다.
Webhook 이벤트 메시지의 추가적인 항목은 하단의 [Webhook 메시지 구성]을 참조하시기 바랍니다.
import json
from django.http import HttpResponse, JsonResponse
from django.views.decorators.csrf import csrf_exempt
from config import settings
@csrf_exempt
def connect(request):
received_json_data = json.loads(request.body.decode("utf-8"))
print(received_json_data['eventDT']) # 이벤트 실행일시
print(received_json_data['eventType']) # 이벤트 유형
# 추가적인 항목은 [Webhook 메시지 구성] 참조
# Response 성공 처리.
return JsonResponse({
'result' : 'OK'
})












