# **Configuring SearchBlox**
Before using Slack Connector, SearchBlox has to be installed and set up successfully. Then create a **Custom Collection**.

# **Configuring Slack Connector**
## Prerequisite
**JAVA JDK** Install Java JDK 1.8.x for the Slack Connector to work. The environment variable is set as shown here (for Windows):
Link to download Java: [http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html](🔗) For Linux, please make sure that JDK1.8 is installed in the server.
**Kafka and Zookeeper**
Download the latest version of Kafka: [https://kafka.apache.org/downloads.html](🔗)
Unzip the downloaded Kafka tgz file to C:/ drive for Windows, or /opt for Linux. Save as C:/Kafka or /opt/Kafka.
**_Windows_**
Go to C:\Kafka\config\server.properties and edit the line “log.dirs=/tmp/kafka-logs” to “log.dir= C:\Kafka\kafka-logs”.
Go to C:\Kafka\config\zookeeper.properties and edit the line “dataDir=/tmp/zookeeper-logs” to “dataDir=C:\Kafka\zookeeper-logs”.
**_Start Zookeeper_** Start the Zookeeper service first. In Windows, open the command prompt, then go to C:\kafka\bin\Windows and run the following command:
In Linux, open the terminal then go to /opt/Kafka/bin and run the following command:
**_Start Kafka service_** Open another command prompt/terminal. In Windows, open the command prompt, then go to C:\kafka\bin\Windows and run the following command:
In Linux, open the terminal, then go to /opt/Kafka/bin and run the following command:
**Steps to Set Up Slack Connector** Please contact [[email protected]](🔗) to request the download link for SearchBlox Slack connector.
Download the SearchBlox Slack connector. Extract the downloaded zip file to _C:\searchblox-slack-bot_ for Windows, and _/opt/searchblox-slack-bot_ for Linux, and name the folder _searchblox-slack-bot_.
Unzip searchblox-slack-connector.zip under _C:\* or _/opt*.
After extracting, _C:\searchblox-slack-bot_ or _/opt/searchblox-slack-bot_ should contain: searchblox-slack-bot-0.1.0.jar, application.properties and this readme.txt
Note:
In Linux, make sure that the necessary permissions have been provided to the folder /opt by using the CHMOD command for writing log files and executing jar files.

Enter the details in _C:/searchblox-slack-bot/application.properties_ or _\opt\searchblox-slack-bot\application.properties_. The properties with the prefix _slackapi_ are slack properties. The properties with prefix _zookeeper_ are Zookeeper properties. The properties with prefix _Kafka_ are Kafka properties. The properties with prefix _searchblox_ are SearchBlox properties.** *
Column Title | Column Title |
slackapi.authenticationToken | Slack authentication token. |
kafka.topic | The chat stream. |
kafka.hostName | Hostname where Kafka runs. |
kafka.port | Default Kafka port number. |
zookeeper.hostName | Hostname where Zookeeper runs. |
zookeeper.port | Zookeeper port number of. Default is 2181. |
searchblox.restJsonApi | SearchBlox rest API URL. Make changes based on IPaddress and port number used. |
searchblox.apiKey | SearchBlox application's API key in Menu → Admin. |
searchblox.colname | Name of custom collection. |
The application.properties content details are provided here:
Start SearchBlox.
Make sure to run Zookeeper first, and then Kafka, using the steps outlined in the preceding prerequisites section.
The log files will be written to _C:\searchblox-slack-bot_ or _/opt/searchblox-slack-bot_.
Port 8181 must available before running the following command. If it is not available, change -Dserver.port number to any available port number.
For Windows, open the command prompt, go to _C:\searchblox-slack-bot_ and execute: java -DLOG_PATH="C:\searchblox-slack-bot" -DLOG_LEVEL=DEBUG -DpropertySource=file:C:/searchblox-slack-bot/application.properties -Dserver.port=8181 -jar searchblox-slack-bot-0.1.0.jar
For Linux, open the command prompt, go to _/opt/searchblox-slack-bot_ and execute: java -DLOG_PATH="/opt/searchblox-slack-bot" -DLOG_LEVEL=DEBUG -DpropertySource=file:/opt/searchblox-slack-bot/application.properties -Dserver.port=8181 -jar searchblox-slack-bot-0.1.0.jar.

Once the connector gets started, messages that are sent to the #general or #random channel in Slack will be indexed simultaneously.
Note:
The log level in the above command is set to DEBUG, this prints out the detailed explanation of requests and responses to the log. This can be changed to INFO for a short explanation.