def send_text_message(subject, message, users=None, roles=None): text = Text(message) message = Message(subject=subject, body=[text]) send_message(message, users=users, roles=roles)
def set_message_subject(message, subject): message = Message.from_json(message) message.subject = subject return message.as_json()
def send_full_message(message, users=None, roles=None): message = Message.from_json(message) send_message(message, users=users, roles=roles) return 'success'
def append_accept_decline_message_component(message): message = Message.from_json(message) message.append(AcceptDecline()) return message.as_json()
def combine_messages(message1, message2): message1 = Message.from_json(message1) message1 += Message.from_json(message2) return message1.as_json()
def append_text_message_component(message, text): message = Message.from_json(message) message.append(Text(text)) return message.as_json()
def append_url_message_component(message, url, title=None): message = Message.from_json(message) message.append(Url(url, title=title)) return message.as_json()
def basic_request_user_approval(users=None, roles=None): text = Text('A workflow requires your authentication') message = Message(subject='Workflow awaiting approval', body=[text, AcceptDecline()]) send_message(message, users=users, roles=roles) return 'success'
def create_empty_message(subject=None): return Message(subject=subject).as_json()
def send_notif(subject, contents): text = Text(contents) message = Message(subject=subject, body=[text]) send_message(message, users=store.users_to_notify, roles=store.roles_to_notify)