<commit_before>slackbot-alfresco
====================

Slack is awesome, Alfresco is awesome, and the combination of the two is extremely awesome.
This project implements a simple chatbot for Slack that connects to your Alfresco instance and provides some
handy functionality:

* Automatically copy files uploaded into a Slack chat to an Alfresco site.
* Archives parts of Slack chats to an Alfresco site.
* Allows simple searching of Alfresco from within Slack, with links directly to results.

Setup
--------------------

Setting up this project is pretty simple, but you'll need a few things first:

* A running Alfresco instance for which you know the host, port, user and password
* A Slack account
* A recent version of node and a few modules

First, let's get your bot set up in Slack.  Click here, and set up a new bot:

https://my.slack.com/services/new/bot

When you set up your new bot, it will provide you with a token to use.  Copy this down somewhere, you'll
need in in a minute.

Now you'll need to get your Alfresco connection set up.  Log in and create a site for Slack to use.  Make
a note of the shortname (url name) of this site.

Next, pull down a copy of this project, and rename config-example.json to config.json.  Edit that file and paste your 
Slack token into the slack.token value.  While you are at it, go ahead and set up the Alfresco values in this file,
providing the hostname, port, username and password for your instance, along with the site name to use.

Here's what the configuration object looks like:

{	

	"alfresco": {

    	"host": "localhost",

        "port": "8080",

        "user": "username",

        "pass": "password",

        "site": "slackstuff",

        "logoUrl": "https://www.alfresco.com/sites/www.alfresco.com/files/alfresco-logo.png",

        "search": {

            "max": "10"

        }

    },

    "slack": {

    	"token": "<your slack bot token>"

    }
    
}

Running
--------------------

Once you have all that done, you're ready to roll!  To start this thing up you'll need a recent version of node, 
and the following modules installed:

cmis, botkit, https, fs, tmp, url, util, nconf

Now just run node:

node slackbot-alfresco.js

If all goes well, you should see the bot start up and connect to Slack.  Add the bot account you created earlier in Slack to a
Slack channel and test it out:
<commit_msg>formatted son config example<commit_after>slackbot-alfresco
====================

Slack is awesome, Alfresco is awesome, and the combination of the two is extremely awesome.
This project implements a simple chatbot for Slack that connects to your Alfresco instance and provides some
handy functionality:

* Automatically copy files uploaded into a Slack chat to an Alfresco site.
* Archives parts of Slack chats to an Alfresco site.
* Allows simple searching of Alfresco from within Slack, with links directly to results.

Setup
--------------------

Setting up this project is pretty simple, but you'll need a few things first:

* A running Alfresco instance for which you know the host, port, user and password
* A Slack account
* A recent version of node and a few modules

First, let's get your bot set up in Slack.  Click here, and set up a new bot:

https://my.slack.com/services/new/bot

When you set up your new bot, it will provide you with a token to use.  Copy this down somewhere, you'll
need in in a minute.

Now you'll need to get your Alfresco connection set up.  Log in and create a site for Slack to use.  Make
a note of the shortname (url name) of this site.

Next, pull down a copy of this project, and rename config-example.json to config.json.  Edit that file and paste your 
Slack token into the slack.token value.  While you are at it, go ahead and set up the Alfresco values in this file,
providing the hostname, port, username and password for your instance, along with the site name to use.

Here's what the configuration object looks like:

```json
{	
	"alfresco": {
    	"host": "localhost",
        "port": "8080",
        "user": "username",
        "pass": "password",
        "site": "slackstuff",
        "logoUrl": "https://www.alfresco.com/sites/www.alfresco.com/files/alfresco-logo.png",
        "search": {
            "max": "10"
        }
    },
    "slack": {
    	"token": "<your slack bot token>"
    }
}
```

Running
--------------------

Once you have all that done, you're ready to roll!  To start this thing up you'll need a recent version of node, 
and the following modules installed:

cmis, botkit, https, fs, tmp, url, util, nconf

Now just run node:

node slackbot-alfresco.js

If all goes well, you should see the bot start up and connect to Slack.  Add the bot account you created earlier in Slack to a
Slack channel and test it out:

{'fraction_non_alphanumeric': 0.09399916072177927, 'fraction_numerical': 0.002517834662190516, 'mean_word_length': 3.1416159860990445, 'pattern_counts': {'":': 22, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 4, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6284293', 'n_tokens_mistral': 1404, 'n_tokens_neox': 1363, 'n_words': 696}