Skip to content

Instantly share code, notes, and snippets.

@wadey
Created August 28, 2011 23:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wadey/1177375 to your computer and use it in GitHub Desktop.
Save wadey/1177375 to your computer and use it in GitHub Desktop.
Botriot WebHooks

Botriot WebHooks

Format

Both the POST data and the expected response data are application/json

POST Request

If a user posts one of the following in the channel:

!example test 1 2 3
BotName test 1 2 3
BotName me test 1 2 3

Our server will post to your URL with the following JSON (for Campfire):

{
    "service": "campfire",
    "text": "example test 1 2 3",
    "from": {
        "id": 1234,
        "name": "Test Person",
        "email": "email@email.com",
        "admin": true
    },
    "room": {
        "id": 5678,
        "name": "Bot Test Room",
        "topic": "!curse bots",
        "locked": false
    },
    "date": 1317876136618
}

And here is example JSON for IRC (more information like ops/voice information coming soon):

{
    "service": "irc",
    "text": "example test 1 2 3",
    "from": {
        "name": "wadey"
    },
    "room": {
        "name": "#botriot"
    },
    "date": 1317876602358
}

(we plan to add more information in the future. We won't change fields once they are added though to maintain compatiblity).

Response

Your server should respond with a 200 OK code, and one of the following:

Speak

{"speak": "Message to speak"}

Paste

{"paste": "Message to paste"}

Image

{"image": "http://yourcool/image.png"}

How to enable

You enable webhooks by using running !webhook command in your channel.

!webhook <url>

To disable webhooks, use:

!webhook off
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment