Atomist Bot

Atomist can now be put to work: reporting on events in your development systems, creating projects, editing code, managing issues, and generally tying your whole development process together. Let’s kick things off by connecting some of your existing code repositories to your chat channels. After that, we’ll use the Atomist Bot to create a new project for us using a generator.

Using Atomist on existing projects

You almost certainly have many existing projects that you would like Atomist’s help keeping track of. To get Atomist’s help with an existing GitHub repository, simply invite the Atomist Bot to a channel where you discuss that repository. You can invite the Atomist Bot to a channel just as you would invite any other user, e.g., by using the /invite @atomist command. Once the Atomist Bot is in the channel, you can tell the Atomist Bot what repository to associate with the channel by sending it the repo message. The repo command takes a single argument, the name of the repository you want to associate with the channel. You supply just the name of the repository, not including the repository owner since the Atomist Bot already knows what GitHub organization is associated with your Slack team.

@atomist repo REPOSITORY_NAME

If you are working through these steps in the [Atomist Community Slack][community], associations can only be made with repositories in the atomist GitHub organization.

At any time you can ask the Atomist Bot to tell you what repository is associated with the current channel by sending it the repos message.

@atomist repos

The Atomist Bot will respond with the repositories linked to the current channel, providing links to the repositories and buttons to allow you to quickly un-link the channel and repository.

Repositories linked to a channel

You can link more than one repository to a chat channel if you have a set of related repositories that are all discussed in a single channel.

While you can also link a single repository to multiple chat channels, repository and build messages for that repository will only be sent to one of the channels, so we do not recommend it.

GitHub and CI notifications

Once the association between a repository and chat channel is made, the Atomist Bot will begin reporting on activity in the associated repository. You can see these messages by committing and pushing a change to the repository. The Atomist Bot will post a message to the chat channel detailing the commits in the push and, if you have connected Atomist with your CI system, build status, updating it as the build goes from started to successful.

Commits and builds in a chat channel

The Atomist Bot will also send messages when issues and pull requests (PRs) are created, changed, and closed. Here’s an example of a message the Atomist Bot sends when someone closes an issue.

GitHub Issue Close Message

Changing GitHub from Slack

Getting well-formatted message in Slack about what is happening to your project on GitHub is nice, but it only scratches the surface of what Atomist can do. In addition to passively receiving and then displaying GitHub events, Atomist can generate and modify code and open issues and PRs, all without you ever having to leave Slack. To demonstrate this capability, you will use the Atomist Bot to create a GitHub Issue.

You can open GitHub Issues without leaving chat by sending a create issue message to the Atomist Bot. When running commands like this, the Atomist Bot is aware of the context in which it is asked to run the skill. This allows the Atomist Bot to collect less information in certain situations. What does this mean? This can be illustrated by running the same command in two different channels. First, run the create issue command in the #general channel, which is not associated with any repository, of your Slack team.

@atomist create issue

The Atomist Bot responds in a thread, collecting the information it needs to create the issue.

Creating a GitHub Issue in #general

Since the #general channel is not linked to a specific GitHub repository, the Atomist Bot must ask you in what repository you want to create the issue.

Compare this to sending the same create issue message to the Atomist Bot in a channel associated with a repository. As usual, your Atomist Bot will start a thread to collect all the information necessary it needs to complete the request, but it will not ask you to enter a repository.

Creating an Issue

Since there is already an association between the channel in which the message was sent and a repository, the Atomist Bot will automatically pass the associated repository along with the request. No need for you to enter it in!

With either approach, once you have entered all the needed information, your Atomist Bot will respond with a summary and the option to submit or cancel.

Issue Summary

Click the “Submit” button and Atomist will create the issue and then respond back in the channel where the thread started.

Issue Created

But that’s not where the interaction stops. The Atomist Bot will also post a message in the repository channel containing a summary of the newly created issue and some buttons for common actions taken on issues: assign it someone, add a label, add a comment, etc.

Issue Created

Go ahead and click on the link to see the issue on GitHub.

Issue in GitHub

Now head back to the repository channel in Slack and click on the “Bug” button to add the “bug” label to the issue:

Issue labelled as a Bug

We see the Atomist Bot responding that it has successfully edited the issue. Let’s make sure. Click on the link to open up the issue in GitHub.

Issue in GitHub

We can see that Atomist, as us, has labeled the issue a bug, just as we asked.

Now imagine that you are another team member who has noticed this new issue and wants to add a comment from inside GitHub. Using the GitHub web interface, add a comment and click the “Comment” button.

New comment on issue in GitHub

You will see a new message in the #sprocket channel from the Atomist Bot notifying you that the issue has been updated.

New comment notification in Slack

After connecting Atomist and GitHub, we can see GitHub events in Slack, take action on them, and see the result in GitHub and Slack.