File tree Expand file tree Collapse file tree
whatsapp_api_webhook_server_python Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ {
2+ // Используйте IntelliSense, чтобы узнать о возможных атрибутах.
3+ // Наведите указатель мыши, чтобы просмотреть описания существующих атрибутов.
4+ // Для получения дополнительной информации посетите: https://go.microsoft.com/fwlink/?linkid=830387
5+ "version" : " 0.2.0" ,
6+ "configurations" : [
7+ {
8+ "name" : " Python: текущий файл" ,
9+ "type" : " python" ,
10+ "request" : " launch" ,
11+ "program" : " ${file}" ,
12+ "console" : " integratedTerminal" ,
13+ "justMyCode" : false
14+ }
15+ ]
16+ }
Original file line number Diff line number Diff line change 1+ import setuptools
2+
3+ with open ("README.md" ) as file :
4+ read_me_description = file .read ()
5+
6+ setuptools .setup (
7+ name = "whatsapp-api-webhook-server-python" ,
8+ version = "0.0.3" ,
9+ install_requires = [],
10+ author = "Ivan Sadovy" ,
11+ author_email = "sadiv@bk.ru" ,
12+ description = "This library helps you easily create a python '\
13+ 'server application to get webhooks the WhatsApp API events '\
14+ 'using service green-api.com" ,
15+ long_description = read_me_description ,
16+ long_description_content_type = "text/markdown" ,
17+ url = "https://github.com/green-api/whatsapp-api-webhook-server-python" ,
18+ packages = ['whatsapp_api_webhook_server_python' ],
19+ classifiers = [
20+ "Programming Language :: Python :: 3" ,
21+ "License :: OSI Approved :: MIT License" ,
22+ "Operating System :: OS Independent" ,
23+ ],
24+ python_requires = '>=3.5' ,
25+ )
Original file line number Diff line number Diff line change 1+ import json
2+ from ast import literal_eval
3+ from enum import Enum
4+
5+
6+ class TypeWebhook (Enum ):
7+ INCOMING_MESSAGE_RECEIVED = 'incomingMessageReceived'
8+ OUTGOING_MESSAGE_RECEIVED = 'outgoingMessageReceived'
9+ OUTGOING_API_MESSAGE_RECEIVED = 'outgoingAPIMessageReceived'
10+ OUTGOING_MESSAGE_STATUS = 'outgoingMessageStatus'
11+ STATE_INSTANCE_CHANGED = 'stateInstanceChanged'
12+ STATUS_INSTANCE_CHANGED = 'statusInstanceChanged'
13+ DEVICE_INFO = 'deviceInfo'
14+ INCOMING_CALL = 'incomingCall'
15+
16+ class Webhooks ():
17+
18+ def webhookProccessing (dataText , onEvent ):
19+ try :
20+ data = json .loads (dataText )
21+ except :
22+ return
23+ body = data ['body' ]
24+ typeWebhook = body ['typeWebhook' ]
25+ onEvent (typeWebhook , body )
You can’t perform that action at this time.
0 commit comments