Java Module

Java Module

Installation

Add the dependency:

1
2
3
4
5
<dependency>
    <groupId>com.botbye</groupId>
    <artifactId>java-module</artifactId>
    <version>3.0.1</version>
</dependency>

Configuration

Phishing lives in its own dedicated BotbyePhishingClient, separate from the evaluate Botbye client. It is identified by a public, browser-safe clientKey, so it needs no server key — construct it standalone and reuse it. On construction it makes a one-off, best-effort server-integration init handshake that reports this server-side integration to BotBye; it is non-blocking and never affects your request path.

BotbyePhishingConfig takes 2 values: endpoint (optional, defaults to https://verify.botbye.com) and clientKey.

Getting clientKey

clientKey is the public, browser-safe identifier of your phishing project. It travels in the asset URL path, so it is safe to expose — no secret token and no Base64 encoding are required.

Find it on the Get Started screen of your phishing project in the BotBye dashboard.

1
2
3
4
5
6
7
8
9
import com.botbye.phishing.BotbyePhishingClient;
import com.botbye.phishing.BotbyePhishingConfig;

BotbyePhishingClient phishing = new BotbyePhishingClient(
        new BotbyePhishingConfig.Builder()
                .endpoint("https://verify.botbye.com")
                .clientKey("<public-client-key>")
                .build()
);

Usage

Expose a single endpoint that proxies phishing pixel requests.

When you use an SVG image, your application must also expose an endpoint on the client origin that handles requests to /{imageId}.png, where imageId is the value that arrives in the forwarded pixel query as image_id.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
String origin = request.getHeader("Origin");
Map<String, String> query = request.getParameterMap().entrySet().stream()
        .collect(Collectors.toMap(Map.Entry::getKey, e -> e.getValue()[0]));

BotbyePhishingResponse response;
try {
    response = phishing.fetchImage(origin, query);
} catch (Exception e) {
    resp.sendError(500, e.getMessage() != null ? e.getMessage() : "internal error");
    return;
}

if (response.getError() != null) {
    resp.sendError(502, response.getError().getMessage());
    return;
}

String contentType = response.getHeaders().getOrDefault("Content-Type", "image/png");
resp.setStatus(response.getStatus());
resp.setContentType(contentType);
resp.getOutputStream().write(response.getBody());

Settings

Configuration parameters for phishing integration:

Setting Description Required Default Value
endpoint Host of the phishing API no https://verify.botbye.com
clientKey Public client-key of your phishing project yes -