2012-10-25 13:31:31 -04:00
|
|
|
#!/usr/bin/python
|
|
|
|
import sys
|
|
|
|
import os
|
|
|
|
import optparse
|
2012-12-03 12:23:06 -05:00
|
|
|
from os import path
|
2012-10-25 13:31:31 -04:00
|
|
|
|
2012-12-03 12:23:06 -05:00
|
|
|
sys.path.append(path.join(path.dirname(__file__), '..'))
|
|
|
|
import humbug
|
2012-12-03 12:24:49 -05:00
|
|
|
prod_client = humbug.Client(
|
2012-12-03 12:23:06 -05:00
|
|
|
email="feedback@humbughq.com",
|
|
|
|
api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
|
|
|
verbose=True,
|
|
|
|
site="https://humbughq.com")
|
2012-12-03 12:24:49 -05:00
|
|
|
staging_client = humbug.Client(
|
2012-12-03 12:23:06 -05:00
|
|
|
email="feedback@humbughq.com",
|
|
|
|
api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
|
|
|
verbose=True,
|
|
|
|
site="https://staging.humbughq.com")
|
2012-10-25 13:31:31 -04:00
|
|
|
|
|
|
|
def forward_message(message):
|
2012-12-11 10:00:20 -05:00
|
|
|
if message["type"] != "private" or len(message["display_recipient"]) != 2:
|
2012-11-06 15:17:53 -05:00
|
|
|
return
|
2012-10-26 10:42:31 -04:00
|
|
|
forwarded_message = {
|
|
|
|
"type": "stream",
|
2012-11-14 17:21:46 -05:00
|
|
|
"to": "support",
|
2012-10-26 10:42:31 -04:00
|
|
|
"subject": "feedback from %s" % message["sender_email"],
|
|
|
|
"content": message["content"],
|
|
|
|
}
|
2012-11-06 14:29:40 -05:00
|
|
|
staging_client.send_message(forwarded_message)
|
2012-10-25 13:31:31 -04:00
|
|
|
|
2012-11-06 14:29:40 -05:00
|
|
|
prod_client.call_on_each_message(forward_message)
|