2013-04-09 22:20:46 +02:00
[
{
2013-06-19 23:51:07 +02:00
"endpoint" : "GET /api/v1/messages/latest" ,
2013-05-29 17:55:59 +02:00
"example_response" : "<div class=\"codehilite\"><pre><span class=\"p\">{</span> <span class=\"s2\">\"messages\"</span> <span class=\"o\">:</span> <span class=\"p\">[</span> <span class=\"p\">{</span> <span class=\"s2\">\"client\"</span> <span class=\"o\">:</span> <span class=\"s2\">\"website\"</span><span class=\"p\">,</span>\n <span class=\"s2\">\"content\"</span> <span class=\"o\">:</span> <span class=\"s2\">\"hi\"</span><span class=\"p\">,</span>\n <span class=\"s2\">\"content_type\"</span> <span class=\"o\">:</span> <span class=\"s2\">\"text/x-markdown\"</span><span class=\"p\">,</span>\n <span class=\"s2\">\"display_recipient\"</span> <span class=\"o\">:</span> <span class=\"p\">[</span> <span class=\"p\">{</span> <span class=\"s2\">\"email\"</span> <span class=\"o\">:</span> <span class=\"s2\">\"wdaher@humbughq.com\"</span><span class=\"p\">,</span>\n <span class=\"s2\">\"full_name\"</span> <span class=\"o\">:</span> <span class=\"s2\">\"Waseem Daher\"</span><span class=\"p\">,</span>\n <span class=\"s2\">\"short_name\"</span> <span class=\"o\">:</span> <span class=\"s2\">\"wdaher\"</span>\n <span class=\"p\">},</span>\n <span class=\"p\">{</span> <span class=\"s2\">\"email\"</span> <span class=\"o\">:</span> <span class=\"s2\">\"othello-bot@humbughq.com\"</span><span class=\"p\">,</span>\n <span class=\"s2\">\"full_name\"</span> <span class=\"o\">:</span> <span class=\"s2\">\"Othello, Moor of Venice\"</span><span class=\"p\">,</span>\n <span class=\"s2\">\"short_name\"</span> <span class=\"o\">:</span> <span class=\"s2\">\"othello-bot\"</span>\n <span class=\"p\">}</span>\n <span class=\"p\">],</span>\n <span class=\"s2\">\"gravatar_hash\"</span> <span class=\"o\">:</span> <span class=\"s2\">\"948fcdfa93dd8986106032f1bad7f2c8\"</span><span class=\"p\">,</span>\n <span class=\"s2\">\"id\"</span> <span class=\"o\">:</span> <span class=\"mi\">400</span><span class=\"p\">,</span>\n <span class=\"s2\">\"recipient_id\"</span> <span class=\"o\">:</span> <span class=\"mi\">101</span><span class=\"p\">,</span>\n <span class=\"s2\">\"sender_email\"</span> <span class=\"o\">:</span> <span class=\"s2\">\"othello-bot@humbughq.com\"</span><span class=\"p\">,</span>\n <span class=\"s2\">\"sender_full_name\"</span> <span class=\"o\">:</span> <span class=\"s2\">\"Othello, Moor of Venice\"</span><span class=\"p\">,</span>\n <span class=\"s2\">\"sender_short_name\"</span> <span class=\"o\">:</span> <span class=\"s2\">\"othello-bot\"</span><span class=\"p\">,</span>\n <span class=\"s2\">\"subject\"</span> <span class=\"o\">:</span> <span class=\"s2\">\"\"</span><span class=\"p\">,</span>\n <span class=\"s2\">\"timestamp\"</span> <span class=\"o\">:</span> <span class=\"mi\">1365532669</span><span class=\"p\">,</span>\n <span class=\"s2\">\"type\"</span> <span class=\"o\">:</span> <span class=\"s2\">\"private\"</span>\n <span class=\"p\">}</span> <span class=\"p\">],</span>\n <span class=\"s2\">\"msg\"</span> <span class=\"o\">:</span> <span class=\"s2\">\"\"</span><span class=\"p\">,</span>\n <span class=\"s2\">\"result\"</span> <span class=\"o\">:</span> <span class=\"s2\">\"success\"</span><span class=\"p\">,</span>\n <span class=\"s2\">\"update_types\"</span> <span class=\"o\">:</span> <span class=\"p\">[</span> <span class=\"s2\">\"new_messages\"</span> <span class=\"p\">]</span>\n<span class=\"p\">}</span>\n</pre></div>" ,
2013-04-09 22:20:46 +02:00
"returns" : [
[
2013-06-19 23:51:07 +02:00
"messages" ,
2013-04-09 22:20:46 +02:00
"an array (possibly zero-length if dont_block is set) of messages with IDs newer than `last_message`"
]
2013-06-19 23:51:07 +02:00
] ,
"call" : "Poll for new messages" ,
2013-04-09 22:20:46 +02:00
"arguments" : [
[
2013-06-19 23:51:07 +02:00
"last" ,
2013-04-09 22:20:46 +02:00
"(optional) Indicates the highest message ID that the client is not interested in. They are implicitly interested in all messages with ids higher than this. If the `last` argument is not present, the server assumes a value equal to the highest existing message ID."
2013-06-19 23:51:07 +02:00
] ,
2013-04-09 22:20:46 +02:00
[
2013-06-19 23:51:07 +02:00
"dont_block" ,
2013-04-09 22:20:46 +02:00
"set to \u201ctrue\u201d if the client is requesting a nonblocking reply"
]
2013-06-19 23:51:07 +02:00
] ,
2013-04-09 22:20:46 +02:00
"example_request" : {
2013-06-19 23:51:07 +02:00
"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>" ,
2013-06-24 21:48:32 +02:00
"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>"
2013-04-09 22:20:46 +02:00
}
2013-06-19 23:51:07 +02:00
} ,
2013-04-09 22:20:46 +02:00
{
2013-06-19 23:51:07 +02:00
"endpoint" : "POST /api/v1/messages" ,
"example_response" : "<div class=\"codehilite\"><pre><span class=\"p\">{</span><span class=\"s2\">\"msg\"</span><span class=\"o\">:</span> <span class=\"s2\">\"\"</span><span class=\"p\">,</span> <span class=\"s2\">\"result\"</span><span class=\"o\">:</span> <span class=\"s2\">\"success\"</span><span class=\"p\">}</span>\n</pre></div>" ,
2013-04-09 22:20:46 +02:00
"returns" : [
[
2013-06-19 23:51:07 +02:00
"id" ,
2013-04-09 22:20:46 +02:00
"The ID of the newly created message."
]
2013-06-19 23:51:07 +02:00
] ,
"call" : "Send a message" ,
2013-04-09 22:20:46 +02:00
"arguments" : [
[
2013-06-19 23:51:07 +02:00
"type" ,
2013-04-09 22:20:46 +02:00
"One of {private, stream}"
2013-06-19 23:51:07 +02:00
] ,
2013-04-09 22:20:46 +02:00
[
2013-06-19 23:51:07 +02:00
"content" ,
2013-04-09 22:20:46 +02:00
"The content of the message"
2013-06-19 23:51:07 +02:00
] ,
2013-04-09 22:20:46 +02:00
[
2013-06-19 23:51:07 +02:00
"to" ,
2013-04-09 22:20:46 +02:00
"In the case of a stream message, a string identifying the stream. In the case of a private message, a JSON-encoded list containing the usernames of the recipients."
2013-06-19 23:51:07 +02:00
] ,
2013-04-09 22:20:46 +02:00
[
2013-06-19 23:51:07 +02:00
"subject" ,
2013-04-09 22:20:46 +02:00
"The subject for the message (Only required if type is \u201cstream\u201d)"
]
2013-06-19 23:51:07 +02:00
] ,
2013-04-09 22:20:46 +02:00
"example_request" : {
2013-06-19 23:51:07 +02:00
"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@humbughq.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" ,
2013-06-24 21:48:32 +02:00
"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@humbughq.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>"
2013-04-09 22:20:46 +02:00
}
}
2013-06-19 23:51:07 +02:00
]