summaryrefslogtreecommitdiff
path: root/indoteknik_api/controllers/api_v1/wati.py
blob: 68ff164064ede5736a3596d3bce45b763ee7a0d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from .. import controller
from odoo import http
from odoo.http import request
import json


class Wati(controller.Controller):
    prefix = '/api/v1/'

    @http.route(prefix + 'wati/notification', auth='none', type='json', csrf=False, cors='*', methods=['POST', 'OPTIONS'])
    def notification(self, **kw):
        json_raw = json.loads(request.httprequest.data)
        json_dump = json.dumps(json_raw, indent=4, sort_keys=True)

        request.env['wati.notification'].create([{
            'json_raw': json_dump,
            'is_lead': False
        }])

        return