zulip/api/bots/feedback-bot

29 lines
1.0 KiB
Python
Executable File

#!/usr/bin/python
import sys
import os
import optparse
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
import api.common
prod_client = api.common.HumbugAPI(email="feedback@humbughq.com",
api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
verbose=True,
site="https://humbughq.com")
staging_client = api.common.HumbugAPI(email="feedback@humbughq.com",
api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
verbose=True,
site="https://staging.humbughq.com")
def forward_message(message):
if message["type"] != "personal":
return
forwarded_message = {
"type": "stream",
"stream": "support",
"subject": "feedback from %s" % message["sender_email"],
"content": message["content"],
}
staging_client.send_message(forwarded_message)
prod_client.call_on_each_message(forward_message)