[ { "endpoint": "GET /api/v1/messages/latest", "example_response": "
{ \"messages\" : [ { \"client\" : \"website\",\n        \"content\" : \"hi\",\n        \"content_type\" : \"text/x-markdown\",\n        \"display_recipient\" : [ { \"email\" : \"wdaher@humbughq.com\",\n              \"full_name\" : \"Waseem Daher\",\n              \"short_name\" : \"wdaher\"\n            },\n            { \"email\" : \"othello-bot@humbughq.com\",\n              \"full_name\" : \"Othello, Moor of Venice\",\n              \"short_name\" : \"othello-bot\"\n            }\n          ],\n        \"gravatar_hash\" : \"948fcdfa93dd8986106032f1bad7f2c8\",\n        \"id\" : 400,\n        \"recipient_id\" : 101,\n        \"sender_email\" : \"othello-bot@humbughq.com\",\n        \"sender_full_name\" : \"Othello, Moor of Venice\",\n        \"sender_short_name\" : \"othello-bot\",\n        \"subject\" : \"\",\n        \"timestamp\" : 1365532669,\n        \"type\" : \"private\"\n      } ],\n  \"msg\" : \"\",\n  \"result\" : \"success\",\n  \"update_types\" : [ \"new_messages\" ]\n}\n
", "returns": [ [ "messages", "an array (possibly zero-length if dont_block is set) of messages with IDs newer than `last_message`" ] ], "call": "Poll for new messages", "arguments": [ [ "last", "(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." ], [ "dont_block", "set to \u201ctrue\u201d if the client is requesting a nonblocking reply" ] ], "example_request": { "python": "
client.get_messages()\n
", "curl": "
curl -G https://api.humbughq.com/v1/messages/latest \\\n -u othello-bot@example.com:a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 \\\n -d \"last=102345\"\n
" } }, { "endpoint": "POST /api/v1/messages", "example_response": "
{\"msg\": \"\", \"result\": \"success\"}\n
", "returns": [ [ "id", "The ID of the newly created message." ] ], "call": "Send a message", "arguments": [ [ "type", "One of {private, stream}" ], [ "content", "The content of the message" ], [ "to", "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." ], [ "subject", "The subject for the message (Only required if type is \u201cstream\u201d)" ] ], "example_request": { "python": "
\nclient.send_message({\n    \"type\": \"private\",\n    \"to\": \"wdaher@humbughq.com\",\n    \"content\": \"I come not, friends, to steal away your hearts.\"\n})\nclient.send_message({\n    \"type\": \"stream\",\n    \"to\": \"Denmark\",\n    \"subject\": \"Castle\",\n    \"content\": \"Something is rotten in the state of Denmark.\"\n})\n
\n", "curl": "
Stream message
\n
curl https://api.humbughq.com/v1/messages \\\n    -u BOT_EMAIL_ADDRESS:BOT_API_KEY \\\n    -d \"type=stream\" \\\n    -d \"to=Denmark\" \\\n    -d \"subject=Castle\" \\\n    -d \"content=Something is rotten in the state of Denmark.\"\n
\n
Private message
\n
curl https://api.humbughq.com/v1/messages \\\n    -u BOT_EMAIL_ADDRESS:BOT_API_KEY \\\n    -d \"type=private\" \\\n    -d \"to=wdaher@humbughq.com\" \\\n    -d \"content=I come not, friends, to steal away your hearts.\"\n
" } } ]