Campaigns
Add campaigns to video, chat, scheduled, or virtual agent views. First request the campaign, then use the target campaign as an entry, and finally start the callback.
Request the campaign
Use the API defined in the ZoomCCInterface class to retrieve campaigns using CampaignApiKey.
Get the CampaignApiKey value from your Contact Center admin, who can find this at Campaign Management > Web and In-App > </>Embed Web Tag.
val service = ZoomCCInterface.getZoomCCWebCampaign()
service.init(
ZoomCCItem(
apiKey = CampaignApiKey,
sdkType = ZoomCCIInterfaceType.CAMPAIGN,
serverType = CCServerType.CCServerWWW
)
)
val ret = service.requestCampaign {
campaignInfoList = it
updateUI(it)
}
ZoomCCWebCampaignService service = ZoomCCInterface.INSTANCE.getZoomCCWebCampaignService();
service.init(new ZoomCCItem(null, apiKey, ZoomCCIInterfaceType.CAMPAIGN, serverType));
int ret = service.requestCampaign(result -> {
campaignInfoList = result;
return null;
});
Use the target campaign as an entry
After fetching all the campaigns, choose one ZoomCCCampaignInfocampaignInfo and use it as an entry to the chat, video, scheduled callback, or virtual agent channel.
The campaignInfo's translatedCampaignChannels property is an array that contains all channel types: ZoomCCIInterfaceType_Chat, ZoomCCIInterfaceType_Video, ZoomCCIInterfaceType_ZVA, and ZoomCCIInterfaceType_ScheduledCallback.
private fun initWithInterfaceType(type: ZoomCCIInterfaceType, info: ZoomCCCampaignInfo) {
when (type) {
ZoomCCIInterfaceType.CHAT -> createChatEntry(info)
ZoomCCIInterfaceType.ZVA -> createZVAEntry(info)
ZoomCCIInterfaceType.VIDEO -> createVideoEntry(info)
ZoomCCIInterfaceType.SCHEDULED_CALLBACK -> createScheduledCallbackEntry(info)
else -> {}
}
}
private void initWithInterfaceType(ZoomCCIInterfaceType type, ZoomCCCampaignInfo info) {
switch (type) {
case CHAT:
createChatEntry(info);
break;
case ZVA:
createZVAEntry(info);
break;
case VIDEO:
createVideoEntry(info);
break;
case SCHEDULED_CALLBACK:
createScheduledCallbackEntry(info);
break;
}
}
Start the chat, video, scheduled, or virtual agent callbacks
Show the chat view in the campaign mode
- Create a
ZoomCCItemclass instance. - Set the item's
sdkTypetoZoomCCIINterfaceType_Chat. - Set the item's
apiKeytoAPP_CAMPAIGN_API_KEY. - Set the item's
useCampaignModeproperty toYES. - Set the item's
campaignInfoproperty tocampaignInfo. - Get
chatServiceand end the previouschatServiceif needed. - Initialize
chatServicewith the item previously created and log in withchatServiceif its status isZoomCCSDKStatus_Initial. - Fetch and show the chat view using
chatService'sfetchUIAPI.
private fun createChatEntry(info: ZoomCCCampaignInfo) {
var service = ZoomCCInterface.getZoomCCChatService()
service.getZoomCCItem()?.campaignInfo?.let { if (info.campaignId != it.campaignId) {
service.endChat()
service = ZoomCCInterface.getZoomCCChatService()
}
} service.init(
ZoomCCItem(
apiKey = apiKey,
sdkType = ZoomCCIInterfaceType.CHAT,
serverType = serverType,
useCampaignMode = true,
campaignInfo = info
)
)
service.login()
service.fetchUI()
}
private void createChatEntry(ZoomCCCampaignInfo info) {
ZoomCCChatService service = ZoomCCInterface.INSTANCE.getZoomCCChatService();
ZoomCCItem item = service.getZoomCCItem();
if (item != null && item.getCampaignInfo() != null) {
if (Objects.equals(info.getCampaignId(), item.getCampaignInfo().getCampaignId())) {
service.endChat();
service = ZoomCCInterface.INSTANCE.getZoomCCChatService();
}
}
service.init(new ZoomCCItem(null, apiKey, ZoomCCIInterfaceType.CHAT, serverType, true, info));
service.login();
service.fetchUI();
}
Show the virtual agent chat view in the campaign mode
- Create a
ZoomCCItemclass instance. - Set the item's
sdkTypetoZoomCCIINterfaceType_ZVA. - Set the item's
apiKeytoAPP_CAMPAIGN_API_KEY. - Set the item's
useCampaignModeproperty toYES. - Set the item's
campaignInfoproperty tocampaignInfo. - Get
zvaServiceand end the previouszvaServiceif needed. - Initialize
zvaServicewith the item previously created, and log in withzvaServiceif its status isZoomCCSDKStatus_Initial. - Fetch and show the virtual agent view using
zvaService'sfetchUIAPI.
private fun createZVAEntry(info: ZoomCCCampaignInfo) {
var service = ZoomCCInterface.getZoomCCZVAService()
service.getZoomCCItem()?.campaignInfo?.let { if (info.campaignId != it.campaignId) {
service.endChat()
service = ZoomCCInterface.getZoomCCZVAService()
}
} service.init(
ZoomCCItem(
apiKey = apiKey,
sdkType = ZoomCCIInterfaceType.ZVA,
serverType = serverType,
useCampaignMode = true,
campaignInfo = info
)
)
service.fetchUI()
}
private void createZVAEntry(ZoomCCCampaignInfo info) {
ZoomCCChatService service = ZoomCCInterface.INSTANCE.getZoomCCZVAService();
ZoomCCItem item = service.getZoomCCItem();
if (item != null && item.getCampaignInfo() != null) {
if (Objects.equals(info.getCampaignId(), item.getCampaignInfo().getCampaignId())) {
service.endChat();
service = ZoomCCInterface.INSTANCE.getZoomCCZVAService();
}
}
service.init(new ZoomCCItem(null, apiKey, ZoomCCIInterfaceType.ZVA, serverType, true, info));
service.fetchUI();
}
Show the video view in the campaign mode
- Create a
ZoomCCItemclass instance. - Set the item's
sdkTypetoZoomCCIINterfaceType_Video. - Set the item's
apiKeytoAPP_CAMPAIGN_API_KEY. - Set the item's
useCampaignModeproperty toYES. - Set the item's
campaignInfoproperty tocampaignInfo. - Get
videoServiceand end the previousvideoServiceif needed. - Set
videoPreviewOptionsandautoJoinWhenVideoCreatedproperty ofvideoService. - Initialize
videoServicewith the item previously created if its status isZoomCCSDKStatus_Initial. - Fetch and show the video view using
videoService'sfetchUIAPI.
private fun createVideoEntry(info: ZoomCCCampaignInfo) {
var service = ZoomCCInterface.getZoomCCVideoService()
service.getZoomCCItem()?.campaignInfo?.let { if (info.campaignId != it.campaignId) {
// no need to executive service.endVideo()
ZoomCCInterface.releaseZoomCCService(service.getKey())
service = ZoomCCInterface.getZoomCCVideoService()
}
} service.init(
ZoomCCItem(
apiKey = apiKey,
sdkType = ZoomCCIInterfaceType.VIDEO,
serverType = serverType,
useCampaignMode = true,
campaignInfo = info
)
)
service.setVideoPreviewOption(VideoPreviewOption.ZmCCVideoPreviewOptionDefault)
service.setAutoJoinWhenVideoCreated(false)
service.setUseBackwardFacingCameraByDefault(false)
service.addListener(object : ZoomCCVideoListener {})
service.fetchUI()
}
private void createVideoEntry(ZoomCCCampaignInfo info) {
ZoomCCVideoService service = ZoomCCInterface.INSTANCE.getZoomCCVideoService();
ZoomCCItem item = service.getZoomCCItem();
if (item != null && item.getCampaignInfo() != null) {
if (Objects.equals(info.getCampaignId(), item.getCampaignInfo().getCampaignId())) {
// no need to executive service.endVideo()
ZoomCCInterface.INSTANCE.releaseZoomCCService(service.getKey());
service = ZoomCCInterface.INSTANCE.getZoomCCVideoService();
}
}
service.init(new ZoomCCItem(null, apiKey, ZoomCCIInterfaceType.VIDEO, serverType, true, info));
service.setVideoPreviewOption(VideoPreviewOption.ZmCCVideoPreviewOptionDefault);
service.setAutoJoinWhenVideoCreated(false);
service.setUseBackwardFacingCameraByDefault(false);
service.addListener(new ZoomCCVideoListener() {
@Override public void onClientEvent(@NonNull ClientEvent clientEvent) {}
@Override public void onEngagementEnd(@NonNull String s) {}
@Override public void onEngagementStart(@NonNull String s) {}
@Override public void onError(int i, long l, @NonNull String s) {}
@Override public void onLoginStatus(@Nullable IMStatus imStatus) {}
@Override public void unreadMsgCountChanged(int i) {}
});
service.fetchUI();
}
Show the scheduled callback view in the campaign mode
- Create a
ZoomCCItemclass instance. - Set the item's
sdkTypetoZoomCCIINterfaceType_ScheduledCallback. - Set the item's
apiKeytoAPP_CAMPAIGN_API_KEY. - Set the item's
useCampaignModeproperty toYES. - Set the item's
campaignInfoproperty tocampaignInfo. - Initialize
scheduledCallbackServicewith the item previously created, and log in withchatService. - Fetch and show the scheduled callback view using
scheduledCallbackService'sfetchUIAPI.
private fun createScheduledCallbackEntry(info: ZoomCCCampaignInfo) {
val service = ZoomCCInterface.getZoomCCScheduledCallbackService()
service.init(
ZoomCCItem(
apiKey = apiKey,
sdkType = ZoomCCIInterfaceType.SCHEDULED_CALLBACK,
serverType = serverType,
useCampaignMode = true,
campaignInfo = info
)
)
service.fetchUI()
}
private void createScheduledCallbackEntry(ZoomCCCampaignInfo info) {
ZoomCCScheduledCallbackService service = ZoomCCInterface.INSTANCE.getZoomCCScheduledCallbackService();
service.init(new ZoomCCItem(null, apiKey, ZoomCCIInterfaceType.SCHEDULED_CALLBACK, serverType, true, info));
service.fetchUI();
}