Prepare for Mobile Chatbots
In this project, you’ll:
- Set up Chat and Einstein Bots in your org.
- Build a native iOS app, using Xcode, that provides the chatbot experience.
- Make your chatbot smarter with a contextual response.
Why Build a Chatbot?
There are many channels for your agents to engage with customers. Email, social media, messaging—these channels aren’t going away anytime soon. How are you using these to focus your agents on helping with the complex issues they are uniquely skilled for? Are there any predictable customer needs that can be resolved effectively before they even get to an agent?
Now that smart devices are becoming more ubiquitous in our homes, you’re undoubtedly familiar with some tasks that computers are far faster at solving than humans. For instance, you can check the weather or set a timer using Siri on your iPhone in a few seconds.
Similarly, chatbots are a great way to enhance a chat session, taking advantage of things that computers are extremely fast at doing like looking up and presenting information. Whether it’s through machine learning and natural language processing, or just by using a clean, automated menu system, a chatbot can make life easier for you and your customers.
Salesforce provides you with Einstein Bots for chat and messaging to get this done.
Why Go Native Mobile?
Your customers are often on their mobile devices when looking for support. One part of your mobile solution might include making your website mobile-friendly. But oftentimes, the best user experience on a mobile device comes from a mobile app that is natively designed for the platform.
Among other things, customer service in a native app enables a seamless experience right on the mobile device. With the Embedded Service SDK you can add chat and chatbots directly into your native iOS mobile app. You can even brand the chat experience so that it fits naturally within the app you’ve already designed for your customers.
Get the IDE and SDK
This project helps you get your org set up for chatbots. Then we build an iOS app that can launch a chatbot session and let you take advantage of your bot from within a native mobile iOS app.
Before we’re ready to dig into our mobile app:
- Download the Xcode Integrated Developer Environment (IDE) from the Mac App Store if you don’t have it on your machine. This is where you build apps for Apple products including iPhone, iPad, Apple Watch, Apple TV, and Mac—all from one place.
- Download the Service SDK framework files from the Service SDK download page. We recommend using the manual download option. More on that later.
It can take a while for Xcode to download. While that’s happening, feel free to continue on with this project. You won’t need the IDE or SDK until the next step.
Launch Your Trailhead Playground
To complete this project, you need a free Trailhead Playground. We recommend you create a brand-new one for this project. You can find it at the bottom of this page. Click Create a Trailhead Playground to open a new Trailhead Playground in a new browser tab.
It can take a few minutes for it to become available. Sit tight. Once it’s ready, make sure it’s selected, indicated by a checkmark. Then click the Launch button.
Set Up Chat
There’s a guided setup flow that helps you set up web chat in just a few minutes. Head over to Service Setup and follow the Chat setup flow.
- Click the Setup gear icon and select Service Setup.
- Under Recommended Setup, click View All.
- In the search box, enter
Chat, and select Chat with Customers.
- After you read the overview page, click Start.
- Set up your queue.
- Queue Name:
- Name This Agent Group:
- Select yourself and any other members to add to this group.
- Click Next.
- Queue Name:
- If you’re asked to prioritize chats with your other work, enter the routing configuration name
Chatsand give it a priority of
1. Then click Next.
- Now it’s time to set capacity and workload. We want agents to be productive, but not burn out. In a real-world scenario, you may need to monitor agent workload and adjust this over time, based on case volume and agent feedback.
- Work Item Size:
- Agent Capacity:
- Click Next.
- Work Item Size:
- Let’s make it work for the web. The idea is if your customer can access chat from the web, they can access it everywhere.
- Website URL:
https://*.force.com(when setting this up for your business, this would be the URL for your website).
- Salesforce Site Domain: Type a domain prefix in the text field in order to create a new, unique domain.
- Website URL:
- For the type of chat, select Service then click Next.
- Choose whether you want to provide offline support for customers. For this project, leave it
Offand click Next.
- Copy the code snippet by clicking Copy to Clipboard and paste it in a text editor. You need to extract a few pieces of information from this code snippet to use for later. You’ll be able to track down this information afterward, but it’s easier at this point in the process. So paste the snippet in a text editor... right now.
- Click Next and then Done.
Record Configuration Information
You should have pasted the code snippet into a text editor. If not, do so now.
Find and make note of the following configuration information from the
- Chat Endpoint Hostname (POD Name)—This value is the hostname of the
baseLiveAgentURLproperty. When copying the hostname, be sure not to include the protocol or the path. For instance, if the value for
https://d.la2.salesforceliveagent.com/chat, then the hostname is
d.la2.salesforceliveagent.com. This is referred to as your POD Name when you do your work in Swift and Xcode.
- Org ID—If you don’t already know this value, it is the fourth argument in the
- Deployment ID—This value can be found in the
- Button ID—This value can be found in the
Save these four pieces of information for the next unit, where we configure the SDK.
You just finished setting up chat. And Omni-Channel. And Snap-Ins. Whoah!
Enable Einstein Bots
Now that we’ve got our chat implementation ready, we can enable our chatbot and start chatting with it from the web, from a community, or from a mobile device! That’s right. This is a very powerful and wide-reaching feature we’re working with here.
- From Service Setup, enter
Einstein Botsin Quick Find and select Einstein Bots.
- In the Settings area, set the Einstein Bots switch to On. If you’re enabling the bot for the first time, you are asked to accept the terms. Go ahead and check the box indicating you’re authorized and then click Try Einstein.
- Make sure that the Bot Options Menu is enabled—click the dropdown arrow for this option, click Edit, check the corresponding box, and click Save.
- Click New from the Einstein Bots setup page.
- Click Next.
- When prompted, provide basic information about the bot, then click Next. You do this several times.
Einstein Bot Name
Chatbot for iOS
Einstein Bot Greeting Message
Hi! I’m an Einstein Bot. How can I help you?
Main Menu Item 1
Main Menu Item 2
Main Menu Item 3
Leave this field blank.
- Click Create, then Finish. When your new bot is ready, you’re taken to the Einstein Bot Builder.
- Add a channel for your bot.
- Click the dropdown on the top left of the Einstein Bot Builder and select Overview.
- In the Channels section, click Add.
- Channel: Chat
- Deployment: Chat Agents
- Click Save. Now, instead of going directly to an agent, customers are first connected to your bot.
- Leave Require Agent Online set to
Off. This is ideal when your agents work limited hours and you want the bot working 24x7. We’re also leaving this deselected so we can test the bot without having to set up the agent side of the chat implementation.
- To activate your bot, click Activate.
You did it! Your bot is now ready to use. If you want to play around with the bot before building the mobile app, check out the recipes in the Bot Cookbook Developer Guide.