All the self-help gurus keep telling you that you should control your instincts and avoid checking your GitHub projects to see if somebody starred any of them in the last 5 minutes. I have the same problem (yes, first world problems). And as usual, changing the system/environment is easier than changing your own behaviour.
That's why I've changed the way to check for stars counting from a pull to a push approach by using the Xatkit bot development platform.
Now, instead of me checking GitHub for new notifications, I have a bot that alerts me automatically every time somebody stars one of my projects, as you can see in the featured image above. By using our (now extended)
xatkit-bot-platform / xatkit-github-platform
Receive events and perform actions on Github from your Xatkit execution model
Xatkit Github Platform
Receive events and performs action on Github from your Xatkit execution model.
Providers
The Github platform defines the following providers:
Provider | Type | Context Parameters | Description |
---|---|---|---|
GithubWebhookEventProvider | Event | - | Receive webhook events from the Github API and translate them into Xatkit-compatible events. |
You can configure the GH repo (or organization) to send the events to the Xatkit GithubWebhookEventProvider
by adding a new WebHook. Use json as content type
Keep in mind that the Provider expects the events to be sent to the /github
endpoint.
As an example the ngrok configuration of the Payload URL would look like
https://4f8a-31-4-243-25.ngrok.io/github
GithubWebhookEventProvider Events
Event | Context | Parameters | Description |
---|---|---|---|
Issue_Opened | issue |
See the platform file | Event sent when a new issue is opened in the repository. |
Issue_Edited | issue |
See the platform file | Event sent when an issue is edited. |
Issue_Closed | issue |
See the platform file | Event sent when an issue is closed. |
Basically, we subscribe to the Star_Event and extract out of the JSON Payload sent by GitHub all the data we want to integrate into our message. The reception of the event, the parsing of the JSON data,... is all done by the GithubPlatform.GithubWebhookEventProvider class. We just take what we need from the processed information. As usual, in this example, we post the result on Slack but this is up to you, just make sure you configure the properties file.
Note that the bot can also be the bearer of bad news. If some lesser person decides to unstar your repo you'll get also the proper notification. In both cases, the alert is immediate since we process the GitHub events as they come.
Our Xatkit-GitHub platform is bidirectional. Beyond subscribing to GitHub events we can also call GitHub ourselves to create new issues, add labels, users,... based on a chat conversation taking place on an external platform. We have another example for this: Talk with your repositories – A Slack chatbot for GitHub. See this and other examples in our dedicated xatkit examples repo.
I hope these examples show you how powerful this integration between Xatkit and GitHub can be. Surprise me with your own examples!.
And of course, if you liked it, don't forget to star our repo. You'll made my day if I start getting plenty of star alerts from you!
xatkit-bot-platform / xatkit
The simplest way to build all types of smart chatbots and digital assistants
Xatkit - The easiest way to build powerful bots and chatbots
Get your own smart chatbot. Design your bot once, deploy it everywhere.
Xatkit has been created to reduce boilerplate code, complex API understanding, and technical details to facilitate the definition and deployment of your bots. Xatkit helps you focus on what really matters: the conversation logic you want to embed in your chatbot.
To do so, we have baked a chatbot-specific definition language to specify user intentions, receive events (your bots can also be proactive!), and bind them to computable actions following powerful state machine semantics. Our chatbot language is implemented as a Java Fluent Interface combining the low-code benefits of using a dedicated chatbot Internal DSL with the full power of Java when you need to write complex bot behaviours.
This chatbot specification is then handled by the Xatkit Runtime Engine, which automatically manages its…
Top comments (0)