Updated 11 October 2021
If you are planning to make more user interaction with your application visitor or want to chat with the customer then this blog is for you.
In this blog, we are going to discuss the Zendesk chat integration in your android application. Zendesk chat allows fast and real-time conversation with the visitor.
It makes the application more attractive where the visitor can ask a question with agent regarding the application or the services offered by the chat interface.
We can use Zendesk chat in our android application with the use of Zendesk chat SDK.
Firstly start with adding zendesk repositories in your project build.gradle file:
1 2 3 4 5 |
allprojects { repositories { maven { url 'https://zendesk.jfrog.io/zendesk/repo' } } } |
Now next we need to add the Gradle dependency to your app/module build.gradle file:
1 2 |
implementation group: 'com.zendesk', name: 'chat', version: '3.1.0' implementation group: 'com.zendesk', name: 'messaging', version: '5.1.0' |
In this integration, we are using the SDK built-in UI components so that we have used two bove dependencies.
Make sure you are using the minimum API level 16 and above for your application.
After successful installation of the initial setup it’s time to initialize the Zendesk SDK on your main activity just like below:
1 2 3 4 |
fun initZopim() { Chat.INSTANCE.init(applicationContext, "Your Zendesk Account key", "Your application id") } |
You can follow this link for getting your Zendesk account key.
Now we have initialized our chat SDK now it’s time to configure the SDK data like:
1 2 3 4 5 |
val chatConfiguration = ChatConfiguration.builder() .withAgentAvailabilityEnabled(false) .withOfflineFormEnabled(true) .withPreChatFormEnabled(false) .build() |
Zendesk chat SDK provides ChatConfiguration.builder() for configuring the chat SDK with the help of this we can enable or disable the chat features.
withAgentAvailabilityEnabled is true by default visitor will be informed that no agent is available to serve if its value is true. If we set the value false then the visitor will wait in the queue for the visitor.
withOfflineFormEnabled flag allows us to leave a message to the agent if no agent is available.
withPreChatFormEnabled flag allows visitors to inform the details in a conversational way by default its value is true.
We can also set the profile details of the visitor by visitorInfo.builder() and profileProvider set the details for chat session like below:
1 2 3 4 5 6 7 8 |
val profileProvider = Chat.INSTANCE.providers()!!.profileProvider() val visitorInfo = VisitorInfo.builder() .withName("Visitor name") .withEmail("Visitor email") .withPhoneNumber("Visitor phone number") .build() profileProvider.setVisitorInfo(visitorInfo, null) |
The final step is to start the chat with the help of messaging interface with our chatConfiguration like below:
1 2 3 |
MessagingActivity.builder() .withEngines(ChatEngine.engine()) .show(mFragmentContext.requireContext(), chatConfiguration) |
In this blog, we have learned about the Zendesk chat integration in android for making the chat with your visitor For more information regarding the Zendesk chat you can follow the link.
Thanks for reading this blog. You can also check other blogs from here.
If you have more details or questions, you can reply to the received confirmation email.
Back to Home
Be the first to comment.