Skip to content
This repository has been archived by the owner on May 25, 2022. It is now read-only.

Twilio Programmable Chat Demo Application for iOS

Notifications You must be signed in to change notification settings

twilio/twilio-chat-demo-ios

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This repository is deprecated

The new version of the Conversations Demo Application is available in twilio-conversations-demo-swift. It is an example of better app architecture and demonstrates best practices in implementing Twilio-based Conversations. Please use it instead of this one.

Chat Demo Application Overview

Getting Started

Welcome to the Chat Demo application. This application demonstrates a basic chat client with the ability to create and join channels, invite other members into the channels and exchange messages.

What you'll minimally need to get started:

The first step is to bring the .framework into the project. The easiest way to do this is to find the .framework in the tar.bz distribution and drag-n-drop it into the target's Embedded Frameworks section on the General settings tab.

Next, in the ChatManager.m file, find the line that Xcode will let you know is an error. Delete that #error line and fill in a client token in the line below:

return nil;

You can either paste in a client token you have generated elsewhere or update this portion of code to call out to a webservice you control that can generate tokens.

Additional Configuration of Chat Instance

In order to allow members of a channel other than a message's original author to add reactions to messages in this demo, you will need to permit any channel member to modify a message's attributes. In a non-sample application, this could be handled more securely with a call initiated by your backend server and the system user should you wish to use message attributes for sensitive data that an arbitrary channel member should not be able to modify.

To learn more about Roles and Channels, you can visit the Role documentation. A quick example of enabling editing of any message's attributes using curl is:

curl -XPOST https://chat.twilio.com/v1/Services/{service sid}/Roles/{role sid} \
    -d "FriendlyName=channel user" \ 
    -d "Permission=sendMessage" \ 
    -d "Permission=leaveChannel" \ 
    -d "Permission=editOwnMessage" \ 
    -d "Permission=editOwnMessageAttributes" \ 
    -d "Permission=deleteOwnMessage" \ 
    -d "Permission=editAnyMessageAttributes" \ 
    -u '{twilio account sid}:{twilio auth token}'