Chatting with HIpChat: APIs 101

155

description

 

Transcript of Chatting with HIpChat: APIs 101

Page 1: Chatting with HIpChat: APIs 101
Page 2: Chatting with HIpChat: APIs 101

Don Brown • Arch i tec t • At lass ian • @mrdonbrown

Chatting with HipChatAPI ’S 101

Page 3: Chatting with HIpChat: APIs 101
Page 4: Chatting with HIpChat: APIs 101
Page 5: Chatting with HIpChat: APIs 101
Page 6: Chatting with HIpChat: APIs 101
Page 7: Chatting with HIpChat: APIs 101
Page 8: Chatting with HIpChat: APIs 101
Page 9: Chatting with HIpChat: APIs 101
Page 10: Chatting with HIpChat: APIs 101

1. Google “hipchat bitbucket integration”

2. Click first Google result

3. Click “these instructions” link

4. Click “Hipchat hook management” link as page was renamed

5. Visit Bitbucket and login

6. Go to desired repository

7. Click admin icon

8. Select “Hooks” menu item

9. Select “HipChat” from hooks dropdown list

10.In a separate tab, go back to HipChat and login

11.Click on “Group Admin” tab

12.Click on “API”

13.Type in “Bitbucket integration, select “Notifications, copy new API key

14.Click on the “Rooms” tab

15.Click on the target room

16.Copy the “API ID” value

17.Go back to the Bitbucket tab

18.Copy in ID, API key, and API url (consult docs), and click “Save”

Install Bitbucket Integration

Page 11: Chatting with HIpChat: APIs 101

HipChat Add-Ons =

API’s + Connect + Marketplace

Page 12: Chatting with HIpChat: APIs 101

Character Sheets

SaaS Dev Experts Founder Enterprise ArchStrDexConInt

WisChaLevelExp

17 10 12

18 12 14

12 14 18

15 16 14

11 16 17

12 18 14

2 6 5

4,200 52,650 34,800

Page 13: Chatting with HIpChat: APIs 101

Session 3 - Entrepreneur

Session 2 - Intrapreneur

Session 1 - Hacker

SaaS Jr. Developer Scenario

Page 14: Chatting with HIpChat: APIs 101

Goal: Show signups in my team’s room

Page 15: Chatting with HIpChat: APIs 101

Just text by itself, for impact.

Page 16: Chatting with HIpChat: APIs 101

Just text by itself, for impact.

Page 17: Chatting with HIpChat: APIs 101

Just text by itself, for impact.

Page 18: Chatting with HIpChat: APIs 101

curl -H "Content-Type: application/json" \ -d '{"message": "Hello world"}' -v "https://api.hipchat.com/v2/room/My%20Room/message"

Page 19: Chatting with HIpChat: APIs 101

< HTTP/1.1 401 Unauthorized< Server: nginx< Date: Mon, 16 Sep 2013 23:33:27 GMT< Content-Type: application/json< Transfer-Encoding: chunked< Connection: keep-alive< Access-Control-Allow-Origin: *< WWW-Authenticate: Bearer realm="HipChat"<{ "error": { "code": 401, "message": "Authenticated requests only. See https://www.hipchat.com/docs/apiv2/auth for more information.", "type": "Unauthorized" }

Page 20: Chatting with HIpChat: APIs 101
Page 21: Chatting with HIpChat: APIs 101

Just text by itself, for impact.

Page 22: Chatting with HIpChat: APIs 101

Just text by itself, for impact.

Page 23: Chatting with HIpChat: APIs 101

curl -H "Content-Type: application/json" \ -d '{"message": "Hello world"}' -v "https://api.hipchat.com/v2/room/My%20Room/message?auth_token=VPNE7g0rHbfpNZ68XcOP0mwoBhwLGe9cFtBmLFdq"

Page 24: Chatting with HIpChat: APIs 101

< HTTP/1.1 204 No Content< Server: nginx< Date: Mon, 16 Sep 2013 23:42:31 GMT< Content-Type: text/html< Connection: keep-alive< X-Ratelimit-Remaining: 499< X-Ratelimit-Limit: 500< Access-Control-Allow-Origin: *< X-Ratelimit-Reset: 1379374980.0

Page 25: Chatting with HIpChat: APIs 101
Page 26: Chatting with HIpChat: APIs 101
Page 27: Chatting with HIpChat: APIs 101
Page 28: Chatting with HIpChat: APIs 101

GET https://api.hipchat.com/v2/room/Engineering

{ "created": "2013-08-08T18:42:20", "id": 34, ... "participants": [ { "id": 375, "links": { "self": "https://api.hipchat.com/v2/user/375" }, "name": "Garret Heaton" } ]}

Page 29: Chatting with HIpChat: APIs 101

GET https://api.hipchat.com/v2/room/Engineering?expand=participants

{ "created": "2013-08-08T18:42:20", "id": 34, ... "participants": [ { "created": "2013-08-08T18:42:20", "email": "[email protected]", "id": 375, "is_deleted": false, "is_group_admin": true, "is_guest": false, "mention_name": "GarretHeaton", "name": "Garret Heaton", ... }]}

Page 30: Chatting with HIpChat: APIs 101
Page 31: Chatting with HIpChat: APIs 101

Just text by itself, for impact.

Page 32: Chatting with HIpChat: APIs 101

Session 1 - Hacker

Session 3 - Entrepreneur

Session 2 - Intrapreneur

SaaS Jr. Developer Scenario

Session 2- Intrapreneur

Page 33: Chatting with HIpChat: APIs 101

Goal: Show signups in any team’s room

Page 34: Chatting with HIpChat: APIs 101

Just text by itself, for impact.

Page 35: Chatting with HIpChat: APIs 101

HipChat

Signup DB

Signup Add-On

Page 36: Chatting with HIpChat: APIs 101

{ "name": "Signups", "description": "Posts signups in rooms", "key": "com.example.signups",

"links": { "homepage": "https://example.com/signups", "self": "https://example.com/signups/capabilities" },

"capabilities": { "hipchatApiConsumer": { "scopes": [ "send_notification" ] } }}

Page 37: Chatting with HIpChat: APIs 101

Just text by itself, for impact.

Page 38: Chatting with HIpChat: APIs 101

Just text by itself, for impact.

Page 39: Chatting with HIpChat: APIs 101

Just text by itself, for impact.

Page 40: Chatting with HIpChat: APIs 101
Page 41: Chatting with HIpChat: APIs 101

Just text by itself, for impact.

Page 42: Chatting with HIpChat: APIs 101

Just text by itself, for impact.

Page 43: Chatting with HIpChat: APIs 101

curl -v \! -u d4d6949e-791e-43ce-a0b7-50134495b73e:j998i9niK8zhi89R2sieBVVQSFfIgzdTOBpxI8aP \ ! -d "grant_type=client_credentials&scope=send_notification" \! https://api.hipchat.com/v2/oauth/token

Page 44: Chatting with HIpChat: APIs 101

< HTTP/1.1 200 OK< Server: nginx< Date: Tue, 17 Sep 2013 01:28:03 GMT< Content-Type: application/json< Transfer-Encoding: chunked< Connection: keep-alive< X-Ratelimit-Remaining: 499< X-Ratelimit-Limit: 500< Access-Control-Allow-Origin: *< X-Ratelimit-Reset: 1379381340.0<{"access_token": "E9NGsQjqWgHSK50ZXHGgIAoQ0E13b1FuGiLPNdYj", "expires_in": 82800, "scope": "view_group", "token_type": "bearer"}

Page 45: Chatting with HIpChat: APIs 101
Page 46: Chatting with HIpChat: APIs 101

{ "name": "Signups", "description": "Posts signups in rooms", "key": "com.example.signups",

"links": { "homepage": "https://example.com/signups", "self": "https://example.com/signups/capabilities" },

"capabilities": { "hipchatApiConsumer": { "scopes": [ "send_notification" ] },

"installable": { "callbackUrl": "https://example.com/signups/installed" } }}

Page 47: Chatting with HIpChat: APIs 101
Page 48: Chatting with HIpChat: APIs 101

Session 1 - Hacker

Session 3 - Entrepreneur

Session 2 - Intrapreneur

SaaS Jr. Developer Scenario

Session 3 -Entrepreneur

Page 49: Chatting with HIpChat: APIs 101

Goal: show sales in customer rooms

Page 50: Chatting with HIpChat: APIs 101
Page 51: Chatting with HIpChat: APIs 101

{ "name": "Signups", "description": "Posts signups in rooms", "key": "com.example.signups",

...

"capabilities": { "hipchatApiConsumer": { "scopes": [ "send_notification" ] },

"installable": { "callbackUrl": "https://example.com/signups/installed" },

"configurable": { "url": "https://example.com/signups/config" } }}

Page 52: Chatting with HIpChat: APIs 101

Just text by itself, for impact.

Page 53: Chatting with HIpChat: APIs 101

Screenshot of marketplace docs

Page 54: Chatting with HIpChat: APIs 101

Screenshot of marketplace registration

Page 55: Chatting with HIpChat: APIs 101

Just text by itself, for impact.

Page 56: Chatting with HIpChat: APIs 101

Just text by itself, for impact.

Page 57: Chatting with HIpChat: APIs 101

Session 3 - Entrepreneur

Session 2 - Intrapreneur

Session 1 - Hacker

Enterprise Architect Scenario

Page 58: Chatting with HIpChat: APIs 101

Goal: Show sales in my dev team’s room

Page 59: Chatting with HIpChat: APIs 101

Just text by itself, for impact.

Page 60: Chatting with HIpChat: APIs 101

Just text by itself, for impact.

Page 61: Chatting with HIpChat: APIs 101

Just text by itself, for impact.

Page 62: Chatting with HIpChat: APIs 101

curl -H "Content-Type: application/json" \ -d '{"message": "Hello world"}' -v "https://api.hipchat.com/v2/room/My%20Room/message"

Page 63: Chatting with HIpChat: APIs 101

< HTTP/1.1 401 Unauthorized< Server: nginx< Date: Mon, 16 Sep 2013 23:33:27 GMT< Content-Type: application/json< Transfer-Encoding: chunked< Connection: keep-alive< Access-Control-Allow-Origin: *< WWW-Authenticate: Bearer realm="HipChat"<{ "error": { "code": 401, "message": "Authenticated requests only. See https://www.hipchat.com/docs/apiv2/auth for more information.", "type": "Unauthorized" }

Page 64: Chatting with HIpChat: APIs 101
Page 65: Chatting with HIpChat: APIs 101

Just text by itself, for impact.

Page 66: Chatting with HIpChat: APIs 101

Just text by itself, for impact.

Page 67: Chatting with HIpChat: APIs 101

curl -H "Content-Type: application/json" \ -d '{"message": "Hello world"}' -v "https://api.hipchat.com/v2/room/My%20Room/message?auth_token=VPNE7g0rHbfpNZ68XcOP0mwoBhwLGe9cFtBmLFdq"

Page 68: Chatting with HIpChat: APIs 101

< HTTP/1.1 204 No Content< Server: nginx< Date: Mon, 16 Sep 2013 23:42:31 GMT< Content-Type: text/html< Connection: keep-alive< X-Ratelimit-Remaining: 499< X-Ratelimit-Limit: 500< Access-Control-Allow-Origin: *< X-Ratelimit-Reset: 1379374980.0

Page 69: Chatting with HIpChat: APIs 101
Page 70: Chatting with HIpChat: APIs 101
Page 71: Chatting with HIpChat: APIs 101
Page 72: Chatting with HIpChat: APIs 101

GET https://api.hipchat.com/v2/room/Engineering

{ "created": "2013-08-08T18:42:20", "id": 34, ... "participants": [ { "id": 375, "links": { "self": "https://api.hipchat.com/v2/user/375" }, "name": "Garret Heaton" } ]}

Page 73: Chatting with HIpChat: APIs 101

GET https://api.hipchat.com/v2/room/Engineering?expand=participants

{ "created": "2013-08-08T18:42:20", "id": 34, ... "participants": [ { "created": "2013-08-08T18:42:20", "email": "[email protected]", "id": 375, "is_deleted": false, "is_group_admin": true, "is_guest": false, "mention_name": "GarretHeaton", "name": "Garret Heaton", ... }]}

Page 74: Chatting with HIpChat: APIs 101
Page 75: Chatting with HIpChat: APIs 101

Just text by itself, for impact.

Page 76: Chatting with HIpChat: APIs 101

Session 1 - Hacker

Session 3 - Entrepreneur

Session 2 - Intrapreneur

Enterprise Architect Scenario

Session 2 - Intrapreneur

Page 77: Chatting with HIpChat: APIs 101

Goal: Show sales in any team’s room

Page 78: Chatting with HIpChat: APIs 101

Just text by itself, for impact.

Page 79: Chatting with HIpChat: APIs 101

HipChat

Sales DB Sales Add-On

Page 80: Chatting with HIpChat: APIs 101

{ "name": "Sales Info", "description": "Posts sales to rooms", "key": "com.example.sales",

"links": { "homepage": "https://example.com/sales", "self": "https://example.com/sales/capabilities" },

"capabilities": { "hipchatApiConsumer": { "scopes": [ "send_notification" ] } }}

Page 81: Chatting with HIpChat: APIs 101

Just text by itself, for impact.

Page 82: Chatting with HIpChat: APIs 101

Just text by itself, for impact.

Page 83: Chatting with HIpChat: APIs 101

Just text by itself, for impact.

Page 84: Chatting with HIpChat: APIs 101
Page 85: Chatting with HIpChat: APIs 101

Just text by itself, for impact.

Page 86: Chatting with HIpChat: APIs 101

Just text by itself, for impact.

Page 87: Chatting with HIpChat: APIs 101

curl -v \! -u d4d6949e-791e-43ce-a0b7-50134495b73e:j998i9niK8zhi89R2sieBVVQSFfIgzdTOBpxI8aP \ ! -d "grant_type=client_credentials&scope=send_notification" \! https://api.hipchat.com/v2/oauth/token

Page 88: Chatting with HIpChat: APIs 101

< HTTP/1.1 200 OK< Server: nginx< Date: Tue, 17 Sep 2013 01:28:03 GMT< Content-Type: application/json< Transfer-Encoding: chunked< Connection: keep-alive< X-Ratelimit-Remaining: 499< X-Ratelimit-Limit: 500< Access-Control-Allow-Origin: *< X-Ratelimit-Reset: 1379381340.0<{"access_token": "E9NGsQjqWgHSK50ZXHGgIAoQ0E13b1FuGiLPNdYj", "expires_in": 82800, "scope": "view_group", "token_type": "bearer"}

Page 89: Chatting with HIpChat: APIs 101
Page 90: Chatting with HIpChat: APIs 101

{ "name": "Sales Info", "description": "Posts sales to rooms", "key": "com.example.sales",

"links": { "homepage": "https://example.com/sales", "self": "https://example.com/sales/capabilities" },

"capabilities": { "hipchatApiConsumer": { "scopes": [ "send_notification" ] },

"installable": { "callbackUrl": "https://example.com/sales/installed" } }}

Page 91: Chatting with HIpChat: APIs 101
Page 92: Chatting with HIpChat: APIs 101

Session 1 - Hacker

Session 3 - Entrepreneur

Session 2 - Intrapreneur

Enterprise Architect Scenario

Session 3 -Entrepreneur

Page 93: Chatting with HIpChat: APIs 101

Goal: Create side-project to show Stripe sales in

customer rooms

Page 94: Chatting with HIpChat: APIs 101
Page 95: Chatting with HIpChat: APIs 101

{ "name": "Stripe Integration", "description": "Posts credit card sales in rooms", "key": "com.example.stripe",

...

"capabilities": { "hipchatApiConsumer": { "scopes": [ "send_notification" ] },

"installable": { "callbackUrl": "https://example.com/stripe/installed" },

"configurable": { "url": "https://example.com/stripe/config" } }}

Page 96: Chatting with HIpChat: APIs 101

Just text by itself, for impact.

Page 97: Chatting with HIpChat: APIs 101

Screenshot of marketplace docs

Page 98: Chatting with HIpChat: APIs 101

Screenshot of marketplace registration

Page 99: Chatting with HIpChat: APIs 101

Just text by itself, for impact.

Page 100: Chatting with HIpChat: APIs 101

Just text by itself, for impact.

Page 101: Chatting with HIpChat: APIs 101

Session 3 - Entrepreneur

Session 2 - Intrapreneur

Session 1 - Hacker

Experts Founder Scenario

Page 102: Chatting with HIpChat: APIs 101

Goal: Add external chat room to website

Page 103: Chatting with HIpChat: APIs 101

Just text by itself, for impact.

Page 104: Chatting with HIpChat: APIs 101

Just text by itself, for impact.

Page 105: Chatting with HIpChat: APIs 101

Just text by itself, for impact.

Page 106: Chatting with HIpChat: APIs 101

curl -H "Content-Type: application/json" \ -d '{"message": "Hello world"}' -v "https://api.hipchat.com/v2/room/My%20Room/message"

Page 107: Chatting with HIpChat: APIs 101

< HTTP/1.1 401 Unauthorized< Server: nginx< Date: Mon, 16 Sep 2013 23:33:27 GMT< Content-Type: application/json< Transfer-Encoding: chunked< Connection: keep-alive< Access-Control-Allow-Origin: *< WWW-Authenticate: Bearer realm="HipChat"<{ "error": { "code": 401, "message": "Authenticated requests only. See https://www.hipchat.com/docs/apiv2/auth for more information.", "type": "Unauthorized" }

Page 108: Chatting with HIpChat: APIs 101
Page 109: Chatting with HIpChat: APIs 101

Just text by itself, for impact.

Page 110: Chatting with HIpChat: APIs 101

Just text by itself, for impact.

Page 111: Chatting with HIpChat: APIs 101

curl -H "Content-Type: application/json" \ -d '{"message": "Hello world"}' -v "https://api.hipchat.com/v2/room/My%20Room/message?auth_token=VPNE7g0rHbfpNZ68XcOP0mwoBhwLGe9cFtBmLFdq"

Page 112: Chatting with HIpChat: APIs 101

< HTTP/1.1 204 No Content< Server: nginx< Date: Mon, 16 Sep 2013 23:42:31 GMT< Content-Type: text/html< Connection: keep-alive< X-Ratelimit-Remaining: 499< X-Ratelimit-Limit: 500< Access-Control-Allow-Origin: *< X-Ratelimit-Reset: 1379374980.0

Page 113: Chatting with HIpChat: APIs 101
Page 114: Chatting with HIpChat: APIs 101
Page 115: Chatting with HIpChat: APIs 101
Page 116: Chatting with HIpChat: APIs 101

GET https://api.hipchat.com/v2/room/Engineering

{ "created": "2013-08-08T18:42:20", "id": 34, ... "participants": [ { "id": 375, "links": { "self": "https://api.hipchat.com/v2/user/375" }, "name": "Garret Heaton" } ]}

Page 117: Chatting with HIpChat: APIs 101

GET https://api.hipchat.com/v2/room/Engineering?expand=participants

{ "created": "2013-08-08T18:42:20", "id": 34, ... "participants": [ { "created": "2013-08-08T18:42:20", "email": "[email protected]", "id": 375, "is_deleted": false, "is_group_admin": true, "is_guest": false, "mention_name": "GarretHeaton", "name": "Garret Heaton", ... }]}

Page 118: Chatting with HIpChat: APIs 101
Page 119: Chatting with HIpChat: APIs 101
Page 120: Chatting with HIpChat: APIs 101

Just text by itself, for impact.

Page 121: Chatting with HIpChat: APIs 101

Session 1 - Hacker

Session 3 - Entrepreneur

Session 2 - Intrapreneur

Experts Founder Scenario

Session 2- Intrapreneur

Page 122: Chatting with HIpChat: APIs 101

Goal: Private support chats on website

Page 123: Chatting with HIpChat: APIs 101

Just text by itself, for impact.

Page 124: Chatting with HIpChat: APIs 101

HipChat

Support DB

Support Add-On

Page 125: Chatting with HIpChat: APIs 101

{ "name": "Support Chats", "description": "Manages support chats", "key": "com.example.support",

"links": { "homepage": "https://example.com/support", "self": "https://example.com/support/capabilities" },

"capabilities": { "hipchatApiConsumer": { "scopes": [ "send_notification" ] } }}

Page 126: Chatting with HIpChat: APIs 101

Just text by itself, for impact.

Page 127: Chatting with HIpChat: APIs 101

Just text by itself, for impact.

Page 128: Chatting with HIpChat: APIs 101

Just text by itself, for impact.

Page 129: Chatting with HIpChat: APIs 101
Page 130: Chatting with HIpChat: APIs 101

Just text by itself, for impact.

Page 131: Chatting with HIpChat: APIs 101

Just text by itself, for impact.

Page 132: Chatting with HIpChat: APIs 101

curl -v \! -u d4d6949e-791e-43ce-a0b7-50134495b73e:j998i9niK8zhi89R2sieBVVQSFfIgzdTOBpxI8aP \ ! -d "grant_type=client_credentials&scope=send_notification" \! https://api.hipchat.com/v2/oauth/token

Page 133: Chatting with HIpChat: APIs 101

< HTTP/1.1 200 OK< Server: nginx< Date: Tue, 17 Sep 2013 01:28:03 GMT< Content-Type: application/json< Transfer-Encoding: chunked< Connection: keep-alive< X-Ratelimit-Remaining: 499< X-Ratelimit-Limit: 500< Access-Control-Allow-Origin: *< X-Ratelimit-Reset: 1379381340.0<{"access_token": "E9NGsQjqWgHSK50ZXHGgIAoQ0E13b1FuGiLPNdYj", "expires_in": 82800, "scope": "view_group", "token_type": "bearer"}

Page 134: Chatting with HIpChat: APIs 101
Page 135: Chatting with HIpChat: APIs 101

{ "name": "Support Chats", "description": "Manages support chats", "key": "com.example.support",

"links": { "homepage": "https://example.com/support", "self": "https://example.com/support/capabilities" },

"capabilities": { "hipchatApiConsumer": { "scopes": [ "send_notification" ] },

"installable": { "callbackUrl": "https://example.com/support/installed" } }}

Page 136: Chatting with HIpChat: APIs 101
Page 137: Chatting with HIpChat: APIs 101

Session 1 - Hacker

Session 3 - Entrepreneur

Session 2 - Intrapreneur

Experts Founder Scenario

Session 3 -Entrepreneur

Page 138: Chatting with HIpChat: APIs 101

Goal: Sell support chats in the Marketplace

Page 139: Chatting with HIpChat: APIs 101
Page 140: Chatting with HIpChat: APIs 101

{ "name": "Support Chats", "description": "Manages support chats", "key": "com.example.support",

...

"capabilities": { "hipchatApiConsumer": { "scopes": [ "send_notification" ] },

"installable": { "callbackUrl": "https://example.com/support/installed" },

"configurable": { "url": "https://example.com/support/config" } }}

Page 141: Chatting with HIpChat: APIs 101

Just text by itself, for impact.

Page 142: Chatting with HIpChat: APIs 101

Screenshot of marketplace docs

Page 143: Chatting with HIpChat: APIs 101

Screenshot of marketplace registration

Page 144: Chatting with HIpChat: APIs 101

Just text by itself, for impact.

Page 145: Chatting with HIpChat: APIs 101

Just text by itself, for impact.

Page 146: Chatting with HIpChat: APIs 101

1.Visit HipChat and login

2.Click on “Rooms” tab

3.Click on desired room

4.Click on “Add-ons”

5.Find Bitbucket addon, and click “Install”

6.Type the repository name, and click “Add”

Install Bitbucket Add-on

Page 147: Chatting with HIpChat: APIs 101

Just text by itself, for impact.

Page 148: Chatting with HIpChat: APIs 101

The Future. . .

Page 149: Chatting with HIpChat: APIs 101

• Level One

• Level Two

• Level Two

• Level Two

• Level One

Page title here

Page 150: Chatting with HIpChat: APIs 101
Page 151: Chatting with HIpChat: APIs 101
Page 152: Chatting with HIpChat: APIs 101

Feedback time!

Page 153: Chatting with HIpChat: APIs 101

Be the hero! Hack HipChat!”“

Page 154: Chatting with HIpChat: APIs 101

Thank you!

Don Brown • Arch i tec t • At lass ian • @mrdonbrown

Page 155: Chatting with HIpChat: APIs 101

Text code below to 22333or visit http://bit.ly/1dPD0tv

Chatting with HipChat: APIs 101

To join this session, send text 136888 to

AWESOME = 8

PRETTY GOOD = 7

NOT BAD = 6

MEH = 5

Rate this Talk