diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/ui/HubspotChat.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/ui/HubspotChat.java
new file mode 100644
index 0000000000..6ae77ee681
--- /dev/null
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/ui/HubspotChat.java
@@ -0,0 +1,54 @@
+package org.wso2.carbon.device.mgt.core.config.ui;
+
+import javax.xml.bind.annotation.XmlElement;
+
+public class HubspotChat {
+ private boolean isEnableHubspot;
+ private String trackingUrl;
+ private String accessToken;
+ private String senderActorId;
+ private long channelAccountId;
+
+ @XmlElement(name = "EnableHubspot")
+ public boolean isEnableHubspot() {
+ return isEnableHubspot;
+ }
+
+ public void setEnableHubspot(boolean enableHubspot) {
+ isEnableHubspot = enableHubspot;
+ }
+
+ @XmlElement(name = "TrackingUrl")
+ public String getTrackingUrl() {
+ return trackingUrl;
+ }
+
+ public void setTrackingUrl(String trackingUrl) {
+ this.trackingUrl = trackingUrl;
+ }
+
+ @XmlElement(name = "AccessToken")
+ public String getAccessToken() {
+ return accessToken;
+ }
+
+ public void setAccessToken(String accessToken) {
+ this.accessToken = accessToken;
+ }
+ @XmlElement(name = "SenderActorId")
+ public String getSenderActorId() {
+ return senderActorId;
+ }
+
+ public void setSenderActorId(String senderActorId) {
+ this.senderActorId = senderActorId;
+ }
+ @XmlElement(name = "ChannelAccountId")
+ public long getChannelAccountId() {
+ return channelAccountId;
+ }
+
+ public void setChannelAccountId(long channelAccountId) {
+ this.channelAccountId = channelAccountId;
+ }
+}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/ui/UIConfiguration.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/ui/UIConfiguration.java
index e5b553fec5..dca4a76a6b 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/ui/UIConfiguration.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/ui/UIConfiguration.java
@@ -34,7 +34,7 @@ public class UIConfiguration {
private int sessionTimeOut;
private int loginCacheCapacity;
private Billing billing;
- private String chatConfig;
+ private HubspotChat hubspotChat;
@XmlElement(name = "AppRegistration", required=true)
public AppRegistration getAppRegistration() {
@@ -64,15 +64,14 @@ public class UIConfiguration {
isSsoEnable = ssoEnable;
}
- @XmlElement(name = "ChatConfig", required = true)
- public String getChatConfig() {
- return chatConfig;
+ @XmlElement(name = "HubspotChat", required = true)
+ public HubspotChat getHubspotChat() {
+ return hubspotChat;
}
- public void setChatConfig(String chatConfig) {
- this.chatConfig = chatConfig;
+ public void setHubspotChat(HubspotChat hubspotChat) {
+ this.hubspotChat = hubspotChat;
}
-
@XmlElement(name = "Billing", required=true)
public Billing getBilling() {
return billing;
diff --git a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/HubspotHandler.java b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/HubspotHandler.java
index a9d97de3a5..b649d341fe 100644
--- a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/HubspotHandler.java
+++ b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/HubspotHandler.java
@@ -96,6 +96,7 @@ public class HubspotHandler extends HttpServlet {
*/
private boolean validateRequest(HttpServletRequest req, HttpServletResponse resp)
throws IOException {
+ httpSession = req.getSession(false);
if (httpSession == null) {
log.error("Unauthorized, You are not logged in. Please log in to the portal");
HandlerUtil.handleError(resp, HttpStatus.SC_UNAUTHORIZED);
@@ -106,14 +107,13 @@ public class HubspotHandler extends HttpServlet {
HandlerUtil.handleError(resp, HttpStatus.SC_BAD_REQUEST);
return false;
}
- httpSession = req.getSession(false);
gatewayUrl = req.getScheme() + HandlerConstants.SCHEME_SEPARATOR + System.getProperty(HandlerConstants.IOT_GW_HOST_ENV_VAR)
+ HandlerConstants.COLON + HandlerUtil.getGatewayPort(req.getScheme());
iotsCoreUrl = req.getScheme() + HandlerConstants.SCHEME_SEPARATOR + System.getProperty(HandlerConstants.IOT_CORE_HOST_ENV_VAR)
+ HandlerConstants.COLON + HandlerUtil.getCorePort(req.getScheme());
String uiConfigUrl = iotsCoreUrl + HandlerConstants.UI_CONFIG_ENDPOINT;
uiConfigJsonObject = HandlerUtil.getUIConfigAndPersistInSession(uiConfigUrl, gatewayUrl, httpSession, resp);
- chatConfig = uiConfigJsonObject.get("chatConfig").getAsString();
+ chatConfig = uiConfigJsonObject.get("hubspotChat").getAsJsonObject().get("accessToken").getAsString();
hubspotEndpoint = HandlerConstants.HTTPS_PROTOCOL + HandlerConstants.SCHEME_SEPARATOR + HandlerConstants.HUBSPOT_CHAT_URL;
return true;
}
diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml
index a87ef6e44e..d30f414885 100644
--- a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml
+++ b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml
@@ -24,8 +24,15 @@
3600
10000
-
- pat-na1-33bc59e0-3526-45b0-b9cf-f353d0ae0ced
+
+
+ false
+ tracking_url
+
+ access_token
+ sender_actorId
+ channel_AccountId
+
false
true