From 989ea5ffbc3722034c4629c62c7d55434971b715 Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Sun, 6 Oct 2013 13:27:15 -0400 Subject: [PATCH] Provide more info in support requests. Have the Feedback Bot provide the sender's full name. Put the email in the message to help searching. Generate a ticket number to make it easier to refer to the message from elsewhere. (imported from commit 4d789135a0097bade50b4d980f49ca596d85b73b) --- bots/feedback-bot | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/bots/feedback-bot b/bots/feedback-bot index dc2cfa2..749f43f 100755 --- a/bots/feedback-bot +++ b/bots/feedback-bot @@ -45,20 +45,44 @@ staging_client = zulip.Client( verbose=True, site="https://staging.zulip.com/api") +def get_ticket_number(): + fn = '/var/tmp/.feedback-bot-ticket-number' + try: + ticket_number = int(open(fn).read()) + 1 + except: + ticket_number = 1 + open(fn, 'w').write('%d' % ticket_number) + return ticket_number + def forward_message(message): if message["type"] != "private" or len(message["display_recipient"]) != 2: return + if "sender_domain" in message: subject = "feedback: %s (%s)" % (message["sender_email"], message["sender_domain"]) else: subject = "feedback from %s" % message["sender_email"], if len(subject) > 60: subject = subject[:57].rstrip() + "..." + + ticket_number = get_ticket_number() + content = '@support, Please ack this new request.' + content += '\n~~~' + content += '\nticket Z%03d' % (ticket_number,) + content += '\nsender: %s' % (message['sender_full_name'],) + content += '\nemail: %s' % (message['sender_email'],) + if 'sender_domain' in message: + content += '\nrealm: %s' % (message['sender_domain'],) + content += '\n~~~' + + content += '\n\n' + content += message['content'] + forwarded_message = { "type": "stream", "to": "support", "subject": subject, - "content": message["content"], + "content": content, } staging_client.send_message(forwarded_message) logging.info("Forwarded feedback from %s" % (message["sender_email"],))