Twilio Conversations Client SDKs
Twilio Conversations provides client-side SDKs for browser-based web applications, as well as for native iOS and Android applications.
JavaScript SDK
The latest version of the JavaScript SDK for Conversations is available on Twilio’s CDN. To use it with your web page, simply add the following
script
tag:
<script src="https://media.twiliocdn.com/sdk/js/conversations/releases/1.0.0/twilio-conversations.min.js" integrity="sha256-wwGP7TgNRaTpRZj6r7CM/ZPMa/mMj44/QRLQNnQMJjU=" crossorigin="anonymous"></script>
The Twilio.Conversations
namespace will then be available in the window scope of your JavaScript application.
The JS Conversations SDK is also available from NPM:
iOS SDK
The Conversations SDK for iOS is available through the CocoaPods and Carthage dependency managers, or by direct download.
CocoaPods
To install the SDK using CocoaPods, add the following to your Podfile
, changing MyTarget
to the name of your target:
source 'https://github.com/CocoaPods/Specs' target 'MyTarget' do pod 'TwilioConversationsClient', '~> 1.1' end
Carthage
We support integration using Carthage binary frameworks. You can add Twilio Conversations for iOS by adding the following line to your Cartfile
:
github "twilio/conversations-ios"
Then run carthage bootstrap
, or carthage update
if you are updating your SDKs.
The .framework
file(s) will be downloaded to the Carthage/Build/iOS
directory. Finally, you will need to complete integration, as outlined below below.
Direct download
We also offer the iOS SDK frameworks for direct download. There are several steps you’ll need to complete to successfully add Conversations to your project:
- Download the Conversations Client framework (sha256: 09f63c1562eb63c84c456dfc77df46648bcc00f1fbf97b8dd19cfe72cab53998).
Expanding the downloaded .tar.bz2
file and locate the .framework
file(s) inside the directory created. Finally, you will need to complete integration, as outlined below below.
Complete framework integration
The following tasks are done for you if you are using CocoaPods, but are required if you are using Carthage or downloaded the SDK manually.
Drag the .framework
file(s) into your Xcode project, making sure they are dropped in the Frameworks, Libraries, and Embedded Content section of your project target’s settings. Make sure you select Copy items if needed when prompted. If the framework files do not appear under Frameworks, Libraries, and Embedded Content for your target, you will receive a Reason: image not found"
error during compilation.
In the same section, please also add libc++.tbd
as a dependency to your target if it is not already there.
Our frameworks include both device and simulator versions of the SDK to ease integration at development time. The App Store only supports device symbols at submission time, so you must remove the simulator symbols at export time, or you will receive an Unsupported Architectures
error during app submission. We include a script to help with this inside the framework which your project can use during packaging:
- Open your target’s settings.
- Select Build Phases.
- Click on the + and select New Run Script Phase. Move the new Run Script item to below the Embed Frameworks item if it is not added there automatically.
- Set the command to run to:
bash "${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH} \ /TwilioConversationsClient.framework/remove_archs"
Android SDK
The Twilio Conversations Android SDK is distributed as a direct download from Twilio’s CDN. It can also be installed via Maven or directly within a Gradle build file using JCenter.
Note Your Android project needs compatibility with Java 8 language features. If you have not already done so, add the following section to the android
module in your build.gradle
file:
android { ... compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } ... }
Direct download
- Download the Twilio Conversations Client library for Android (sha256: 0de52b367c1f3494ef6d2b6b6e2264e23452bb65f3672072acdaac9727ba9495).
JCenter
- Twilio Conversations JCenter link: Twilio Android Conversations
Gradle
To install the SDK using a Gradle build file, include the following in your Gradle build file:
allprojects { repositories { jcenter() } } /** * Declare dependencies * @see http://www.gradle.org/docs/current/userguide/userguide_single.html#sec:how_to_declare_your_dependencies */ dependencies { implementation 'com.twilio:conversations-android:1.2.0' }
Need some help?
We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd browsing the Twilio tag on Stack Overflow.