whatsapp-chatbot-python 0.9.3__tar.gz → 0.9.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {whatsapp_chatbot_python-0.9.3 → whatsapp_chatbot_python-0.9.5}/PKG-INFO +2 -2
- {whatsapp_chatbot_python-0.9.3 → whatsapp_chatbot_python-0.9.5}/README.md +1 -1
- {whatsapp_chatbot_python-0.9.3 → whatsapp_chatbot_python-0.9.5}/setup.py +1 -1
- {whatsapp_chatbot_python-0.9.3 → whatsapp_chatbot_python-0.9.5}/whatsapp_chatbot_python/manager/handler.py +27 -10
- {whatsapp_chatbot_python-0.9.3 → whatsapp_chatbot_python-0.9.5}/whatsapp_chatbot_python/manager/router.py +4 -2
- {whatsapp_chatbot_python-0.9.3 → whatsapp_chatbot_python-0.9.5}/whatsapp_chatbot_python.egg-info/PKG-INFO +2 -2
- {whatsapp_chatbot_python-0.9.3 → whatsapp_chatbot_python-0.9.5}/LICENSE +0 -0
- {whatsapp_chatbot_python-0.9.3 → whatsapp_chatbot_python-0.9.5}/setup.cfg +0 -0
- {whatsapp_chatbot_python-0.9.3 → whatsapp_chatbot_python-0.9.5}/tests/test_manager.py +0 -0
- {whatsapp_chatbot_python-0.9.3 → whatsapp_chatbot_python-0.9.5}/whatsapp_chatbot_python/__init__.py +0 -0
- {whatsapp_chatbot_python-0.9.3 → whatsapp_chatbot_python-0.9.5}/whatsapp_chatbot_python/bot.py +0 -0
- {whatsapp_chatbot_python-0.9.3 → whatsapp_chatbot_python-0.9.5}/whatsapp_chatbot_python/filters.py +0 -0
- {whatsapp_chatbot_python-0.9.3 → whatsapp_chatbot_python-0.9.5}/whatsapp_chatbot_python/manager/__init__.py +0 -0
- {whatsapp_chatbot_python-0.9.3 → whatsapp_chatbot_python-0.9.5}/whatsapp_chatbot_python/manager/observer.py +0 -0
- {whatsapp_chatbot_python-0.9.3 → whatsapp_chatbot_python-0.9.5}/whatsapp_chatbot_python/manager/state.py +0 -0
- {whatsapp_chatbot_python-0.9.3 → whatsapp_chatbot_python-0.9.5}/whatsapp_chatbot_python.egg-info/SOURCES.txt +0 -0
- {whatsapp_chatbot_python-0.9.3 → whatsapp_chatbot_python-0.9.5}/whatsapp_chatbot_python.egg-info/dependency_links.txt +0 -0
- {whatsapp_chatbot_python-0.9.3 → whatsapp_chatbot_python-0.9.5}/whatsapp_chatbot_python.egg-info/requires.txt +0 -0
- {whatsapp_chatbot_python-0.9.3 → whatsapp_chatbot_python-0.9.5}/whatsapp_chatbot_python.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: whatsapp-chatbot-python
|
|
3
|
-
Version: 0.9.
|
|
3
|
+
Version: 0.9.5
|
|
4
4
|
Summary: This library helps you easily create a Python chatbot with WhatsApp API.
|
|
5
5
|
Home-page: https://github.com/green-api/whatsapp-chatbot-python
|
|
6
6
|
Author: GREEN API
|
|
@@ -72,7 +72,7 @@ from whatsapp_chatbot_python import GreenAPIBot, Notification
|
|
|
72
72
|
|
|
73
73
|
## Setup
|
|
74
74
|
|
|
75
|
-
Before launching the bot, you should
|
|
75
|
+
Before launching the bot, you should remove Webhook Url (if set) from Personal Cabinet or by setting empty webhookUrl by using [SetSettings method](https://green-api.com/en/docs/api/account/SetSettings/). These settings will be enabled by bot automatically:
|
|
76
76
|
|
|
77
77
|
|
|
78
78
|
```json
|
|
@@ -38,7 +38,7 @@ from whatsapp_chatbot_python import GreenAPIBot, Notification
|
|
|
38
38
|
|
|
39
39
|
## Setup
|
|
40
40
|
|
|
41
|
-
Before launching the bot, you should
|
|
41
|
+
Before launching the bot, you should remove Webhook Url (if set) from Personal Cabinet or by setting empty webhookUrl by using [SetSettings method](https://green-api.com/en/docs/api/account/SetSettings/). These settings will be enabled by bot automatically:
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
```json
|
|
@@ -53,16 +53,33 @@ class Notification:
|
|
|
53
53
|
return self.event["senderData"]["sender"]
|
|
54
54
|
|
|
55
55
|
def get_message_text(self) -> Optional[str]:
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
56
|
+
type_webhook = self.event["typeWebhook"]
|
|
57
|
+
if type_webhook != "outgoingMessageStatus":
|
|
58
|
+
message_data = self.event["messageData"]
|
|
59
|
+
|
|
60
|
+
type_message = message_data["typeMessage"]
|
|
61
|
+
if type_message == "textMessage":
|
|
62
|
+
return message_data["textMessageData"]["textMessage"]
|
|
63
|
+
elif (
|
|
64
|
+
type_message == "extendedTextMessage"
|
|
65
|
+
or type_message == "quotedMessage"
|
|
66
|
+
):
|
|
67
|
+
return message_data["extendedTextMessageData"]["text"]
|
|
68
|
+
|
|
69
|
+
def get_id_message(self) -> Optional[str]:
|
|
70
|
+
id_message = self.event['idMessage']
|
|
71
|
+
return id_message
|
|
72
|
+
|
|
73
|
+
def get_status_message(self) -> Optional[str]:
|
|
74
|
+
type_webhook = self.event["typeWebhook"]
|
|
75
|
+
if type_webhook == "outgoingMessageStatus":
|
|
76
|
+
return self.event["status"]
|
|
77
|
+
|
|
78
|
+
def get_message_data(self) -> Optional[str]:
|
|
79
|
+
type_webhook = self.event["typeWebhook"]
|
|
80
|
+
if type_webhook != "outgoingMessageStatus":
|
|
81
|
+
message_data = self.event["messageData"]
|
|
82
|
+
return message_data
|
|
66
83
|
|
|
67
84
|
def answer(
|
|
68
85
|
self,
|
|
@@ -23,6 +23,7 @@ class Router:
|
|
|
23
23
|
self.outgoing_message: AbstractObserver = Observer(self)
|
|
24
24
|
self.outgoing_api_message: AbstractObserver = Observer(self)
|
|
25
25
|
self.outgoing_message_status: AbstractObserver = Observer(self)
|
|
26
|
+
self.incoming_call: AbstractObserver = Observer(self)
|
|
26
27
|
|
|
27
28
|
self.buttons: AbstractObserver = ButtonObserver(self)
|
|
28
29
|
|
|
@@ -33,7 +34,8 @@ class Router:
|
|
|
33
34
|
"incomingMessageReceived": self.message,
|
|
34
35
|
"outgoingMessageReceived": self.outgoing_message,
|
|
35
36
|
"outgoingAPIMessageReceived": self.outgoing_api_message,
|
|
36
|
-
"outgoingMessageStatus": self.outgoing_message_status
|
|
37
|
+
"outgoingMessageStatus": self.outgoing_message_status,
|
|
38
|
+
"incomingCall": self.incoming_call
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
def route_event(self, event: dict) -> None:
|
|
@@ -42,7 +44,7 @@ class Router:
|
|
|
42
44
|
observer = self.observers.get(type_webhook)
|
|
43
45
|
if observer:
|
|
44
46
|
data = json.dumps(event, ensure_ascii=False, indent=4)
|
|
45
|
-
|
|
47
|
+
|
|
46
48
|
self.logger.log(
|
|
47
49
|
logging.DEBUG, (
|
|
48
50
|
f"Routing {type_webhook} event with data: {data}"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: whatsapp-chatbot-python
|
|
3
|
-
Version: 0.9.
|
|
3
|
+
Version: 0.9.5
|
|
4
4
|
Summary: This library helps you easily create a Python chatbot with WhatsApp API.
|
|
5
5
|
Home-page: https://github.com/green-api/whatsapp-chatbot-python
|
|
6
6
|
Author: GREEN API
|
|
@@ -72,7 +72,7 @@ from whatsapp_chatbot_python import GreenAPIBot, Notification
|
|
|
72
72
|
|
|
73
73
|
## Setup
|
|
74
74
|
|
|
75
|
-
Before launching the bot, you should
|
|
75
|
+
Before launching the bot, you should remove Webhook Url (if set) from Personal Cabinet or by setting empty webhookUrl by using [SetSettings method](https://green-api.com/en/docs/api/account/SetSettings/). These settings will be enabled by bot automatically:
|
|
76
76
|
|
|
77
77
|
|
|
78
78
|
```json
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{whatsapp_chatbot_python-0.9.3 → whatsapp_chatbot_python-0.9.5}/whatsapp_chatbot_python/__init__.py
RENAMED
|
File without changes
|
{whatsapp_chatbot_python-0.9.3 → whatsapp_chatbot_python-0.9.5}/whatsapp_chatbot_python/bot.py
RENAMED
|
File without changes
|
{whatsapp_chatbot_python-0.9.3 → whatsapp_chatbot_python-0.9.5}/whatsapp_chatbot_python/filters.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|