2012-10-25 19:31:31 +02:00
|
|
|
#!/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
|
2012-11-06 20:29:40 +01:00
|
|
|
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")
|
2012-10-25 19:31:31 +02:00
|
|
|
|
|
|
|
def forward_message(message):
|
2012-11-06 21:17:53 +01:00
|
|
|
if message["type"] != "personal":
|
|
|
|
return
|
2012-10-26 16:42:31 +02:00
|
|
|
forwarded_message = {
|
|
|
|
"type": "stream",
|
|
|
|
"stream": "support",
|
|
|
|
"subject": "feedback from %s" % message["sender_email"],
|
|
|
|
"content": message["content"],
|
|
|
|
}
|
2012-11-06 20:29:40 +01:00
|
|
|
staging_client.send_message(forwarded_message)
|
2012-10-25 19:31:31 +02:00
|
|
|
|
2012-11-06 20:29:40 +01:00
|
|
|
prod_client.call_on_each_message(forward_message)
|