[manual] Use api.zulip.com to access the Humbug API.

This needs to be deployed after the nginx configuration is deployed.

(imported from commit 167a3d9d27595d40883bb400ebcc44c4ad9b6a2f)
This commit is contained in:
Tim Abbott
2013-07-24 17:53:39 -04:00
parent 4f8f46544c
commit 0d077e7f41
13 changed files with 24 additions and 28 deletions

View File

@@ -1,13 +1,13 @@
#!/bin/sh #!/bin/sh
# Two quick API tests using curl # Two quick API tests using curl
curl https://api.humbughq.com/v1/send_message \ curl https://api.zulip.com/v1/send_message \
-d "api-key=BOT_API_KEY" \ -d "api-key=BOT_API_KEY" \
-d "email=BOT_EMAIL" \ -d "email=BOT_EMAIL" \
-d "type=private" -d "content=test" \ -d "type=private" -d "content=test" \
-d "to=RECIPIENT_EMAIL" -d "to=RECIPIENT_EMAIL"
curl https://api.humbughq.com/v1/get_messages \ curl https://api.zulip.com/v1/get_messages \
-d "api-key=BOT_API_KEY" \ -d "api-key=BOT_API_KEY" \
-d "email=BOT_EMAIL" -d "email=BOT_EMAIL"

View File

@@ -94,8 +94,8 @@ class Client(object):
site = "https://" + site site = "https://" + site
self.base_url = site self.base_url = site
else: else:
self.base_url = "https://api.humbughq.com" self.base_url = "https://api.zulip.com"
if self.base_url != "https://api.humbughq.com" and not self.base_url.endswith("/api"): if self.base_url != "https://api.zulip.com" and not self.base_url.endswith("/api"):
self.base_url += "/api" self.base_url += "/api"
if not self.base_url.endswith("/"): if not self.base_url.endswith("/"):
self.base_url += "/" self.base_url += "/"

View File

@@ -54,4 +54,4 @@ def commit_notice_destination(repo, branch, commit):
HUMBUG_API_PATH = None HUMBUG_API_PATH = None
# This should not need to change unless you have a custom Humbug subdomain. # This should not need to change unless you have a custom Humbug subdomain.
HUMBUG_SITE = "https://api.humbughq.com" HUMBUG_SITE = "https://api.zulip.com"

View File

@@ -32,7 +32,7 @@ class HumbugListener extends AbstractIssueEventListener {
String issueBaseUrl = "https://jira.COMPANY.com/browse/" String issueBaseUrl = "https://jira.COMPANY.com/browse/"
// Your humbug domain, only change if you have a custom one // Your humbug domain, only change if you have a custom one
String domain = "" String base_url = "https://api.zulip.com"
@Override @Override
void workflowEvent(IssueEvent event) { void workflowEvent(IssueEvent event) {
@@ -142,10 +142,6 @@ class HumbugListener extends AbstractIssueEventListener {
} }
String humbugUrl(method) { String humbugUrl(method) {
String url = "humbughq.com" return base_url + "/v1/" + method
if (domain != "") {
url = domain + "." + url
}
return "https://" + url + "/api/v1/" + method
} }
} }

View File

@@ -54,4 +54,4 @@ def commit_notice_destination(path, commit):
HUMBUG_API_PATH = None HUMBUG_API_PATH = None
# This should not need to change unless you have a custom Humbug subdomain. # This should not need to change unless you have a custom Humbug subdomain.
HUMBUG_SITE = "https://api.humbughq.com" HUMBUG_SITE = "https://api.zulip.com"

View File

@@ -49,4 +49,4 @@ TRAC_NOTIFY_FIELDS = ["description", "summary", "resolution", "comment",
HUMBUG_API_PATH = None HUMBUG_API_PATH = None
# This should not need to change unless you have a custom Humbug subdomain. # This should not need to change unless you have a custom Humbug subdomain.
HUMBUG_SITE = "https://api.humbughq.com" HUMBUG_SITE = "https://api.zulip.com"

View File

@@ -24,7 +24,7 @@ setup(name='humbug',
'License :: OSI Approved :: MIT License', 'License :: OSI Approved :: MIT License',
'Topic :: Communications :: Chat', 'Topic :: Communications :: Chat',
], ],
url='https://humbughq.com/dist/api/', url='https://www.zulip.com/dist/api/',
packages=['humbug'], packages=['humbug'],
data_files=[('share/humbug/examples', ["examples/humbugrc", "examples/send-message", "examples/subscribe", data_files=[('share/humbug/examples', ["examples/humbugrc", "examples/send-message", "examples/subscribe",
"examples/get-public-streams", "examples/unsubscribe", "examples/get-public-streams", "examples/unsubscribe",

View File

@@ -15,7 +15,7 @@ parser.add_option('--verbose',
action='store_true') action='store_true')
parser.add_option('--site', parser.add_option('--site',
dest='site', dest='site',
default="https://api.humbughq.com", default="https://api.zulip.com",
action='store') action='store')
parser.add_option('--sharded', parser.add_option('--sharded',
default=False, default=False,

View File

@@ -36,12 +36,12 @@ prod_client = humbug.Client(
email="feedback@zulip.com", email="feedback@zulip.com",
api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
verbose=True, verbose=True,
site="https://api.humbughq.com") site="https://api.zulip.com")
staging_client = humbug.Client( staging_client = humbug.Client(
email="feedback@zulip.com", email="feedback@zulip.com",
api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
verbose=True, verbose=True,
site="https://staging.humbughq.com/api") site="https://staging.zulip.com/api")
def forward_message(message): def forward_message(message):
if message["type"] != "private" or len(message["display_recipient"]) != 2: if message["type"] != "private" or len(message["display_recipient"]) != 2:

View File

@@ -70,7 +70,7 @@ class RandomExponentialBackoff(CountingBackoff):
print message print message
time.sleep(delay) time.sleep(delay)
DEFAULT_SITE = "https://api.humbughq.com" DEFAULT_SITE = "https://api.zulip.com"
class States: class States:
Startup, HumbugToZephyr, ZephyrToHumbug, ChildSending = range(4) Startup, HumbugToZephyr, ZephyrToHumbug, ChildSending = range(4)

View File

@@ -26,7 +26,7 @@ usage = """Usage: send-receive.py [options] [config]
parser = optparse.OptionParser(usage=usage) parser = optparse.OptionParser(usage=usage)
parser.add_option('--site', parser.add_option('--site',
dest='site', dest='site',
default="https://api.humbughq.com", default="https://api.zulip.com",
action='store') action='store')
parser.add_option('--nagios', parser.add_option('--nagios',
@@ -92,14 +92,14 @@ if "staging" in options.site:
sender_key = "dfe1c934d555f4b9538d0d4cfd3069c2" sender_key = "dfe1c934d555f4b9538d0d4cfd3069c2"
recipient = "othello@zulip.com" recipient = "othello@zulip.com"
recipient_key = "4e5d97591bec64bf57d2698ffbb563e3" recipient_key = "4e5d97591bec64bf57d2698ffbb563e3"
site = "https://staging.humbughq.com/api" site = "https://staging.zulip.com/api"
else: else:
# cordelia and iago are default users on prod # cordelia and iago are default users on prod
sender = "iago@zulip.com" sender = "iago@zulip.com"
sender_key = "d43b53c27a8106195b46781abc67901a" sender_key = "d43b53c27a8106195b46781abc67901a"
recipient = "cordelia@zulip.com" recipient = "cordelia@zulip.com"
recipient_key = "24cf18de98d5c31da9c6c79f0cbec195" recipient_key = "24cf18de98d5c31da9c6c79f0cbec195"
site = "https://api.humbughq.com" site = "https://api.zulip.com"
humbug_sender = humbug.Client( humbug_sender = humbug.Client(
email=sender, email=sender,

View File

@@ -21,7 +21,7 @@
], ],
"example_request": { "example_request": {
"python": "<div class=\"codehilite\"><pre><span class=\"n\">client</span><span class=\"o\">.</span><span class=\"n\">get_messages<span class=\"p\">()</span>\n</span></pre></div>", "python": "<div class=\"codehilite\"><pre><span class=\"n\">client</span><span class=\"o\">.</span><span class=\"n\">get_messages<span class=\"p\">()</span>\n</span></pre></div>",
"curl": "<div class=\"codehilite\"><pre>curl -G https://api.humbughq.com/v1/messages/latest <span class=\"se\">\\</span>\n -u othello-bot@example.com:a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 <span class=\"se\">\\</span>\n -d <span class=\"s2\">\"last=102345\"</span>\n</pre></div>" "curl": "<div class=\"codehilite\"><pre>curl -G https://api.zulip.com/v1/messages/latest <span class=\"se\">\\</span>\n -u othello-bot@example.com:a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 <span class=\"se\">\\</span>\n -d <span class=\"s2\">\"last=102345\"</span>\n</pre></div>"
} }
}, },
{ {
@@ -54,7 +54,7 @@
], ],
"example_request": { "example_request": {
"python": "<div class=\"codehilite\"><pre>\n<span class=\"n\">client</span><span class=\"o\">.</span><span class=\"n\">send_message</span><span class=\"p\">({</span>\n <span class=\"s\">\"type\"</span><span class=\"p\">:</span> <span class=\"s\">\"private\"</span><span class=\"p\">,</span>\n <span class=\"s\">\"to\"</span><span class=\"p\">:</span> <span class=\"s\">\"wdaher@example.com\"</span><span class=\"p\">,</span>\n <span class=\"s\">\"content\"</span><span class=\"p\">:</span> <span class=\"s\">\"I come not, friends, to steal away your hearts.\"</span>\n<span class=\"p\">}</span>)\n<span class=\"n\">client</span><span class=\"o\">.</span><span class=\"n\">send_message</span><span class=\"p\">(</span><span class=\"n\"><span class=\"p\">{</span>\n <span class=\"s\">\"type\"</span><span class=\"p\">:</span> <span class=\"s\">\"stream\"</span><span class=\"p\">,</span>\n <span class=\"s\">\"to\"</span><span class=\"p\">:</span> <span class=\"s\">\"Denmark\"</span><span class=\"p\">,</span>\n <span class=\"s\">\"subject\"</span><span class=\"p\">:</span> <span class=\"s\">\"Castle\"</span><span class=\"p\">,</span>\n <span class=\"s\">\"content\"</span><span class=\"p\">:</span> <span class=\"s\">\"Something is rotten in the state of Denmark.\"</span>\n<span class=\"p\">}</span></span><span class=\"p\">)</span>\n</pre></div>\n", "python": "<div class=\"codehilite\"><pre>\n<span class=\"n\">client</span><span class=\"o\">.</span><span class=\"n\">send_message</span><span class=\"p\">({</span>\n <span class=\"s\">\"type\"</span><span class=\"p\">:</span> <span class=\"s\">\"private\"</span><span class=\"p\">,</span>\n <span class=\"s\">\"to\"</span><span class=\"p\">:</span> <span class=\"s\">\"wdaher@example.com\"</span><span class=\"p\">,</span>\n <span class=\"s\">\"content\"</span><span class=\"p\">:</span> <span class=\"s\">\"I come not, friends, to steal away your hearts.\"</span>\n<span class=\"p\">}</span>)\n<span class=\"n\">client</span><span class=\"o\">.</span><span class=\"n\">send_message</span><span class=\"p\">(</span><span class=\"n\"><span class=\"p\">{</span>\n <span class=\"s\">\"type\"</span><span class=\"p\">:</span> <span class=\"s\">\"stream\"</span><span class=\"p\">,</span>\n <span class=\"s\">\"to\"</span><span class=\"p\">:</span> <span class=\"s\">\"Denmark\"</span><span class=\"p\">,</span>\n <span class=\"s\">\"subject\"</span><span class=\"p\">:</span> <span class=\"s\">\"Castle\"</span><span class=\"p\">,</span>\n <span class=\"s\">\"content\"</span><span class=\"p\">:</span> <span class=\"s\">\"Something is rotten in the state of Denmark.\"</span>\n<span class=\"p\">}</span></span><span class=\"p\">)</span>\n</pre></div>\n",
"curl": "<h5>Stream message</h5>\n<div class=\"codehilite\"><pre>curl https://api.humbughq.com/v1/messages <span class=\"se\">\\</span>\n -u BOT_EMAIL_ADDRESS:BOT_API_KEY <span class=\"se\">\\</span>\n -d <span class=\"s2\">\"type=stream\"</span> <span class=\"se\">\\</span>\n -d <span class=\"s2\">\"to=Denmark\"</span> <span class=\"se\">\\</span>\n -d <span class=\"s2\">\"subject=Castle\"</span> <span class=\"se\">\\</span>\n -d <span class=\"s2\">\"content=Something is rotten in the state of Denmark.\"</span>\n</pre></div>\n<h5>Private message</h5>\n<div class=\"codehilite\"><pre>curl https://api.humbughq.com/v1/messages <span class=\"se\">\\</span>\n -u BOT_EMAIL_ADDRESS:BOT_API_KEY <span class=\"se\">\\</span>\n -d <span class=\"s2\">\"type=private\"</span> <span class=\"se\">\\</span>\n -d <span class=\"s2\">\"to=wdaher@example.com\"</span> <span class=\"se\">\\</span>\n -d <span class=\"s2\">\"content=I come not, friends, to steal away your hearts.\"</span>\n</pre></div>" "curl": "<h5>Stream message</h5>\n<div class=\"codehilite\"><pre>curl https://api.zulip.com/v1/messages <span class=\"se\">\\</span>\n -u BOT_EMAIL_ADDRESS:BOT_API_KEY <span class=\"se\">\\</span>\n -d <span class=\"s2\">\"type=stream\"</span> <span class=\"se\">\\</span>\n -d <span class=\"s2\">\"to=Denmark\"</span> <span class=\"se\">\\</span>\n -d <span class=\"s2\">\"subject=Castle\"</span> <span class=\"se\">\\</span>\n -d <span class=\"s2\">\"content=Something is rotten in the state of Denmark.\"</span>\n</pre></div>\n<h5>Private message</h5>\n<div class=\"codehilite\"><pre>curl https://api.zulip.com/v1/messages <span class=\"se\">\\</span>\n -u BOT_EMAIL_ADDRESS:BOT_API_KEY <span class=\"se\">\\</span>\n -d <span class=\"s2\">\"type=private\"</span> <span class=\"se\">\\</span>\n -d <span class=\"s2\">\"to=wdaher@example.com\"</span> <span class=\"se\">\\</span>\n -d <span class=\"s2\">\"content=I come not, friends, to steal away your hearts.\"</span>\n</pre></div>"
} }
} }
] ]

View File

@@ -69,7 +69,7 @@
Choose the <code>Webhooks</code> integration from the list presented. Make sure to replace the <code>@</code> in the bot's email address with <code>%40</code>, Choose the <code>Webhooks</code> integration from the list presented. Make sure to replace the <code>@</code> in the bot's email address with <code>%40</code>,
as Beanstalk's website will incorrectly refuse to parse a username containing a <code>@</code>.</p> as Beanstalk's website will incorrectly refuse to parse a username containing a <code>@</code>.</p>
<p>In the URL field, enter <code>https://bot_email:bot_api_key@humbughq.com/api/v1/external/beanstalk</code>:</p> <p>In the URL field, enter <code>https://bot_email:bot_api_key@api.zulip.com/v1/external/beanstalk</code>:</p>
<img class="screenshot" src="/static/images/integrations/beanstalk/001.png"> <img class="screenshot" src="/static/images/integrations/beanstalk/001.png">
<p><b>Congratulations! You're done!</b><br /> Whenever you do a <p><b>Congratulations! You're done!</b><br /> Whenever you do a
@@ -255,7 +255,7 @@ following, to the stream <code>commits</code> with a subject that matches the re
</p> </p>
<p>Give your new web hook a name, and for the URL provide the following:</p> <p>Give your new web hook a name, and for the URL provide the following:</p>
<p> <p>
<code>https://api.humbughq.com/v1/external/jira?api_key=abcdefgh&amp;stream=jira</code> <code>https://api.zulip.com/v1/external/jira?api_key=abcdefgh&amp;stream=jira</code>
</p> </p>
<p>where <code>api_key</code> is the API key of your Zulip bot, <p>where <code>api_key</code> is the API key of your Zulip bot,
@@ -288,7 +288,7 @@ following, to the stream <code>commits</code> with a subject that matches the re
<p><b>SSL Setup</b></p> <p><b>SSL Setup</b></p>
As Zulip is using a StartCOM SSL certificate that is not recognized by default in the Java installation shipped with JIRA, As Zulip is using a StartCOM SSL certificate that is not recognized by default in the Java installation shipped with JIRA,
you will need to tell JIRA about the certificate. Navigate to <code>Administration > System > Configure SSL</code> and in you will need to tell JIRA about the certificate. Navigate to <code>Administration > System > Configure SSL</code> and in
the <code>Import SSL Certificates</code> field, enter <code>https://www.humbughq.com</code>. After clicking <code>Save Certificates</code>, the <code>Import SSL Certificates</code> field, enter <code>https://api.zulip.com</code>. After clicking <code>Save Certificates</code>,
follow the on-screen instructions and restart JIRA for it to recognize the proper certificates. follow the on-screen instructions and restart JIRA for it to recognize the proper certificates.
<p><b>Zulip Integration</b></p> <p><b>Zulip Integration</b></p>
Copy the folder <code>integrations/jira/org/</code> (from the tarball you downloaded above) to your JIRA <code>classes</code> folder. Copy the folder <code>integrations/jira/org/</code> (from the tarball you downloaded above) to your JIRA <code>classes</code> folder.
@@ -383,7 +383,7 @@ key=NAGIOS_BOT_API_KEY
<p>Zulip supports Pivotal Tracker integration and can notify you of changes to the stories in your Pivotal Tracker project. In the Settings page <p>Zulip supports Pivotal Tracker integration and can notify you of changes to the stories in your Pivotal Tracker project. In the Settings page
for your project, choose the Integrations tab. Scroll down to the <code>Activity Web Hook</code> section, and enter the following url:</p> for your project, choose the Integrations tab. Scroll down to the <code>Activity Web Hook</code> section, and enter the following url:</p>
x <p><code>https://api.humbughq.com/v1/external/pivotal?api_key=abcdefgh&amp;stream=pivotal</code></p> x <p><code>https://api.zulip.com/v1/external/pivotal?api_key=abcdefgh&amp;stream=pivotal</code></p>
<p>where <code>api_key</code> is the API key of your Zulip bot, <p>where <code>api_key</code> is the API key of your Zulip bot,
and <code>stream</code> is the stream name you want the and <code>stream</code> is the stream name you want the
@@ -406,7 +406,7 @@ x <p><code>https://api.humbughq.com/v1/external/pivotal?api_key=abcdefgh&am
"Alerting notifications". On the "Webhook" tab, enter the following "Alerting notifications". On the "Webhook" tab, enter the following
webhook URL:</p> webhook URL:</p>
<p><code>https://api.humbughq.com/v1/external/newrelic?api_key=abcdefgh&amp;stream=newrelic</code></p> <p><code>https://api.zulip.com/v1/external/newrelic?api_key=abcdefgh&amp;stream=newrelic</code></p>
<p>where <code>api_key</code> is the API key of your Zulip bot, <p>where <code>api_key</code> is the API key of your Zulip bot,
and <code>stream</code> is the stream name you want the and <code>stream</code> is the stream name you want the