chatgraph 0.3.11__tar.gz → 0.3.14__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.
Potentially problematic release.
This version of chatgraph might be problematic. Click here for more details.
- {chatgraph-0.3.11 → chatgraph-0.3.14}/PKG-INFO +1 -1
- {chatgraph-0.3.11 → chatgraph-0.3.14}/chatgraph/messages/message_consumer.py +4 -1
- {chatgraph-0.3.11 → chatgraph-0.3.14}/chatgraph/pb/userstate.proto +3 -1
- chatgraph-0.3.14/chatgraph/pb/userstate_pb2.py +47 -0
- {chatgraph-0.3.11 → chatgraph-0.3.14}/chatgraph/pb/voll.proto +9 -8
- chatgraph-0.3.14/chatgraph/pb/voll_pb2.py +63 -0
- {chatgraph-0.3.11 → chatgraph-0.3.14}/chatgraph/types/message_types.py +2 -2
- {chatgraph-0.3.11 → chatgraph-0.3.14}/chatgraph/types/request_types.py +47 -13
- {chatgraph-0.3.11 → chatgraph-0.3.14}/pyproject.toml +1 -1
- chatgraph-0.3.11/chatgraph/pb/userstate_pb2.py +0 -47
- chatgraph-0.3.11/chatgraph/pb/voll_pb2.py +0 -63
- {chatgraph-0.3.11 → chatgraph-0.3.14}/LICENSE +0 -0
- {chatgraph-0.3.11 → chatgraph-0.3.14}/README.md +0 -0
- {chatgraph-0.3.11 → chatgraph-0.3.14}/chatgraph/__init__.py +0 -0
- {chatgraph-0.3.11 → chatgraph-0.3.14}/chatgraph/auth/credentials.py +0 -0
- {chatgraph-0.3.11 → chatgraph-0.3.14}/chatgraph/bot/chatbot_model.py +0 -0
- {chatgraph-0.3.11 → chatgraph-0.3.14}/chatgraph/bot/chatbot_router.py +0 -0
- {chatgraph-0.3.11 → chatgraph-0.3.14}/chatgraph/cli/__init__.py +0 -0
- {chatgraph-0.3.11 → chatgraph-0.3.14}/chatgraph/error/chatbot_error.py +0 -0
- {chatgraph-0.3.11 → chatgraph-0.3.14}/chatgraph/error/route_error.py +0 -0
- {chatgraph-0.3.11 → chatgraph-0.3.14}/chatgraph/gRPC/gRPCCall.py +0 -0
- {chatgraph-0.3.11 → chatgraph-0.3.14}/chatgraph/pb/userstate_pb2_grpc.py +0 -0
- {chatgraph-0.3.11 → chatgraph-0.3.14}/chatgraph/pb/voll_pb2_grpc.py +0 -0
- {chatgraph-0.3.11 → chatgraph-0.3.14}/chatgraph/types/end_types.py +0 -0
- {chatgraph-0.3.11 → chatgraph-0.3.14}/chatgraph/types/route.py +0 -0
|
@@ -170,10 +170,13 @@ class MessageConsumer:
|
|
|
170
170
|
type=message.get('type', ''),
|
|
171
171
|
text=message.get('text', ''),
|
|
172
172
|
user_state=UserState(
|
|
173
|
-
customer_id=user_state.get('
|
|
173
|
+
customer_id=user_state.get('customer_id', ''),
|
|
174
174
|
menu=user_state.get('menu', ''),
|
|
175
175
|
route=user_state.get('route', ''),
|
|
176
176
|
lst_update=user_state.get('lst_update', ''),
|
|
177
|
+
direction_in=user_state.get('direction_in', ''),
|
|
178
|
+
voll_id=user_state.get('voll_id', ''),
|
|
179
|
+
platform=user_state.get('platform', ''),
|
|
177
180
|
obs=obs,
|
|
178
181
|
),
|
|
179
182
|
channel=message.get('channel', ''),
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
+
# NO CHECKED-IN PROTOBUF GENCODE
|
|
4
|
+
# source: userstate.proto
|
|
5
|
+
# Protobuf Python Version: 5.27.2
|
|
6
|
+
"""Generated protocol buffer code."""
|
|
7
|
+
from google.protobuf import descriptor as _descriptor
|
|
8
|
+
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
9
|
+
from google.protobuf import runtime_version as _runtime_version
|
|
10
|
+
from google.protobuf import symbol_database as _symbol_database
|
|
11
|
+
from google.protobuf.internal import builder as _builder
|
|
12
|
+
_runtime_version.ValidateProtobufRuntimeVersion(
|
|
13
|
+
_runtime_version.Domain.PUBLIC,
|
|
14
|
+
5,
|
|
15
|
+
27,
|
|
16
|
+
2,
|
|
17
|
+
'',
|
|
18
|
+
'userstate.proto'
|
|
19
|
+
)
|
|
20
|
+
# @@protoc_insertion_point(imports)
|
|
21
|
+
|
|
22
|
+
_sym_db = _symbol_database.Default()
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0fuserstate.proto\x12\tuserstate\"\x06\n\x04Void\"\x8d\x01\n\tUserState\x12\x0f\n\x07user_id\x18\x01 \x01(\t\x12\x0f\n\x07menu_id\x18\x02 \x01(\t\x12\r\n\x05route\x18\x03 \x01(\t\x12\x0b\n\x03obs\x18\x04 \x01(\t\x12\x0c\n\x04\x64\x61te\x18\x05 \x01(\t\x12\x11\n\tdirection\x18\x06 \x01(\x08\x12\x0f\n\x07voll_id\x18\x07 \x01(\t\x12\x10\n\x08platform\x18\x08 \x01(\t\"\x1e\n\x0bUserStateId\x12\x0f\n\x07user_id\x18\x01 \x01(\t\"0\n\rRequestStatus\x12\x0e\n\x06status\x18\x01 \x01(\x08\x12\x0f\n\x07message\x18\x02 \x01(\t\";\n\x0eUserStatesList\x12)\n\x0buser_states\x18\x01 \x03(\x0b\x32\x14.userstate.UserState2\xde\x02\n\x10UserStateService\x12?\n\x0fSelectUserState\x12\x16.userstate.UserStateId\x1a\x14.userstate.UserState\x12\x41\n\x0fInsertUserState\x12\x14.userstate.UserState\x1a\x18.userstate.RequestStatus\x12\x41\n\x0fUpdateUserState\x12\x14.userstate.UserState\x1a\x18.userstate.RequestStatus\x12\x43\n\x0f\x44\x65leteUserState\x12\x16.userstate.UserStateId\x1a\x18.userstate.RequestStatus\x12>\n\x10GetAllUserStates\x12\x0f.userstate.Void\x1a\x19.userstate.UserStatesListB\x10Z\x0e./pb/userstateb\x06proto3')
|
|
28
|
+
|
|
29
|
+
_globals = globals()
|
|
30
|
+
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
31
|
+
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'userstate_pb2', _globals)
|
|
32
|
+
if not _descriptor._USE_C_DESCRIPTORS:
|
|
33
|
+
_globals['DESCRIPTOR']._loaded_options = None
|
|
34
|
+
_globals['DESCRIPTOR']._serialized_options = b'Z\016./pb/userstate'
|
|
35
|
+
_globals['_VOID']._serialized_start=30
|
|
36
|
+
_globals['_VOID']._serialized_end=36
|
|
37
|
+
_globals['_USERSTATE']._serialized_start=39
|
|
38
|
+
_globals['_USERSTATE']._serialized_end=180
|
|
39
|
+
_globals['_USERSTATEID']._serialized_start=182
|
|
40
|
+
_globals['_USERSTATEID']._serialized_end=212
|
|
41
|
+
_globals['_REQUESTSTATUS']._serialized_start=214
|
|
42
|
+
_globals['_REQUESTSTATUS']._serialized_end=262
|
|
43
|
+
_globals['_USERSTATESLIST']._serialized_start=264
|
|
44
|
+
_globals['_USERSTATESLIST']._serialized_end=323
|
|
45
|
+
_globals['_USERSTATESERVICE']._serialized_start=326
|
|
46
|
+
_globals['_USERSTATESERVICE']._serialized_end=676
|
|
47
|
+
# @@protoc_insertion_point(module_scope)
|
|
@@ -27,14 +27,15 @@ message MessageRequest {
|
|
|
27
27
|
string hook_id = 1;
|
|
28
28
|
string enterprise_id = 2;
|
|
29
29
|
string unique_customer_id = 3;
|
|
30
|
-
string
|
|
31
|
-
string
|
|
32
|
-
string
|
|
33
|
-
string
|
|
34
|
-
string
|
|
35
|
-
string
|
|
36
|
-
string
|
|
37
|
-
|
|
30
|
+
string voll_id = 4;
|
|
31
|
+
string message_title = 5;
|
|
32
|
+
string message_text = 6;
|
|
33
|
+
string platform = 7;
|
|
34
|
+
string message_caption = 8;
|
|
35
|
+
string button_title = 9;
|
|
36
|
+
string campaign_name = 10;
|
|
37
|
+
string tabulation_name = 11;
|
|
38
|
+
repeated QuickOption options = 12;
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
message MessageResponse {
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
+
# NO CHECKED-IN PROTOBUF GENCODE
|
|
4
|
+
# source: voll.proto
|
|
5
|
+
# Protobuf Python Version: 5.27.2
|
|
6
|
+
"""Generated protocol buffer code."""
|
|
7
|
+
from google.protobuf import descriptor as _descriptor
|
|
8
|
+
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
9
|
+
from google.protobuf import runtime_version as _runtime_version
|
|
10
|
+
from google.protobuf import symbol_database as _symbol_database
|
|
11
|
+
from google.protobuf.internal import builder as _builder
|
|
12
|
+
_runtime_version.ValidateProtobufRuntimeVersion(
|
|
13
|
+
_runtime_version.Domain.PUBLIC,
|
|
14
|
+
5,
|
|
15
|
+
27,
|
|
16
|
+
2,
|
|
17
|
+
'',
|
|
18
|
+
'voll.proto'
|
|
19
|
+
)
|
|
20
|
+
# @@protoc_insertion_point(imports)
|
|
21
|
+
|
|
22
|
+
_sym_db = _symbol_database.Default()
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\nvoll.proto\x12\x0bmessagevoll\"\x06\n\x04Void\"\xae\x02\n\x0eMessageRequest\x12\x0f\n\x07hook_id\x18\x01 \x01(\t\x12\x15\n\renterprise_id\x18\x02 \x01(\t\x12\x1a\n\x12unique_customer_id\x18\x03 \x01(\t\x12\x0f\n\x07voll_id\x18\x04 \x01(\t\x12\x15\n\rmessage_title\x18\x05 \x01(\t\x12\x14\n\x0cmessage_text\x18\x06 \x01(\t\x12\x10\n\x08platform\x18\x07 \x01(\t\x12\x17\n\x0fmessage_caption\x18\x08 \x01(\t\x12\x14\n\x0c\x62utton_title\x18\t \x01(\t\x12\x15\n\rcampaign_name\x18\n \x01(\t\x12\x17\n\x0ftabulation_name\x18\x0b \x01(\t\x12)\n\x07options\x18\x0c \x03(\x0b\x32\x18.messagevoll.QuickOption\"2\n\x0fMessageResponse\x12\x0e\n\x06status\x18\x01 \x01(\x08\x12\x0f\n\x07message\x18\x02 \x01(\t\"1\n\x0bQuickOption\x12\r\n\x05title\x18\x01 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\"%\n\x0c\x43\x61mpaignName\x12\x15\n\rcampaign_name\x18\x01 \x01(\t\")\n\x0eTabulationName\x12\x17\n\x0ftabulation_name\x18\x01 \x01(\t\"=\n\x0f\x43\x61mpaignDetails\x12\x15\n\rcampaign_name\x18\x01 \x01(\t\x12\x13\n\x0b\x63\x61mpaign_id\x18\x02 \x01(\t\"R\n\x0f\x43\x61mpaignElement\x12\x13\n\x0b\x63\x61mpaign_id\x18\x01 \x01(\t\x12\x15\n\rcampaign_name\x18\x02 \x01(\t\x12\x13\n\x0blast_update\x18\x03 \x01(\t\"@\n\rCampaignsList\x12/\n\tcampaigns\x18\x01 \x03(\x0b\x32\x1c.messagevoll.CampaignElement\"C\n\x11TabulationDetails\x12\x17\n\x0ftabulation_name\x18\x01 \x01(\t\x12\x15\n\rtabulation_id\x18\x02 \x01(\t\"\xa9\x01\n\x11TabulationElement\x12\x15\n\rtabulation_id\x18\x01 \x01(\t\x12\x17\n\x0ftabulation_name\x18\x02 \x01(\t\x12\x17\n\x0ftabulation_type\x18\x03 \x01(\t\x12\x12\n\ngroup_name\x18\x04 \x01(\t\x12\"\n\x1a\x63ustomer_service_survey_id\x18\x05 \x01(\t\x12\x13\n\x0blast_update\x18\x06 \x01(\t\"F\n\x0fTabulationsList\x12\x33\n\x0btabulations\x18\x01 \x03(\x0b\x32\x1e.messagevoll.TabulationElement2\xfb\x02\n\x0eMessageService\x12G\n\nSendButton\x12\x1b.messagevoll.MessageRequest\x1a\x1c.messagevoll.MessageResponse\x12\x45\n\x08SendList\x12\x1b.messagevoll.MessageRequest\x1a\x1c.messagevoll.MessageResponse\x12\x45\n\x08SendText\x12\x1b.messagevoll.MessageRequest\x1a\x1c.messagevoll.MessageResponse\x12L\n\x0fTransferToHuman\x12\x1b.messagevoll.MessageRequest\x1a\x1c.messagevoll.MessageResponse\x12\x44\n\x07\x45ndChat\x12\x1b.messagevoll.MessageRequest\x1a\x1c.messagevoll.MessageResponse2\xb4\x02\n\x0e\x41\x63tionsService\x12H\n\rGetCampaignID\x12\x19.messagevoll.CampaignName\x1a\x1c.messagevoll.CampaignDetails\x12\x41\n\x10GetCampaignsList\x12\x11.messagevoll.Void\x1a\x1a.messagevoll.CampaignsList\x12N\n\x0fGetTabulationID\x12\x1b.messagevoll.TabulationName\x1a\x1e.messagevoll.TabulationDetails\x12\x45\n\x12GetTabulationsList\x12\x11.messagevoll.Void\x1a\x1c.messagevoll.TabulationsListB\x12Z\x10./pb/messagevollb\x06proto3')
|
|
28
|
+
|
|
29
|
+
_globals = globals()
|
|
30
|
+
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
31
|
+
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'voll_pb2', _globals)
|
|
32
|
+
if not _descriptor._USE_C_DESCRIPTORS:
|
|
33
|
+
_globals['DESCRIPTOR']._loaded_options = None
|
|
34
|
+
_globals['DESCRIPTOR']._serialized_options = b'Z\020./pb/messagevoll'
|
|
35
|
+
_globals['_VOID']._serialized_start=27
|
|
36
|
+
_globals['_VOID']._serialized_end=33
|
|
37
|
+
_globals['_MESSAGEREQUEST']._serialized_start=36
|
|
38
|
+
_globals['_MESSAGEREQUEST']._serialized_end=338
|
|
39
|
+
_globals['_MESSAGERESPONSE']._serialized_start=340
|
|
40
|
+
_globals['_MESSAGERESPONSE']._serialized_end=390
|
|
41
|
+
_globals['_QUICKOPTION']._serialized_start=392
|
|
42
|
+
_globals['_QUICKOPTION']._serialized_end=441
|
|
43
|
+
_globals['_CAMPAIGNNAME']._serialized_start=443
|
|
44
|
+
_globals['_CAMPAIGNNAME']._serialized_end=480
|
|
45
|
+
_globals['_TABULATIONNAME']._serialized_start=482
|
|
46
|
+
_globals['_TABULATIONNAME']._serialized_end=523
|
|
47
|
+
_globals['_CAMPAIGNDETAILS']._serialized_start=525
|
|
48
|
+
_globals['_CAMPAIGNDETAILS']._serialized_end=586
|
|
49
|
+
_globals['_CAMPAIGNELEMENT']._serialized_start=588
|
|
50
|
+
_globals['_CAMPAIGNELEMENT']._serialized_end=670
|
|
51
|
+
_globals['_CAMPAIGNSLIST']._serialized_start=672
|
|
52
|
+
_globals['_CAMPAIGNSLIST']._serialized_end=736
|
|
53
|
+
_globals['_TABULATIONDETAILS']._serialized_start=738
|
|
54
|
+
_globals['_TABULATIONDETAILS']._serialized_end=805
|
|
55
|
+
_globals['_TABULATIONELEMENT']._serialized_start=808
|
|
56
|
+
_globals['_TABULATIONELEMENT']._serialized_end=977
|
|
57
|
+
_globals['_TABULATIONSLIST']._serialized_start=979
|
|
58
|
+
_globals['_TABULATIONSLIST']._serialized_end=1049
|
|
59
|
+
_globals['_MESSAGESERVICE']._serialized_start=1052
|
|
60
|
+
_globals['_MESSAGESERVICE']._serialized_end=1431
|
|
61
|
+
_globals['_ACTIONSSERVICE']._serialized_start=1434
|
|
62
|
+
_globals['_ACTIONSSERVICE']._serialized_end=1742
|
|
63
|
+
# @@protoc_insertion_point(module_scope)
|
|
@@ -82,9 +82,9 @@ class ListElements:
|
|
|
82
82
|
def __init__(
|
|
83
83
|
self,
|
|
84
84
|
text:str,
|
|
85
|
+
button_title: str,
|
|
86
|
+
elements: dict,
|
|
85
87
|
title: Optional[str] = None,
|
|
86
|
-
button_title: Optional[str] = None,
|
|
87
|
-
elements: dict = None,
|
|
88
88
|
caption: Optional[str] = None,
|
|
89
89
|
absolute_text: bool = False,
|
|
90
90
|
) -> None:
|
|
@@ -2,6 +2,7 @@ from chatgraph.gRPC.gRPCCall import WhatsappServiceClient, UserStateServiceClien
|
|
|
2
2
|
from chatgraph.types.message_types import Message, Button, ListElements, messageTypes, MessageTypes
|
|
3
3
|
from dataclasses import dataclass
|
|
4
4
|
from typing import Optional
|
|
5
|
+
from datetime import datetime
|
|
5
6
|
import json, os
|
|
6
7
|
|
|
7
8
|
@dataclass
|
|
@@ -20,9 +21,11 @@ class UserState:
|
|
|
20
21
|
customer_id: str,
|
|
21
22
|
menu: str,
|
|
22
23
|
route: str,
|
|
24
|
+
platform: str,
|
|
25
|
+
direction_in: bool,
|
|
26
|
+
voll_id: Optional[str]=None,
|
|
23
27
|
lst_update: Optional[str]=None,
|
|
24
28
|
obs: Optional[dict] = None,
|
|
25
|
-
direction_in: Optional[bool] = True,
|
|
26
29
|
) -> None:
|
|
27
30
|
|
|
28
31
|
self.customer_id = customer_id
|
|
@@ -31,6 +34,8 @@ class UserState:
|
|
|
31
34
|
self.lst_update = lst_update
|
|
32
35
|
self.obs = obs
|
|
33
36
|
self.direction_in = direction_in
|
|
37
|
+
self.voll_id = voll_id
|
|
38
|
+
self.platform = platform
|
|
34
39
|
|
|
35
40
|
def __str__(self):
|
|
36
41
|
return f"UserState:\n\tcustomer_id={self.customer_id},\n\tmenu={self.menu},\n\troute={self.route},\n\tlst_update={self.lst_update},\n\tobs={self.obs},\n\tdirection_in={self.direction_in}"
|
|
@@ -45,6 +50,9 @@ class UserState:
|
|
|
45
50
|
'menu_id': self.menu,
|
|
46
51
|
'route': self.route,
|
|
47
52
|
'obs': json.dumps(self.obs),
|
|
53
|
+
'direction': self.direction_in,
|
|
54
|
+
'voll_id': self.voll_id,
|
|
55
|
+
'platform': self.platform,
|
|
48
56
|
})
|
|
49
57
|
|
|
50
58
|
def update(self, grpc_uri: Optional[str] = None) -> None:
|
|
@@ -66,6 +74,28 @@ class UserState:
|
|
|
66
74
|
|
|
67
75
|
user_state_client.delete_user_state(self.customer_id)
|
|
68
76
|
|
|
77
|
+
@classmethod
|
|
78
|
+
def get_user_state(cls, customer_id: str, grpc_uri: Optional[str] = None) -> 'UserState':
|
|
79
|
+
if grpc_uri is None:
|
|
80
|
+
grpc_uri = os.getenv('GRPC_URI')
|
|
81
|
+
user_state_client = UserStateServiceClient(grpc_uri)
|
|
82
|
+
|
|
83
|
+
response = user_state_client.select_user_state(user_id=customer_id)
|
|
84
|
+
|
|
85
|
+
if not response:
|
|
86
|
+
raise ValueError("Erro ao buscar estado do usuário.")
|
|
87
|
+
|
|
88
|
+
date = datetime.strptime(response.date, "%Y-%m-%d %H:%M:%S")
|
|
89
|
+
return cls(
|
|
90
|
+
customer_id=response.user_id,
|
|
91
|
+
menu=response.menu_id,
|
|
92
|
+
route=response.route,
|
|
93
|
+
obs=json.loads(response.obs),
|
|
94
|
+
direction_in=response.direction,
|
|
95
|
+
voll_id=response.voll_id,
|
|
96
|
+
platform=response.platform,
|
|
97
|
+
lst_update=date,
|
|
98
|
+
)
|
|
69
99
|
class UserCall:
|
|
70
100
|
"""
|
|
71
101
|
Representa uma mensagem recebida ou enviada pelo chatbot.
|
|
@@ -127,11 +157,11 @@ class UserCall:
|
|
|
127
157
|
|
|
128
158
|
elif isinstance(message, ListElements):
|
|
129
159
|
self.__send_list(
|
|
130
|
-
message.text,
|
|
131
|
-
message.title,
|
|
132
|
-
message.button_title,
|
|
133
|
-
message.
|
|
134
|
-
message.
|
|
160
|
+
text=message.text,
|
|
161
|
+
title=message.title,
|
|
162
|
+
button_title=message.button_title,
|
|
163
|
+
caption=message.caption,
|
|
164
|
+
element_list=message.elements,
|
|
135
165
|
)
|
|
136
166
|
else:
|
|
137
167
|
raise ValueError("Tipo de mensagem inválido.")
|
|
@@ -144,7 +174,7 @@ class UserCall:
|
|
|
144
174
|
{
|
|
145
175
|
"hook_id": self.company_phone,
|
|
146
176
|
"enterprise_id": self.customer_phone,
|
|
147
|
-
"unique_customer_id": self.__user_state.
|
|
177
|
+
"unique_customer_id": self.__user_state.voll_id,
|
|
148
178
|
"message_text": text,
|
|
149
179
|
"platform": self.channel,
|
|
150
180
|
}
|
|
@@ -167,7 +197,7 @@ class UserCall:
|
|
|
167
197
|
{
|
|
168
198
|
"hook_id": self.company_phone,
|
|
169
199
|
"enterprise_id": self.customer_phone,
|
|
170
|
-
"unique_customer_id": self.__user_state.
|
|
200
|
+
"unique_customer_id": self.__user_state.voll_id,
|
|
171
201
|
"message_text": text,
|
|
172
202
|
"button_title": title,
|
|
173
203
|
"message_caption": caption,
|
|
@@ -182,12 +212,15 @@ class UserCall:
|
|
|
182
212
|
def __send_list(
|
|
183
213
|
self,
|
|
184
214
|
text:str,
|
|
215
|
+
button_title: str,
|
|
185
216
|
title: str|None = None,
|
|
186
|
-
button_title: str|None = None,
|
|
187
217
|
element_list: list[dict] = None,
|
|
188
218
|
caption: str|None = None,
|
|
189
219
|
) -> None:
|
|
190
220
|
|
|
221
|
+
if not button_title:
|
|
222
|
+
raise NameError('Button Title é um parâmetro obrigatório!')
|
|
223
|
+
|
|
191
224
|
if len(element_list) > 20:
|
|
192
225
|
raise ValueError("O número máximo de elementos é 20.")
|
|
193
226
|
|
|
@@ -195,7 +228,7 @@ class UserCall:
|
|
|
195
228
|
{
|
|
196
229
|
"hook_id": self.company_phone,
|
|
197
230
|
"enterprise_id": self.customer_phone,
|
|
198
|
-
"unique_customer_id": self.__user_state.
|
|
231
|
+
"unique_customer_id": self.__user_state.voll_id,
|
|
199
232
|
"message_text": text,
|
|
200
233
|
"button_title": button_title,
|
|
201
234
|
"message_caption": caption,
|
|
@@ -213,6 +246,7 @@ class UserCall:
|
|
|
213
246
|
"hook_id": self.company_phone,
|
|
214
247
|
"enterprise_id": self.customer_phone,
|
|
215
248
|
"unique_customer_id": self.__user_state.customer_id,
|
|
249
|
+
"voll_id": self.__user_state.voll_id,
|
|
216
250
|
"message_text": message,
|
|
217
251
|
"platform": self.channel,
|
|
218
252
|
"campaign_name": campaign_name,
|
|
@@ -222,15 +256,15 @@ class UserCall:
|
|
|
222
256
|
if not response.status:
|
|
223
257
|
raise ValueError("Erro ao transferir chat para humano.")
|
|
224
258
|
|
|
225
|
-
def end_chat(self, message:str,
|
|
259
|
+
def end_chat(self, message:str, tabulation_name:str) -> None:
|
|
226
260
|
response = self.__wpp_server_client.end_chat(
|
|
227
261
|
{
|
|
262
|
+
"tabulation_name": tabulation_name,
|
|
228
263
|
"hook_id": self.company_phone,
|
|
229
|
-
"enterprise_id": self.customer_phone,
|
|
230
264
|
"unique_customer_id": self.__user_state.customer_id,
|
|
265
|
+
"voll_id": self.__user_state.voll_id,
|
|
231
266
|
"message_text": message,
|
|
232
267
|
"platform": self.channel,
|
|
233
|
-
"campaign_name": campaign_name,
|
|
234
268
|
}
|
|
235
269
|
)
|
|
236
270
|
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
-
# NO CHECKED-IN PROTOBUF GENCODE
|
|
4
|
-
# source: userstate.proto
|
|
5
|
-
# Protobuf Python Version: 5.27.2
|
|
6
|
-
"""Generated protocol buffer code."""
|
|
7
|
-
from google.protobuf import descriptor as _descriptor
|
|
8
|
-
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
9
|
-
from google.protobuf import runtime_version as _runtime_version
|
|
10
|
-
from google.protobuf import symbol_database as _symbol_database
|
|
11
|
-
from google.protobuf.internal import builder as _builder
|
|
12
|
-
_runtime_version.ValidateProtobufRuntimeVersion(
|
|
13
|
-
_runtime_version.Domain.PUBLIC,
|
|
14
|
-
5,
|
|
15
|
-
27,
|
|
16
|
-
2,
|
|
17
|
-
'',
|
|
18
|
-
'userstate.proto'
|
|
19
|
-
)
|
|
20
|
-
# @@protoc_insertion_point(imports)
|
|
21
|
-
|
|
22
|
-
_sym_db = _symbol_database.Default()
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0fuserstate.proto\x12\tuserstate\"\x06\n\x04Void\"j\n\tUserState\x12\x0f\n\x07user_id\x18\x01 \x01(\t\x12\x0f\n\x07menu_id\x18\x02 \x01(\t\x12\r\n\x05route\x18\x03 \x01(\t\x12\x0b\n\x03obs\x18\x04 \x01(\t\x12\x0c\n\x04\x64\x61te\x18\x05 \x01(\t\x12\x11\n\tdirection\x18\x06 \x01(\t\"\x1e\n\x0bUserStateId\x12\x0f\n\x07user_id\x18\x01 \x01(\t\"0\n\rRequestStatus\x12\x0e\n\x06status\x18\x01 \x01(\x08\x12\x0f\n\x07message\x18\x02 \x01(\t\";\n\x0eUserStatesList\x12)\n\x0buser_states\x18\x01 \x03(\x0b\x32\x14.userstate.UserState2\xde\x02\n\x10UserStateService\x12?\n\x0fSelectUserState\x12\x16.userstate.UserStateId\x1a\x14.userstate.UserState\x12\x41\n\x0fInsertUserState\x12\x14.userstate.UserState\x1a\x18.userstate.RequestStatus\x12\x41\n\x0fUpdateUserState\x12\x14.userstate.UserState\x1a\x18.userstate.RequestStatus\x12\x43\n\x0f\x44\x65leteUserState\x12\x16.userstate.UserStateId\x1a\x18.userstate.RequestStatus\x12>\n\x10GetAllUserStates\x12\x0f.userstate.Void\x1a\x19.userstate.UserStatesListB\x10Z\x0e./pb/userstateb\x06proto3')
|
|
28
|
-
|
|
29
|
-
_globals = globals()
|
|
30
|
-
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
31
|
-
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'userstate_pb2', _globals)
|
|
32
|
-
if not _descriptor._USE_C_DESCRIPTORS:
|
|
33
|
-
_globals['DESCRIPTOR']._loaded_options = None
|
|
34
|
-
_globals['DESCRIPTOR']._serialized_options = b'Z\016./pb/userstate'
|
|
35
|
-
_globals['_VOID']._serialized_start=30
|
|
36
|
-
_globals['_VOID']._serialized_end=36
|
|
37
|
-
_globals['_USERSTATE']._serialized_start=38
|
|
38
|
-
_globals['_USERSTATE']._serialized_end=144
|
|
39
|
-
_globals['_USERSTATEID']._serialized_start=146
|
|
40
|
-
_globals['_USERSTATEID']._serialized_end=176
|
|
41
|
-
_globals['_REQUESTSTATUS']._serialized_start=178
|
|
42
|
-
_globals['_REQUESTSTATUS']._serialized_end=226
|
|
43
|
-
_globals['_USERSTATESLIST']._serialized_start=228
|
|
44
|
-
_globals['_USERSTATESLIST']._serialized_end=287
|
|
45
|
-
_globals['_USERSTATESERVICE']._serialized_start=290
|
|
46
|
-
_globals['_USERSTATESERVICE']._serialized_end=640
|
|
47
|
-
# @@protoc_insertion_point(module_scope)
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
-
# NO CHECKED-IN PROTOBUF GENCODE
|
|
4
|
-
# source: voll.proto
|
|
5
|
-
# Protobuf Python Version: 5.27.2
|
|
6
|
-
"""Generated protocol buffer code."""
|
|
7
|
-
from google.protobuf import descriptor as _descriptor
|
|
8
|
-
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
9
|
-
from google.protobuf import runtime_version as _runtime_version
|
|
10
|
-
from google.protobuf import symbol_database as _symbol_database
|
|
11
|
-
from google.protobuf.internal import builder as _builder
|
|
12
|
-
_runtime_version.ValidateProtobufRuntimeVersion(
|
|
13
|
-
_runtime_version.Domain.PUBLIC,
|
|
14
|
-
5,
|
|
15
|
-
27,
|
|
16
|
-
2,
|
|
17
|
-
'',
|
|
18
|
-
'voll.proto'
|
|
19
|
-
)
|
|
20
|
-
# @@protoc_insertion_point(imports)
|
|
21
|
-
|
|
22
|
-
_sym_db = _symbol_database.Default()
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\nvoll.proto\x12\x0bmessagevoll\"\x06\n\x04Void\"\x9d\x02\n\x0eMessageRequest\x12\x0f\n\x07hook_id\x18\x01 \x01(\t\x12\x15\n\renterprise_id\x18\x02 \x01(\t\x12\x1a\n\x12unique_customer_id\x18\x03 \x01(\t\x12\x15\n\rmessage_title\x18\x04 \x01(\t\x12\x14\n\x0cmessage_text\x18\x05 \x01(\t\x12\x10\n\x08platform\x18\x06 \x01(\t\x12\x17\n\x0fmessage_caption\x18\x07 \x01(\t\x12\x14\n\x0c\x62utton_title\x18\x08 \x01(\t\x12\x15\n\rcampaign_name\x18\t \x01(\t\x12\x17\n\x0ftabulation_name\x18\n \x01(\t\x12)\n\x07options\x18\x0b \x03(\x0b\x32\x18.messagevoll.QuickOption\"2\n\x0fMessageResponse\x12\x0e\n\x06status\x18\x01 \x01(\x08\x12\x0f\n\x07message\x18\x02 \x01(\t\"1\n\x0bQuickOption\x12\r\n\x05title\x18\x01 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\"%\n\x0c\x43\x61mpaignName\x12\x15\n\rcampaign_name\x18\x01 \x01(\t\")\n\x0eTabulationName\x12\x17\n\x0ftabulation_name\x18\x01 \x01(\t\"=\n\x0f\x43\x61mpaignDetails\x12\x15\n\rcampaign_name\x18\x01 \x01(\t\x12\x13\n\x0b\x63\x61mpaign_id\x18\x02 \x01(\t\"R\n\x0f\x43\x61mpaignElement\x12\x13\n\x0b\x63\x61mpaign_id\x18\x01 \x01(\t\x12\x15\n\rcampaign_name\x18\x02 \x01(\t\x12\x13\n\x0blast_update\x18\x03 \x01(\t\"@\n\rCampaignsList\x12/\n\tcampaigns\x18\x01 \x03(\x0b\x32\x1c.messagevoll.CampaignElement\"C\n\x11TabulationDetails\x12\x17\n\x0ftabulation_name\x18\x01 \x01(\t\x12\x15\n\rtabulation_id\x18\x02 \x01(\t\"\xa9\x01\n\x11TabulationElement\x12\x15\n\rtabulation_id\x18\x01 \x01(\t\x12\x17\n\x0ftabulation_name\x18\x02 \x01(\t\x12\x17\n\x0ftabulation_type\x18\x03 \x01(\t\x12\x12\n\ngroup_name\x18\x04 \x01(\t\x12\"\n\x1a\x63ustomer_service_survey_id\x18\x05 \x01(\t\x12\x13\n\x0blast_update\x18\x06 \x01(\t\"F\n\x0fTabulationsList\x12\x33\n\x0btabulations\x18\x01 \x03(\x0b\x32\x1e.messagevoll.TabulationElement2\xfb\x02\n\x0eMessageService\x12G\n\nSendButton\x12\x1b.messagevoll.MessageRequest\x1a\x1c.messagevoll.MessageResponse\x12\x45\n\x08SendList\x12\x1b.messagevoll.MessageRequest\x1a\x1c.messagevoll.MessageResponse\x12\x45\n\x08SendText\x12\x1b.messagevoll.MessageRequest\x1a\x1c.messagevoll.MessageResponse\x12L\n\x0fTransferToHuman\x12\x1b.messagevoll.MessageRequest\x1a\x1c.messagevoll.MessageResponse\x12\x44\n\x07\x45ndChat\x12\x1b.messagevoll.MessageRequest\x1a\x1c.messagevoll.MessageResponse2\xb4\x02\n\x0e\x41\x63tionsService\x12H\n\rGetCampaignID\x12\x19.messagevoll.CampaignName\x1a\x1c.messagevoll.CampaignDetails\x12\x41\n\x10GetCampaignsList\x12\x11.messagevoll.Void\x1a\x1a.messagevoll.CampaignsList\x12N\n\x0fGetTabulationID\x12\x1b.messagevoll.TabulationName\x1a\x1e.messagevoll.TabulationDetails\x12\x45\n\x12GetTabulationsList\x12\x11.messagevoll.Void\x1a\x1c.messagevoll.TabulationsListB\x12Z\x10./pb/messagevollb\x06proto3')
|
|
28
|
-
|
|
29
|
-
_globals = globals()
|
|
30
|
-
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
31
|
-
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'voll_pb2', _globals)
|
|
32
|
-
if not _descriptor._USE_C_DESCRIPTORS:
|
|
33
|
-
_globals['DESCRIPTOR']._loaded_options = None
|
|
34
|
-
_globals['DESCRIPTOR']._serialized_options = b'Z\020./pb/messagevoll'
|
|
35
|
-
_globals['_VOID']._serialized_start=27
|
|
36
|
-
_globals['_VOID']._serialized_end=33
|
|
37
|
-
_globals['_MESSAGEREQUEST']._serialized_start=36
|
|
38
|
-
_globals['_MESSAGEREQUEST']._serialized_end=321
|
|
39
|
-
_globals['_MESSAGERESPONSE']._serialized_start=323
|
|
40
|
-
_globals['_MESSAGERESPONSE']._serialized_end=373
|
|
41
|
-
_globals['_QUICKOPTION']._serialized_start=375
|
|
42
|
-
_globals['_QUICKOPTION']._serialized_end=424
|
|
43
|
-
_globals['_CAMPAIGNNAME']._serialized_start=426
|
|
44
|
-
_globals['_CAMPAIGNNAME']._serialized_end=463
|
|
45
|
-
_globals['_TABULATIONNAME']._serialized_start=465
|
|
46
|
-
_globals['_TABULATIONNAME']._serialized_end=506
|
|
47
|
-
_globals['_CAMPAIGNDETAILS']._serialized_start=508
|
|
48
|
-
_globals['_CAMPAIGNDETAILS']._serialized_end=569
|
|
49
|
-
_globals['_CAMPAIGNELEMENT']._serialized_start=571
|
|
50
|
-
_globals['_CAMPAIGNELEMENT']._serialized_end=653
|
|
51
|
-
_globals['_CAMPAIGNSLIST']._serialized_start=655
|
|
52
|
-
_globals['_CAMPAIGNSLIST']._serialized_end=719
|
|
53
|
-
_globals['_TABULATIONDETAILS']._serialized_start=721
|
|
54
|
-
_globals['_TABULATIONDETAILS']._serialized_end=788
|
|
55
|
-
_globals['_TABULATIONELEMENT']._serialized_start=791
|
|
56
|
-
_globals['_TABULATIONELEMENT']._serialized_end=960
|
|
57
|
-
_globals['_TABULATIONSLIST']._serialized_start=962
|
|
58
|
-
_globals['_TABULATIONSLIST']._serialized_end=1032
|
|
59
|
-
_globals['_MESSAGESERVICE']._serialized_start=1035
|
|
60
|
-
_globals['_MESSAGESERVICE']._serialized_end=1414
|
|
61
|
-
_globals['_ACTIONSSERVICE']._serialized_start=1417
|
|
62
|
-
_globals['_ACTIONSSERVICE']._serialized_end=1725
|
|
63
|
-
# @@protoc_insertion_point(module_scope)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|