Java SDK for Botan analytics
Add to your pom.xml
<dependency>
<groupId>me.shib.java.lib</groupId>
<artifactId>botan</artifactId>
<version>1.0.0</version>
</dependency>
Below is a sample java code containing methods written with the Botan SDK
import me.shib.java.lib.botan.Botan;
import java.io.IOException;
import java.util.Map;
public class TestBotan {
private static final String botanToken = "YourBotanTokenGoesHere";
private Botan botan;
public TestBotan() {
botan = new Botan(botanToken);
}
//Tracks any sent or received messages
public void trackMessage(long user_id, String messageType, Message message) {
try {
botan.track(user_id, messageType, message);
} catch (IOException e) {
e.printStackTrace();
}
}
//Tracks any received update
public void trackUpdate(long user_id, Update update) {
try {
botan.track(user_id, "update", update);
} catch (IOException e) {
e.printStackTrace();
}
}
//Tracks anything else, even a custom map
public void trackAnyOtherMap(long user_id, String nameOrContext, Map<String, Object> xyzMap) {
try {
botan.track(user_id, nameOrContext, xyzMap);
} catch (IOException e) {
e.printStackTrace();
}
}
//Shorten a URL and also track any visits to the shortened URL
public void shortenURL(long user_id, String url) {
try {
System.out.println(botan.shortenURL(user_id, url));
} catch (IOException e) {
e.printStackTrace();
}
}
}