# Add scheduled callbacks Let your customers request a scheduled callback in your app using the Zoom Contact Center SDK for iOS. ## Start the scheduled callback service To start standard scheduled callback functionality, first [initialize the service](#initialize-the-standard-scheduled-callback-service), then fetch the service instance, and finally show the scheduled callback view. To initialize the standard scheduled callback service, create an instance of the `ZoomCCItem` class to set the `sdkType` property to `ZoomCCIInterfaceType_ScheduledCallback`. Include the `apiKey` from your Contact Center flow. ```objectivec ZoomCCItem *item = [ZoomCCItem new]; item.sdkType = ZoomCCIInterfaceType_ScheduledCallback; item.apiKey = APP_SCHEDULE_CALLBACK_API_KEY; ``` ```swift let item = ZoomCCItem.init() item.sdkType = .scheduledCallback item.apiKey = APP_SCHEDULE_CALLBACK_API_KEY ``` Next, fetch the scheduled callback service instance and set its delegate to receive callbacks from `ZoomCCSDK`. When the status of the service is `ZoomCCSDKStatus_Initial`, initialize the scheduled callback service by calling `initializeWithItem:` and `login`. The callback service then connects to the Contact Center server to fetch information. ```objectivec id scheduledCallbackService = [[ZoomCCInterface sharedInstance] scheduledCallbackService]; scheduledCallbackService.scheduledCallbackDelegate = self; if (scheduledCallbackService.status == ZoomCCSDKStatus_Initial) { [scheduledCallbackService initializeWithItem:item]; } ``` ```swift let scheduleService = ZoomCCInterface.sharedInstance().scheduledCallbackService() scheduleService.scheduledCallbackDelegate = self if (scheduleService.status == .initial) { scheduleService .initialize(with: item) } ``` To show the standard scheduled callback view, use this callback. The callback gets the view's instance and displays it. ```objectivec __weak typeof(self) wself = self; [scheduledCallbackService fetchUI:^(UIViewController * _Nonnull viewController) { [wself directShow:viewController]; }]; ``` ```swift scheduleService.fetchUI { vc in if (vc != nil) { self.navigationController?.pushViewController(vc!, animated: true) } } ``` ## End the scheduled callback service This method closes the view created by the SDK, then returns to the application view. The service instances created inside `ZoomCCSDK` are released after this method is called. ```objectivec [scheduledCallbackService endScheduledCallback]; ``` ```swift scheduledCallbackService.endScheduledCallback() ``` ## Callbacks These callbacks are available for scheduled callback functionality. - error - eventChange - loginStatusChanged ### `error` Sent after a service error. - service - the current service. - error - the service error code. See [errors](errors) for details. - detail - the error details. ```objectivec - (void)onService:(id)service error:(NSUInteger)error detail:(NSInteger)detail; ``` ```swift func onService(_ service: ZoomCCService, error: UInt, detail: Int) { } ``` ### `eventChange` Sent when a change has occurred, such as when a user requests or cancels a scheduled callback. - service - the current service. - event - the event that occurred. ```objectivec - (void)onService:(id)service eventChange:(ZoomCCSDKEvent)event; ``` ```swift func onService(_ service: ZoomCCService, eventChange event: ZoomCCSDKEvent) { } ``` ### `loginStatusChanged` Sent when the login status changes. - service - the current service. - status - the service status. `ZoomCCSDKStatus_Login` means the login succeeded. ```objectivec - (void)onService:(id)service loginStatusChanged:(ZoomCCSDKStatus)status; ``` ```swift func onService(_ service: ZoomCCService, loginStatusChanged status: ZoomCCSDKStatus) { } ```