Last active
April 14, 2020 16:57
-
-
Save lfowlie/41beeb90e5151cbb59994f952b6a6682 to your computer and use it in GitHub Desktop.
Conversation Definition Examples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Communication ## | |
OPT_IN_FLOW = [ReceiveMessageStep('START'), UpdateOptedOutStatus(False), SendMessageStep(MessageType.ON_BOARDING_MESSAGE)] | |
OPT_OUT_FLOW = [ReceiveMessageStep('STOP'), UpdateOptedOutStatus(True), SendMessageStep(MessageType.STOP_MESSAGE)] | |
HELP_FLOW = [ReceiveMessageStep('HELP'), SendMessageStep(MessageType.HELP_MESSAGE)] | |
## Rescheduling ## | |
_skip_message_branch = [SKIP_RESCHEDULE_APPOINTMENT, SendMessageStep(MessageType.SKIP_MESSAGE)] | |
RESCHEDULE_FLOW = [ | |
SendMessageStep(MessageType.APPOINTMENT_AVAILABLE_MESSAGE), | |
ReceiveMessageStep(['YES', 'SKIP', 'NO']), | |
ConversationBranch({ | |
'YES': [ | |
ACCEPT_RESCHEDULE_APPOINTMENT, | |
ConversationBranch({ | |
'True': [SendMessageStep(MessageType.CONFIRMATION_MESSAGE)], | |
'False': [SendMessageStep(MessageType.APPOINTMENT_UNAVAILABLE_MESSAGE)] | |
}) | |
], | |
'SKIP': _skip_message_branch, | |
'NO': [ | |
DECLINE_RESCHEDULE_APPOINTMENT, | |
SendMessageStep(MessageType.ORIGINAL_APPOINTMENT_UNCHANGED_MESSAGE), | |
ReceiveMessageStep('SKIP'), | |
*_skip_message_branch | |
], | |
}) | |
] | |
## ARC ## | |
_confirmation_branch = [ | |
ReceiveMessageStep(['CONFIRM', 'CANCEL']), | |
ConversationBranch({ | |
'CONFIRM': [ | |
CONFIRM_APPOINTMENT, | |
SendMessageStep(MessageType.APPOINTMENT_CONFIRMATION_ACKNOWLEDGED_MESSAGE) | |
], | |
'CANCEL': [ | |
CANCEL_APPOINTMENT, | |
ConversationBranch({ | |
'True': [SendMessageStep(MessageType.CANCEL_APPOINTMENT_MESSAGE)], | |
'False': [SendMessageStep(MessageType.CANCELLATION_REDIRECT_TO_OFFICE_MESSAGE)] | |
}) | |
], | |
}) | |
] | |
CONFIRM_FLOW = [SendMessageStep(MessageType.APPOINTMENT_CONFIRMATION_PROMPT_MESSAGE), *_confirmation_branch] | |
REMIND_FLOW = [SendMessageStep(MessageType.APPOINTMENT_REMINDER_MESSAGE), *_confirmation_branch] | |
## Virtual Visits ## | |
def virtual_visit_flow(message_type: MessageType): | |
return [SendMessageStep(message_type)] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment