Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resend Broadcast #1267

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions kairon/api/app/routers/bot/channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,19 @@ async def add_message_broadcast_event(
return Response(message="Broadcast added!", data={"msg_broadcast_id": notification_id})


@router.post("/broadcast/message/resend/{msg_broadcast_id}", response_model=Response)
async def resend_message_broadcast_event(
msg_broadcast_id: str,
current_user: User = Security(Authentication.get_current_user_and_bot, scopes=DESIGNER_ACCESS)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid function call Security in argument defaults.

Move the Security function call inside the function.

-        current_user: User = Security(Authentication.get_current_user_and_bot, scopes=DESIGNER_ACCESS)
+        current_user: User = Depends(lambda: Security(Authentication.get_current_user_and_bot, scopes=DESIGNER_ACCESS))
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
current_user: User = Security(Authentication.get_current_user_and_bot, scopes=DESIGNER_ACCESS)
current_user: User = Depends(lambda: Security(Authentication.get_current_user_and_bot, scopes=DESIGNER_ACCESS))
Tools
Ruff

188-188: Do not perform function call Security in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable

(B008)

):
"""
Resends a scheduled message broadcast.
"""
event = MessageBroadcastEvent(current_user.get_bot(), current_user.get_user())
event.enqueue(EventRequestType.resend_broadcast.value, msg_broadcast_id=msg_broadcast_id)
return Response(message="Resending Broadcast!")


@router.put("/broadcast/message/{msg_broadcast_id}", response_model=Response)
async def update_message_broadcast_event(
msg_broadcast_id: str, request: MessageBroadcastRequest,
Expand Down
30 changes: 23 additions & 7 deletions kairon/events/definitions/message_broadcast.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,15 @@ def execute(self, event_id: Text, **kwargs):
reference_id = None
status = EVENT_STATUS.FAIL.value
exception = None
is_resend = kwargs.get('is_resend', False)
try:
config, reference_id = self.__retrieve_config(event_id)
config, reference_id = self.__retrieve_config(event_id, is_resend)
broadcast = MessageBroadcastFactory.get_instance(config["connector_type"]).from_config(config, event_id, reference_id)
recipients = broadcast.get_recipients()
broadcast.send(recipients)
if is_resend:
broadcast.resend_broadcast()
Comment on lines +53 to +58
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace typing.Text with str and approve changes.

typing.Text is deprecated. Use str instead.

-    def execute(self, event_id: Text, **kwargs):
+    def execute(self, event_id: str, **kwargs):

The addition of the is_resend parameter is consistent with the new functionality.

Committable suggestion was skipped due to low confidence.

else:
recipients = broadcast.get_recipients()
broadcast.send(recipients)
status = EVENT_STATUS.COMPLETED.value
except Exception as e:
logger.exception(e)
Expand Down Expand Up @@ -99,6 +103,16 @@ def _add_schedule(self, config: Dict):
MessageBroadcastProcessor.delete_task(msg_broadcast_id, self.bot)
raise AppException(e)

def _resend_broadcast(self, msg_broadcast_id: Text):
try:
payload = {'bot': self.bot, 'user': self.user,
"event_id": msg_broadcast_id, "is_resend": True}
Utility.request_event_server(EventClass.message_broadcast, payload)
return msg_broadcast_id
except Exception as e:
logger.error(e)
raise e
Comment on lines +106 to +114
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace typing.Text with str.

typing.Text is deprecated. Use str instead.

-    def _resend_broadcast(self, msg_broadcast_id: Text):
+    def _resend_broadcast(self, msg_broadcast_id: str):
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
def _resend_broadcast(self, msg_broadcast_id: Text):
try:
payload = {'bot': self.bot, 'user': self.user,
"event_id": msg_broadcast_id, "is_resend": True}
Utility.request_event_server(EventClass.message_broadcast, payload)
return msg_broadcast_id
except Exception as e:
logger.error(e)
raise e
def _resend_broadcast(self, msg_broadcast_id: str):
try:
payload = {'bot': self.bot, 'user': self.user,
"event_id": msg_broadcast_id, "is_resend": True}
Utility.request_event_server(EventClass.message_broadcast, payload)
return msg_broadcast_id
except Exception as e:
logger.error(e)
raise e
Tools
Ruff

106-106: typing.Text is deprecated, use str

Replace with str

(UP019)


def _update_schedule(self, msg_broadcast_id: Text, config: Dict):
settings_updated = False
current_settings = {}
Expand Down Expand Up @@ -130,13 +144,15 @@ def delete_schedule(self, msg_broadcast_id: Text):
logger.error(e)
raise e

def __retrieve_config(self, event_id: Text):
reference_id = ObjectId().__str__()
config = MessageBroadcastProcessor.get_settings(event_id, self.bot)
def __retrieve_config(self, event_id: Text, is_resend: bool):

reference_id = MessageBroadcastProcessor.get_reference_id_from_broadcasting_logs(event_id) \
if is_resend else ObjectId().__str__()
config = MessageBroadcastProcessor.get_settings(event_id, self.bot, is_resend=is_resend)
bot_settings = MongoProcessor.get_bot_settings(self.bot, self.user)
config["pyscript_timeout"] = bot_settings["dynamic_broadcast_execution_timeout"]
MessageBroadcastProcessor.add_event_log(
self.bot, MessageBroadcastLogType.common.value, reference_id, user=self.user, config=config,
status=EVENT_STATUS.INPROGRESS.value, event_id=event_id, is_new_log=True
status=EVENT_STATUS.INPROGRESS.value, event_id=event_id, is_new_log=True, is_resend=is_resend
Comment on lines +147 to +156
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace typing.Text with str and approve changes.

typing.Text is deprecated. Use str instead.

-    def __retrieve_config(self, event_id: Text, is_resend: bool):
+    def __retrieve_config(self, event_id: str, is_resend: bool):

The addition of the is_resend parameter is consistent with the new functionality.

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
def __retrieve_config(self, event_id: Text, is_resend: bool):
reference_id = MessageBroadcastProcessor.get_reference_id_from_broadcasting_logs(event_id) \
if is_resend else ObjectId().__str__()
config = MessageBroadcastProcessor.get_settings(event_id, self.bot, is_resend=is_resend)
bot_settings = MongoProcessor.get_bot_settings(self.bot, self.user)
config["pyscript_timeout"] = bot_settings["dynamic_broadcast_execution_timeout"]
MessageBroadcastProcessor.add_event_log(
self.bot, MessageBroadcastLogType.common.value, reference_id, user=self.user, config=config,
status=EVENT_STATUS.INPROGRESS.value, event_id=event_id, is_new_log=True
status=EVENT_STATUS.INPROGRESS.value, event_id=event_id, is_new_log=True, is_resend=is_resend
def __retrieve_config(self, event_id: str, is_resend: bool):
reference_id = MessageBroadcastProcessor.get_reference_id_from_broadcasting_logs(event_id) \
if is_resend else ObjectId().__str__()
config = MessageBroadcastProcessor.get_settings(event_id, self.bot, is_resend=is_resend)
bot_settings = MongoProcessor.get_bot_settings(self.bot, self.user)
config["pyscript_timeout"] = bot_settings["dynamic_broadcast_execution_timeout"]
MessageBroadcastProcessor.add_event_log(
self.bot, MessageBroadcastLogType.common.value, reference_id, user=self.user, config=config,
status=EVENT_STATUS.INPROGRESS.value, event_id=event_id, is_new_log=True, is_resend=is_resend
Tools
Ruff

147-147: typing.Text is deprecated, use str

Replace with str

(UP019)

)
return config, reference_id
7 changes: 6 additions & 1 deletion kairon/events/definitions/scheduled_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ def enqueue(self, event_request_type: Text, **kwargs):
request_implementation = {
EventRequestType.trigger_async.value: self._trigger_async,
EventRequestType.add_schedule.value: self._add_schedule,
EventRequestType.update_schedule.value: self._update_schedule
EventRequestType.update_schedule.value: self._update_schedule,
EventRequestType.resend_broadcast.value: self._resend_broadcast
Comment on lines +18 to +19
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove .keys() for dictionary lookup.

Use if event_request_type not in request_implementation instead of if event_request_type not in request_implementation.keys() for better performance.

-        if event_request_type not in request_implementation.keys():
+        if event_request_type not in request_implementation:
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
EventRequestType.update_schedule.value: self._update_schedule,
EventRequestType.resend_broadcast.value: self._resend_broadcast
EventRequestType.update_schedule.value: self._update_schedule,
EventRequestType.resend_broadcast.value: self._resend_broadcast
if event_request_type not in request_implementation:

}
if event_request_type not in request_implementation.keys():
raise AppException(f"'{event_request_type}' is not a valid event server request!")
Expand All @@ -34,6 +35,10 @@ def _add_schedule(self, config: Dict):
def _update_schedule(self, msg_broadcast_id: Text, config: Dict):
raise NotImplementedError("Provider not implemented")

@abstractmethod
def _resend_broadcast(self, msg_broadcast_id: Text):
raise NotImplementedError("Provider not implemented")
Comment on lines +39 to +40
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace typing.Text with str.

typing.Text is deprecated. Use str instead.

-    def _resend_broadcast(self, msg_broadcast_id: Text):
+    def _resend_broadcast(self, msg_broadcast_id: str):
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
def _resend_broadcast(self, msg_broadcast_id: Text):
raise NotImplementedError("Provider not implemented")
def _resend_broadcast(self, msg_broadcast_id: str):
raise NotImplementedError("Provider not implemented")
Tools
Ruff

39-39: typing.Text is deprecated, use str

Replace with str

(UP019)


@abstractmethod
def delete_schedule(self, msg_broadcast_id: Text):
raise NotImplementedError("Provider not implemented")
39 changes: 35 additions & 4 deletions kairon/shared/channels/broadcast/whatsapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def send(self, recipients: List, **kwargs):
else:
self.__send_using_pyscript()

def __send_using_pyscript(self):
def __send_using_pyscript(self, **kwargs):
from kairon.shared.concurrency.orchestrator import ActorOrchestrator

script = self.config['pyscript']
Expand All @@ -62,7 +62,8 @@ def send_msg(template_id: Text, recipient, language_code: Text = "en", component
MessageBroadcastProcessor.add_event_log(
self.bot, MessageBroadcastLogType.send.value, self.reference_id, api_response=response,
status=status, recipient=recipient, template_params=components, template=raw_template,
event_id=self.event_id, template_name=template_id
event_id=self.event_id, template_name=template_id, language_code=language_code, namespace=namespace,
resend_count=0
)

return response
Expand Down Expand Up @@ -107,21 +108,51 @@ def __send_using_configuration(self, recipients: List):
for recipient, t_params in zip(recipients, template_params):
recipient = str(recipient) if recipient else ""
if not Utility.check_empty_string(recipient):
response = channel_client.send_template_message(template_id, recipient, lang, t_params, namespace=namespace)
response = channel_client.send_template_message(template_id, recipient, lang, t_params,
namespace=namespace)
status = "Failed" if response.get("errors") else "Success"
if status == "Failed":
failure_cnt = failure_cnt + 1

MessageBroadcastProcessor.add_event_log(
self.bot, MessageBroadcastLogType.send.value, self.reference_id, api_response=response,
status=status, recipient=recipient, template_params=t_params, template=raw_template,
event_id=self.event_id, template_name=template_id
event_id=self.event_id, template_name=template_id, language_code=lang, namespace=namespace,
resend_count=0
)
MessageBroadcastProcessor.add_event_log(
self.bot, MessageBroadcastLogType.common.value, self.reference_id, failure_cnt=failure_cnt, total=total,
event_id=self.event_id, **evaluation_log
)

def resend_broadcast(self):
channel_client = self.__get_client()

message_broadcast_logs, resend_count = MessageBroadcastProcessor.extract_message_ids_from_broadcast_logs(self.reference_id)

required_logs = [log for log in message_broadcast_logs.values() if log["errors"]]
codes_to_exclude = Utility.environment["channels"]["360dialog"]["error_codes"]
required_logs = [log for log in required_logs if log["errors"][0]["code"] not in codes_to_exclude]

for log in required_logs:
template_id = log["template_name"]
namespace = log["namespace"]
language_code = log["language_code"]
components = log["template_params"]
recipient = log["recipient"]
template = log["template"]
resend_count = log["resend_count"] + 1
response = channel_client.send_template_message(template_id, recipient, language_code, components,
namespace)
status = "Failed" if response.get("error") else "Success"

MessageBroadcastProcessor.add_event_log(
self.bot, MessageBroadcastLogType.send.value, self.reference_id, api_response=response,
status=status, recipient=recipient, template_params=components, template=template,
event_id=self.event_id, template_name=template_id, language_code=language_code, namespace=namespace,
resend_count=resend_count
)

def __get_client(self):
try:
bot_settings = MongoProcessor.get_bot_settings(self.bot, self.user)
Expand Down
1 change: 1 addition & 0 deletions kairon/shared/chat/broadcast/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ class MessageBroadcastLogType(str, Enum):
class MessageBroadcastType(str, Enum):
static = "static"
dynamic = "dynamic"

51 changes: 38 additions & 13 deletions kairon/shared/chat/broadcast/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@
class MessageBroadcastProcessor:

@staticmethod
def get_settings(notification_id: Text, bot: Text):
def get_settings(notification_id: Text, bot: Text, **kwargs):
try:
settings = MessageBroadcastSettings.objects(id=notification_id, bot=bot, status=True).get()
status = not kwargs.get("is_resend", False)
settings = MessageBroadcastSettings.objects(id=notification_id, bot=bot, status=status).get()
Comment on lines +21 to +24
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace typing.Text with str and approve changes.

typing.Text is deprecated. Use str instead.

-    def get_settings(notification_id: Text, bot: Text, **kwargs):
+    def get_settings(notification_id: str, bot: str, **kwargs):

The addition of the is_resend parameter is consistent with the new functionality.

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
def get_settings(notification_id: Text, bot: Text, **kwargs):
try:
settings = MessageBroadcastSettings.objects(id=notification_id, bot=bot, status=True).get()
status = not kwargs.get("is_resend", False)
settings = MessageBroadcastSettings.objects(id=notification_id, bot=bot, status=status).get()
def get_settings(notification_id: str, bot: str, **kwargs):
try:
status = not kwargs.get("is_resend", False)
settings = MessageBroadcastSettings.objects(id=notification_id, bot=bot, status=status).get()
Tools
Ruff

21-21: typing.Text is deprecated, use str

Replace with str

(UP019)


21-21: typing.Text is deprecated, use str

Replace with str

(UP019)

settings = settings.to_mongo().to_dict()
settings["_id"] = settings["_id"].__str__()
return settings
Expand Down Expand Up @@ -81,10 +82,12 @@ def delete_task(notification_id: Text, bot: Text, delete_permanently: bool = Tru

@staticmethod
def add_event_log(bot: Text, log_type: Text, reference_id: Text = None, status: Text = None, **kwargs):
event_completion_states = [EVENT_STATUS.FAIL.value, EVENT_STATUS.COMPLETED.value]
is_new_log = log_type in {MessageBroadcastLogType.send.value, MessageBroadcastLogType.self.value} or kwargs.pop("is_new_log", None)
is_resend = kwargs.pop("is_resend", False)
event_completion_states = [] if is_resend else [EVENT_STATUS.FAIL.value, EVENT_STATUS.COMPLETED.value]
is_new_log = log_type in {MessageBroadcastLogType.send.value,
MessageBroadcastLogType.self.value} or kwargs.pop("is_new_log", None)
Comment on lines 84 to +88
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace typing.Text with str and approve changes.

typing.Text is deprecated. Use str instead.

-    def add_event_log(bot: Text, log_type: Text, reference_id: Text = None, status: Text = None, **kwargs):
+    def add_event_log(bot: str, log_type: str, reference_id: str = None, status: str = None, **kwargs):

The addition of the is_resend parameter is consistent with the new functionality.

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
def add_event_log(bot: Text, log_type: Text, reference_id: Text = None, status: Text = None, **kwargs):
event_completion_states = [EVENT_STATUS.FAIL.value, EVENT_STATUS.COMPLETED.value]
is_new_log = log_type in {MessageBroadcastLogType.send.value, MessageBroadcastLogType.self.value} or kwargs.pop("is_new_log", None)
is_resend = kwargs.pop("is_resend", False)
event_completion_states = [] if is_resend else [EVENT_STATUS.FAIL.value, EVENT_STATUS.COMPLETED.value]
is_new_log = log_type in {MessageBroadcastLogType.send.value,
MessageBroadcastLogType.self.value} or kwargs.pop("is_new_log", None)
def add_event_log(bot: str, log_type: str, reference_id: str = None, status: str = None, **kwargs):
is_resend = kwargs.pop("is_resend", False)
event_completion_states = [] if is_resend else [EVENT_STATUS.FAIL.value, EVENT_STATUS.COMPLETED.value]
is_new_log = log_type in {MessageBroadcastLogType.send.value,
MessageBroadcastLogType.self.value} or kwargs.pop("is_new_log", None)
Tools
Ruff

84-84: typing.Text is deprecated, use str

Replace with str

(UP019)


84-84: typing.Text is deprecated, use str

Replace with str

(UP019)


84-84: typing.Text is deprecated, use str

Replace with str

(UP019)


84-84: typing.Text is deprecated, use str

Replace with str

(UP019)

try:
if is_new_log:
if is_new_log and not is_resend:
raise DoesNotExist()
log = MessageBroadcastLogs.objects(bot=bot, reference_id=reference_id, log_type=log_type,
status__nin=event_completion_states).get()
Expand All @@ -108,18 +111,34 @@ def get_broadcast_logs(bot: Text, start_idx: int = 0, page_size: int = 10, **kwa
logs = json.loads(logs)
return logs, total_count

@staticmethod
def get_reference_id_from_broadcasting_logs(event_id):
log = MessageBroadcastLogs.objects(event_id=event_id, log_type=MessageBroadcastLogType.common.value).get()
return log.reference_id

@staticmethod
def get_recent_broadcasting_logs(message_broadcast_logs):
recent_logs, max_resend_count = [], 0
if message_broadcast_logs:
max_resend_count = max(log["resend_count"] for log in message_broadcast_logs)
recent_logs = [log for log in message_broadcast_logs if log["resend_count"] == max_resend_count]

return recent_logs, max_resend_count

@staticmethod
def extract_message_ids_from_broadcast_logs(reference_id: Text):
message_broadcast_logs = MessageBroadcastLogs.objects(reference_id=reference_id,
log_type=MessageBroadcastLogType.send.value)
broadcast_logs = MessageBroadcastLogs.objects(reference_id=reference_id,
log_type=MessageBroadcastLogType.send.value)

message_broadcast_logs, resend_count = MessageBroadcastProcessor.get_recent_broadcasting_logs(broadcast_logs)
broadcast_logs = {
message['id']: log
for log in message_broadcast_logs
if log.api_response and log.api_response.get('messages', [])
for message in log.api_response['messages']
if message['id']
}
return broadcast_logs
return broadcast_logs, resend_count

@staticmethod
def get_db_client(bot: Text):
Expand All @@ -146,7 +165,8 @@ def log_broadcast_in_conversation_history(template_id, contact: Text, template_p
})

@staticmethod
def __add_broadcast_logs_status_and_errors(reference_id: Text, campaign_name: Text, broadcast_logs: Dict[Text, Document]):
def __add_broadcast_logs_status_and_errors(reference_id: Text, campaign_name: Text,
broadcast_logs: Dict[Text, Document], resend_count: int = 0):
message_ids = list(broadcast_logs.keys())
channel_logs = ChannelLogs.objects(message_id__in=message_ids, type=ChannelTypes.WHATSAPP.value)
for log in channel_logs:
Expand All @@ -155,23 +175,28 @@ def __add_broadcast_logs_status_and_errors(reference_id: Text, campaign_name: Te
client = MessageBroadcastProcessor.get_db_client(broadcast_log['bot'])
if log['errors']:
status = "Failed"
broadcast_log.update(errors=log['errors'], status="Failed")
errors = log['errors']
else:
status = "Success"
errors = []
broadcast_log.update(errors=errors, status=status)

MessageBroadcastProcessor.log_broadcast_in_conversation_history(
template_id=broadcast_log['template_name'], contact=broadcast_log['recipient'],
template_params=broadcast_log['template_params'], template=broadcast_log['template'],
status=status, mongo_client=client
)

ChannelLogs.objects(message_id__in=message_ids, type=ChannelTypes.WHATSAPP.value).update(campaign_id=reference_id, campaign_name=campaign_name)
ChannelLogs.objects(message_id__in=message_ids, type=ChannelTypes.WHATSAPP.value).update(
campaign_id=reference_id, campaign_name=campaign_name, resend_count=resend_count
)

@staticmethod
def insert_status_received_on_channel_webhook(reference_id: Text, broadcast_name: Text):
broadcast_logs = MessageBroadcastProcessor.extract_message_ids_from_broadcast_logs(reference_id)
broadcast_logs, resend_count = MessageBroadcastProcessor.extract_message_ids_from_broadcast_logs(reference_id)
if broadcast_logs:
MessageBroadcastProcessor.__add_broadcast_logs_status_and_errors(reference_id, broadcast_name, broadcast_logs)
MessageBroadcastProcessor.__add_broadcast_logs_status_and_errors(reference_id, broadcast_name,
broadcast_logs, resend_count)
Comment on lines +196 to +199
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace typing.Text with str.

typing.Text is deprecated. Use str instead.

-    def insert_status_received_on_channel_webhook(reference_id: Text, broadcast_name: Text):
+    def insert_status_received_on_channel_webhook(reference_id: str, broadcast_name: str):

Committable suggestion was skipped due to low confidence.


@staticmethod
def get_channel_metrics(channel_type: Text, bot: Text):
Expand Down
1 change: 1 addition & 0 deletions kairon/shared/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ class EventRequestType(str, Enum):
trigger_async = "trigger_async"
update_schedule = "update_schedule"
add_schedule = "add_schedule"
resend_broadcast = "resend_broadcast"


class DataGeneratorCliTypes(str, Enum):
Expand Down
1 change: 1 addition & 0 deletions system.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ channels:
partner_id: ${360_DIALOG_PARTNER_ID}
partner_username: ${360_DIALOG_PARTNER_USERNAME}
partner_password: ${360DIALOG_PARTNER_PASSWORD}
error_codes: ${ERROR_CODES:[131026,131021,131047,131052]}
instagram:
static_comment_reply: ${INSTA_STATIC_COMMENT_REPLY:Thanks for reaching us, please check your inbox}
llm:
Expand Down
Loading
Loading