Running the Support engine

The Support engine handles the creation of Support tickets through the Messaging SDK. It is primarily intended for use in conjunction with the Answer Bot engine but can be used by itself.

How the Support engine works

On starting, the Support engine checks for any previous conversation data (such as an Answer Bot interaction). If found, it uses the data for the body of the ticket to be created. If it doesn't find any previous conversation data, the engine asks the user to enter their query.

Support engine prompts for a message

If the Conversations setting is not enabled in Zendesk Support and the SDK is configured with an anonymous identity with no email address, then the Support engine prompts the user for an email address. Because tickets can't be viewed in the SDK when the Conversations setting is turned off, email is the only way a user can receive a reply.

Support engine prompts for, and validates, an email address

Once the Support engine has a message from the user (and an email address, if required), it creates a ticket in Support. If the Conversations setting is enabled, the Support engine shows a link to the Support SDK RequestListViewController. If Conversations is disabled, the Support engine simply confirms that the ticket has been created.

Support engine confirms a ticket has been created, and links to the request list screen Support engine confirms a ticket has been created

The Support engine can't be used to view or update existing tickets yet. Once the ticket has been created, the Support SDK's RequestController must be used to view or update it.

Starting the Support engine

Note: Make sure to add the Unified SDK dependency, initialise the SDK, and identify your user.

First, import the necessary dependencies:

Swift

import SupportSDKimport MessagingSDKimport MessagingAPIimport SDKConfigurations

Objective-C

#import <MessagingSDK/MessagingSDK.h>#import <SupportSDK/SupportSDK.h>#import <MessagingAPI/MessagingAPI.h>#import <SDKConfigurations/SDKConfigurations.h>

Second, get an instance of SupportEngine:

Swift

do {  	let supportEngine = try SupportEngine.engine()} catch {   // do something with error}

Objective-C

NSError *error = nil;ZDKSupportEngine *supportEngine = [ZDKSupportEngine engineAndReturnError:&error];

Running the engine by itself

To start the Support engine by itself on the Messaging screen, pass your SupportEngine instance to the buildUI method on Messaging to get an instance of an UIViewController:

Swift

do {   let messagingConfiguration = MessagingConfiguration()   let supportEngine = try SupportEngine.engine()   let viewController = try Messaging.instance.buildUI(engines: [supportEngine], configs: [messagingConfiguration])   self.navigationController?.pushViewController(viewController, animated: true)} catch {   // do something with error}

Objective-C

- (void) startConversation {    NSError *error = nil;    NSArray *engines = @[ (id <ZDKEngine>) [ZDKSupportEngine engineAndReturnError:&error] ];
    ZDKClassicMessagingConfiguration *messagingConfiguration = [ZDKClassicMessagingConfiguration new];    UIViewController *viewController = [[ZDKClassicMessaging instance] buildUIWithEngines:engines                  configs:@[messagingConfiguration]                  error:&error];    [self.navigationController pushViewController:viewController animated:YES];}

Running Support with other engines

To use the Support engine in conjunction with the Answer Bot and Chat engines, obtain an instance of the desired engines and pass them with the buildUI method:

Swift

do {	let messagingConfiguration = MessagingConfiguration()	let answerBotEngine = try AnswerBotEngine.engine()	let supportEngine = try SupportEngine.engine()  let chatEngine = try ChatEngine.engine()	let viewController = try Messaging.instance.buildUI(engines: [answerBotEngine, chatEngine, supportEngine],											configs: [messagingConfiguration])	self.navigationController?.pushViewController(viewController, animated: true)} catch {	// do something with error}

Objective-C

- (void) startConversation {    NSError *error = nil;    NSArray *engines = @[        (id <ZDKEngine>) [ZDKAnswerBotEngine engineAndReturnError:&error],        (id <ZDKEngine>) [ZDKSupportEngine engineAndReturnError:&error],        (id <ZDKEngine>) [ZDKChatEngine engineAndReturnError:&error],    ];    ZDKClassicMessagingConfiguration *messagingConfiguration = [ZDKClassicMessagingConfiguration new];    UIViewController *viewController = [[ZDKClassicMessaging instance] buildUIWithEngines:engines                   configs:@[messagingConfiguration]                   error:&error];    [self.navigationController pushViewController:viewController animated:YES];}

Place the answerBotEngine object before any other engine. This is important because the Unified SDK starts the first engine in the list and any subsequent engines are treated as potential contact options. Answer Bot can hand over to Support and Chat, but no other engine can hand over to Answer Bot. This means answerBotEngine must be placed first in the list or else it will never be started.

Using the standalone Support SDK

If the Support engine doesn't suit your use case or you want your users to be able to continue the ticket conversation in your app, you can use the Support SDK's own RequestController and RequestListViewController. See Adding tickets in the Support SDK documentation for more details.

Using the Support API providers

If neither the Support engine nor the standalone Support SDK UI suit your use case, you can use the Support SDK's API providers instead and build your own UI. See the API providers reference in the Support SDK documentation.