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