Skip to content

Commit b0d220d

Browse files
committed
add viber
1 parent 82ffc73 commit b0d220d

8 files changed

Lines changed: 38 additions & 1 deletion

File tree

gettingstarted/urls.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import hello.views
88
import line.views
9+
import viber.views
910

1011
# To add a new path, first import the app:
1112
# import blog
@@ -24,5 +25,7 @@
2425
path("logout/", hello.views.logout, name="logout"),
2526

2627
path("line-message-callback/", line.views.message_callback, name="line_message_callback"),
27-
path("line-message-reply/", line.views.message_reply, name="line_message_reply")
28+
path("line-message-reply/", line.views.message_reply, name="line_message_reply"),
29+
30+
path("viber-callback/", viber.views.callback_url, name="viber_callback_url"),
2831
]

viber/__init__.py

Whitespace-only changes.

viber/admin.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.contrib import admin
2+
3+
# Register your models here.

viber/apps.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from django.apps import AppConfig
2+
3+
4+
class ViberConfig(AppConfig):
5+
name = 'viber'

viber/migrations/__init__.py

Whitespace-only changes.

viber/models.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from django.db import models
2+
3+
class Message(models.Model):
4+
pass

viber/tests.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.test import TestCase
2+
3+
# Create your tests here.

viber/views.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import json
2+
import logging
3+
import os
4+
import requests
5+
6+
from django.shortcuts import render
7+
from django.http import HttpResponse
8+
9+
from .models import Message
10+
11+
logger = logging.getLogger(__name__)
12+
viber_api_url = 'https://chatapi.viber.com/pa/'
13+
14+
from django.shortcuts import render
15+
16+
def callback_url(request):
17+
raw_message = request.body
18+
logger.error(raw_message)
19+
return HttpResponse('ok')

0 commit comments

Comments
 (0)