Migration Guide
Migration Guide
Note: messaging
doesn't refer to the messaging channel, this is the name of the Classic SDK UI.
Migrating to Messaging 5.3.0
Messaging: 5.3.0
introduced a few changes within the SDK.
The following tables list the changes made from the old to new package name in Messaging
and Messaging API
.
Messaging Module
Old package name | New package name |
---|---|
zendesk.messaging.MessagingActivity | zendesk.classic.messaging.MessagingActivity |
zendesk.messaging.MessagingConfiguration | zendesk.messaging.MessagingConfiguration |
Messaging API Module
Old package name | New package name |
---|---|
zendesk.messaging.AttachmentSettings | zendesk.classic.messaging.AttachmentSettings |
zendesk.messaging.Banner | zendesk.classic.messaging.Banner |
zendesk.messaging.ConnectionState | zendesk.classic.messaging.ConnectionState |
zendesk.messaging.MenuItem | zendesk.classic.messaging.MenuItem |
zendesk.messaging.Update | zendesk.classic.messaging.Update |
Migrating from Chat v1 to Chat v2
If you're migrating from an older version of the Chat SDK (prior to v2), this guide will help to highlight some of the key differences.
Updating Dependencies
Before
implementation group: 'com.zopim.android', name: 'sdk', version: '1.4.8'
If you only want to use the SDK's API providers and no UI components, insert the following line instead in the dependencies section:
implementation group: 'com.zopim.android', name: 'sdk-api', version: '1.4.8'
After
Before the dependencies section, add the following repositories section:
repositories {
maven { url 'https://zendesk.jfrog.io/zendesk/repo' }
}
If you plan on using the SDK's built-in UI components, insert the following lines in the dependencies section:
dependencies {
implementation group: 'com.zendesk', name: 'chat', version: '3.4.0'
implementation group: 'com.zendesk', name: 'messaging', version: '5.4.0'
...
}
Note: messaging
doesn't refer to the messaging channel, this is the name of the Classic SDK UI.
If you only want to use the SDK's API providers and no UI components, insert the following line instead in the dependencies section:
dependencies {
implementation group: 'com.zendesk', name: 'chat-providers', version: '3.4.0'
...
}
For more information, see Add the Chat SDK dependencies.
Initializing the Chat SDK
The Chat SDK initialization should take place in the onCreate()
method of your application class. The initialization method takes the Context
and your account key (this can be obtained by asking the account owner).
Before
ZopimChat.init(String chatAccountKey);
After
//BaseApplication.java
Chat.INSTANCE.init(Context context, String chatAccountKey);
Adding visitor information
Before
VisitorInfo visitorInfo = new VisitorInfo.Builder()
.phoneNumber(String phoneNumber)
.email(String email)
.name(String name)
.build();
ZopimChat.setVisitorInfo(visitorInfo);
After
ProfileProvider profileProvider = Chat.INSTANCE.providers().profileProvider();
VisitorInfo visitorInfo = VisitorInfo.builder()
.withPhoneNumber(String phoneNumber)
.withEmail(String email)
.withName(String name)
.build();
profileProvider.setVisitorInfo(visitorInfo);
Setting the department
Before
final ZopimChat.SessionConfig config = new ZopimChat.SessionConfig()
.department(String departmentName);
After
ChatProvider chatProvider = Chat.INSTANCE.providers().chatProvider();
chatProvider.setDepartment(String departmentName, ZendeskCallback<Void> zendeskCallback);
// OR
chatProvider.setDepartment(long departmentId, ZendeskCallback<Void> zendeskCallback);
Starting the chat
Before
startActivity(new Intent(this, ZopimChatActivity.class));
After
// YourActivity.java
MessagingActivity.builder()
.withEngines(ChatEngine.engine())
.show(view.getContext());
For a full list of all the new methods, see the reference docs.
Sending a message
Before
ZopimChat.start(getActivity()).send("Your message");
After
chatProvider.sendMessage(String message);
Bot-centered conversational experience
The Chat SDK leverages the Unified SDK to present chat features to the user in a conversational flow. Pre-chat forms, offline forms, and customer satisfaction requests are all sent to the user through a chat bot. Though the bot resembles Answer Bot, it's not. See Configuring the chat bot.