-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
152 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,136 +1,33 @@ | ||
# Cake.Gitter | ||
Cake Addin that extend Cake with Gitter messaging features | ||
|
||
## License | ||
[](http://gep13.mit-license.org) | ||
|
||
## Build Status | ||
|
||
AppVeyor (develop) | AppVeyor (master) | ||
------------- | ------------- | ||
[](https://ci.appveyor.com/project/GaryEwanPark/cake-gitter) | [](https://ci.appveyor.com/project/GaryEwanPark/cake-gitter) | ||
|
||
|
||
## Chat Room | ||
|
||
Come join in the conversation about ChocolateyGUI in our Gitter Chat Room | ||
|
||
[](https://gitter.im/gep13/Cake.Gitter?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) | ||
|
||
## Usage | ||
|
||
### Post Message | ||
|
||
#### Using Token | ||
|
||
```csharp | ||
#addin "Cake.Slack" | ||
var gitterToken = EnvironmentVariable("GITTER_TOKEN"); | ||
var gitterRoomId = EnvironmentVariable("gitterRoomId"); | ||
|
||
try | ||
{ | ||
var postMessageResult = Gitter.Chat.PostMessage( | ||
message:"Hello from Cake.Gitter API", | ||
messageSettings:new GitterChatMessageSettings { Token = gitterToken, RoomId = gitterRoomId} | ||
); | ||
|
||
if (postMessageResult.Ok) | ||
{ | ||
Information("Message {0} succcessfully sent", postMessageResult.TimeStamp); | ||
} | ||
else | ||
{ | ||
Error("Failed to send message: {0}", postMessageResult.Error); | ||
} | ||
} | ||
catch(Exception ex) | ||
{ | ||
Error("{0}", ex); | ||
} | ||
``` | ||
|
||
Cake output will be similar to below: | ||
|
||
``` | ||
Message 2015-10-16T11:18:14.078Z successfully sent | ||
``` | ||
|
||
This will result in a message appearing in the Gitter Room similar to the following: | ||
Cake.Gitter is an Addin for [Cake](http://cakebuild.net/) which extends it by allowing the posting of messages to [Gitter](https://gitter.im), either: | ||
|
||
 | ||
- directly into a chat room, using a token | ||
- into the Activity Feed for a chat room, using a webhook | ||
|
||
#### Using Web Hook Url | ||
## Information | ||
|
||
```csharp | ||
#addin "Cake.Slack" | ||
var gitterWebHookUri = EnvironmentVariable("gitterWebHookUri"); | ||
try | ||
{ | ||
var postMessageResult = Gitter.Chat.PostMessage( | ||
message:"Hello from Cake.Gitter WebHook", | ||
messageSettings:new GitterChatMessageSettings { IncomingWebHookUrl = gitterWebHookUri } | ||
); | ||
||Stable|Pre-release| | ||
|:--:|:--:|:--:| | ||
|Docs|[](http://cakegitter.readthedocs.org/en/stable/)|[](http://cakegitter.readthedocs.org/en/develop/)| | ||
|GitHub Release|-|[](https://github.com/gep13/Cake.Gitter/releases/latest)| | ||
|NuGet|[](https://www.nuget.org/packages/Cake.Gitter)|[](https://www.nuget.org/packages/Cake.Gitter)| | ||
|
||
if (postMessageResult.Ok) | ||
{ | ||
Information("Message {0} succcessfully sent", postMessageResult.TimeStamp); | ||
} | ||
else | ||
{ | ||
Error("Failed to send message: {0}", postMessageResult.Error); | ||
} | ||
} | ||
catch(Exception ex) | ||
{ | ||
Error("{0}", ex); | ||
} | ||
``` | ||
|
||
Cake output will be similar to below: | ||
|
||
``` | ||
Message 2015-10-16 11:26:23Z successfully sent | ||
``` | ||
|
||
This will result in a message appearing in the Activity Feed for the Gitter Room similar to the following: | ||
|
||
 | ||
|
||
## How to find required information | ||
|
||
### Room Id | ||
|
||
One way, there may be others, to find the unique Gitter Room Id is the following: | ||
|
||
1. Open [Postman](https://www.getpostman.com/) | ||
2. Create a new GET request, pointing at `https://api.gitter.im/v1/rooms/` | ||
3. In the headers section, add a new header with `Content-Type` of `application\json` | ||
4. In the headers section, add a new header with `Accept` of `application\json` | ||
5. In the headers section, add a new header with `Authorization` of `Bearer <Personal Access Token` **NOTE:** You can find your Personal Access Token by logging into [here](https://developer.gitter.im/apps) | ||
6. Click Send | ||
|
||
This will return a complete list of all the Rooms that you are a member of. Scroll through the list until you find the one that you are interested, and take note of the Room Id, as shown in the picture below: | ||
|
||
 | ||
|
||
### Web Hook Url | ||
|
||
Use the following steps to create a Custom Web Hook Url for your Gitter Room: | ||
|
||
1. Log into gitter.im | ||
2. Navigate to your Room | ||
3. Click the Settings icon at the top of the page, and click Integrations | ||
4. Scroll down to the "Add an integration" section, and click Custom | ||
5. In the window that opens up you will see your newly created Web Hook Url. It should look something like this | ||
## Build Status | ||
|
||
 | ||
|Develop|Master| | ||
|:--:|:--:| | ||
|[](https://ci.appveyor.com/project/GaryEwanPark/cake-gitter/branch/develop)|[](https://ci.appveyor.com/project/GaryEwanPark/cake-gitter/branch/master)| | ||
|
||
**NOTE:** The above Web Hook Url is a sample one, and no longer exists. | ||
## Quick Links | ||
|
||
### Personal Access Token | ||
- [Documentation](http://cakegitter.readthedocs.org/en/develop/) | ||
- [Usage](http://cakegitter.readthedocs.org/en/develop/usage/) | ||
- [Required Information](http://cakegitter.readthedocs.org/en/develop/requiredinformation/) | ||
|
||
In order to post directly into a Gitter Room, you need to use an Access Token. Gitter does not provide the ability to generate Personal Access Tokens on a use case basis, however, you can use your own one. You can retrieve that by doing the following: | ||
## Chat Room | ||
Come join in the conversation about Cake.Gitter in our Gitter Chat Room | ||
|
||
1. Log into [https://developer.gitter.im/apps](https://developer.gitter.im/apps) | ||
2. Your Personal Access Token will be displayed | ||
[](https://gitter.im/gep13/Cake.Gitter?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#Cake.Gitter Documentation | ||
|
||
Cake.Gitter is an Addin for [Cake](http://cakebuild.net/) which extends it by allowing the posting of messages to [Gitter](https://gitter.im), either: | ||
|
||
- directly into a chat room, using a token | ||
- into the Activity Feed for a chat room, using a webhook |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# How to find required information | ||
|
||
## Room Id | ||
|
||
One way, there may be others, to find the unique Gitter Room Id is the following: | ||
|
||
1. Open [Postman](https://www.getpostman.com/) | ||
2. Create a new GET request, pointing at `https://api.gitter.im/v1/rooms/` | ||
3. In the headers section, add a new header with `Content-Type` of `application\json` | ||
4. In the headers section, add a new header with `Accept` of `application\json` | ||
5. In the headers section, add a new header with `Authorization` of `Bearer <Personal Access Token` **NOTE:** You can find your Personal Access Token by logging into [here](https://developer.gitter.im/apps) | ||
6. Click Send | ||
|
||
This will return a complete list of all the Rooms that you are a member of. Scroll through the list until you find the one that you are interested, and take note of the Room Id, as shown in the picture below: | ||
|
||
 | ||
|
||
## Web Hook Url | ||
|
||
Use the following steps to create a Custom Web Hook Url for your Gitter Room: | ||
|
||
1. Log into gitter.im | ||
2. Navigate to your Room | ||
3. Click the Settings icon at the top of the page, and click Integrations | ||
4. Scroll down to the "Add an integration" section, and click Custom | ||
5. In the window that opens up you will see your newly created Web Hook Url. It should look something like this | ||
|
||
 | ||
|
||
**NOTE:** The above Web Hook Url is a sample one, and no longer exists. | ||
|
||
## Personal Access Token | ||
|
||
In order to post directly into a Gitter Room, you need to use an Access Token. Gitter does not provide the ability to generate Personal Access Tokens on a use case basis, however, you can use your own one. You can retrieve that by doing the following: | ||
|
||
1. Log into [https://developer.gitter.im/apps](https://developer.gitter.im/apps) | ||
2. Your Personal Access Token will be displayed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# Post Message | ||
|
||
## Using Token | ||
|
||
```csharp | ||
#addin "Cake.Slack" | ||
var gitterToken = EnvironmentVariable("GITTER_TOKEN"); | ||
var gitterRoomId = EnvironmentVariable("gitterRoomId"); | ||
|
||
try | ||
{ | ||
var postMessageResult = Gitter.Chat.PostMessage( | ||
message:"Hello from Cake.Gitter API", | ||
messageSettings:new GitterChatMessageSettings { Token = gitterToken, RoomId = gitterRoomId} | ||
); | ||
|
||
if (postMessageResult.Ok) | ||
{ | ||
Information("Message {0} succcessfully sent", postMessageResult.TimeStamp); | ||
} | ||
else | ||
{ | ||
Error("Failed to send message: {0}", postMessageResult.Error); | ||
} | ||
} | ||
catch(Exception ex) | ||
{ | ||
Error("{0}", ex); | ||
} | ||
``` | ||
|
||
Cake output will be similar to below: | ||
|
||
``` | ||
Message 2015-10-16T11:18:14.078Z successfully sent | ||
``` | ||
|
||
This will result in a message appearing in the Gitter Room similar to the following: | ||
|
||
 | ||
|
||
## Using Web Hook Url | ||
|
||
```csharp | ||
#addin "Cake.Slack" | ||
var gitterWebHookUri = EnvironmentVariable("gitterWebHookUri"); | ||
try | ||
{ | ||
var postMessageResult = Gitter.Chat.PostMessage( | ||
message:"Hello from Cake.Gitter WebHook", | ||
messageSettings:new GitterChatMessageSettings { IncomingWebHookUrl = gitterWebHookUri } | ||
); | ||
|
||
if (postMessageResult.Ok) | ||
{ | ||
Information("Message {0} succcessfully sent", postMessageResult.TimeStamp); | ||
} | ||
else | ||
{ | ||
Error("Failed to send message: {0}", postMessageResult.Error); | ||
} | ||
} | ||
catch(Exception ex) | ||
{ | ||
Error("{0}", ex); | ||
} | ||
``` | ||
|
||
Cake output will be similar to below: | ||
|
||
``` | ||
Message 2015-10-16 11:26:23Z successfully sent | ||
``` | ||
|
||
This will result in a message appearing in the Activity Feed for the Gitter Room similar to the following: | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
site_name: Cake.Gitter | ||
theme: readthedocs | ||
repo_url: https://github.com/gep13/Cake.Gitter | ||
|
||
pages: | ||
- Home: index.md | ||
- Usage: usage.md | ||
- Required Information: requiredinformation.md |