Custom Events

If you want a customer journey to be executed after an action on your website, you can use the following method:

Indigitall.sendCustomerCustomEvent(
  applicationContext,
  "eventCode",
  "eventID_optional",
  "eventAt_optional",
  JSONObject().put("dataKey", "dataValue"),
  object : CustomerCallback(applicationContext) {
    override fun onSuccess(customer: Customer) {
      // Event was sent
    }

    override fun onError(errorModel: ErrorModel?) {
      // Handle the error
    }
  }
)
JSONObject data = new JSONObject();
try {
  data.put("dataKey", "dataValue");
} catch (JSONException exception) {
  throw new IllegalArgumentException("Invalid event data", exception);
}

Indigitall.sendCustomerCustomEvent(
    this, "eventCode", "eventID_optional", "eventAt_optional", data,
    new CustomerCallback(this) {
      @Override
      public void onSuccess(Customer customer) {
        // Event was sent
      }

      @Override
      public void onError(ErrorModel errorModel) {
        // Handle the error
      }
    });

In the customData JSON parameter, include the variables required by the customer journey and its campaigns.

For example:

Indigitall.sendCustomerCustomEvent(
  applicationContext,
  "my_event",
  "eventID_optional",
  "eventAt_optional",
  JSONObject().put("name", "John").put("value", "123"),
  object : CustomerCallback(applicationContext) {
    override fun onSuccess(customer: Customer) {
      // Event was sent
    }

    override fun onError(errorModel: ErrorModel?) {
      // Handle the error
    }
  }
)
JSONObject data = new JSONObject();
try {
  data.put("name", "John");
  data.put("value", "123");
} catch (JSONException exception) {
  throw new IllegalArgumentException("Invalid event data", exception);
}

Indigitall.sendCustomerCustomEvent(
    this, "my_event", "eventID_optional", "eventAt_optional", data,
    new CustomerCallback(this) {
      @Override
      public void onSuccess(Customer customer) {
        // Event was sent
      }

      @Override
      public void onError(ErrorModel errorModel) {
        // Handle the error
      }
    });