create the ass webhook

main
Laurent 2 years ago
parent 1482760d1b
commit 05201f8fea
  1. 2
      subscriptions/urls.py
  2. 15
      subscriptions/views.py

@ -1,7 +1,9 @@
from django.urls import path
from . import views
from .views import app_store_webhook
urlpatterns = [
path("", views.index, name="index"),
path('app-store-webhook/', app_store_webhook, name='app_store_webhook'),
]

@ -1,5 +1,18 @@
from django.shortcuts import render
from django.http import HttpResponse
from django.http import HttpResponse, JsonResponse
def index(request):
return HttpResponse("Hello, world. You're at the subs index.")
def app_store_webhook(request):
data = request.body.decode('utf-8')
# Parse the JSON payload
payload = json.loads(data)
notification = ASSNotification(
content=payload,
)
notification.save()
return JsonResponse({'status': 'success'})

Loading…
Cancel
Save