How to embed a web widget in an existing iOS app using Conversation Management's SDK
Embed Conversation Management's iOS SDK to use the widget in your iOS app, communicate with agents, or use the chatbot within your existing mobile app.
Last updated
Embed Conversation Management's iOS SDK to use the widget in your iOS app, communicate with agents, or use the chatbot within your existing mobile app.
Last updated
Adding a chatbot to your application involves the following three steps:
Importing the framework
Adding the code
Passing custom payloads
To start importing the framework, follow these steps:
Click here
to download the .framework
file into your system. Now suppose you have a project named SampleProject
in which you have to integrate the framework so you have to go to the project path in Finder and paste your downloaded framework below the .xcodeproject
or .xcworkspace
file:
2. Now add the framework in our project. Open the project in Xcode and select SampleProject from the project navigator pane. Then navigate to TARGETS > General and click the + icon under the Framework, Libraries, and Embedded Content section:
3. A drop-down menu will appear asking to choose the framework. Click on the Add Other... option and then click the Add Files… option:
4. Now, navigate to your project path and select the QWChatFramework.framework
file which we have copied in Step 1 and click Open:
5. You can see the framework in your project navigator tab under the Frameworks
folder:
1. First, disable the bitcode of your project. To do this, select the SampleProject
from the project navigator pane. Then go to Build Options and search for the Enable Bitcode option. Click No to disable it:
2. Now, search for the Build Phase option and click the + button. Select the New Run Script Phase option from the drop-down menu options:
3. The Run Script window will open. Copy and paste the following code into the script area: So it will look like the below figure:
5. Now right click on your info.plist
file in the project navigator pane. Select Open As > Source Code option:
6. Copy and paste the following code in the info.plist
source code. It is illustrated in the following figure:
The following code is for the allowance of location permission in iOS device. It is editable as per your requirements
You have successfully added the framework in your project. Now import QWChatFramework
in your swift file and you can use the below code for our Chat Screen:
To use these, go to the Inboxes window where the script for your inbox is generated. Scroll down and copy the messenger script that has custom payloads with keywords such as name
, email
, created_at
, and custom_payload
under the settings
object:
.name
: The genuine name of the user you want to get reflected in the support panel. E.g., John Doe.
.emailId
: The genuine email address of the user. E.g., johndoe@gmail.com.
.created_at
: The accurate timestamp of the conversation being created. E.g., Mon March 23 2020 17:01:15 GMT+0530.
.custom_payload
: An object of payloads that you want to pass. It could be an information related to sign up, login details or could contain a set of login credentials of a user.
Now, add the above given on the listener of the button (web widget) via which you want to open the bot.