Developers Network
Currently Being Moderated

iPhone Chat Application

NOTICE: Customers with access to the LP Mobile products, please find deployment documentation here: iOS | Basic Integration

By using the sample code below, you agree to the following terms and conditions:

You agree that you bear all risks associated with using or relying on any content or sample codes found in the code library. LivePerson does not warrant the accuracy, reliability, completeness, usefulness, non-infringement, or quality of any data or content found in the code library.  If you install or enable any content from the code library for use or for use with the services provided by LivePerson (“Services”), you acknowledge and agree that (1) the terms of any Master Services Agreement or any other Agreement in which LivePerson provides Services to you (“Services Agreement”), shall not apply to your use or download of any content from the code library, even if used for the interoperation with the Services provided to you by LivePerson under a Services Agreement and (2) LivePerson has no responsibility or liability for any content provided in the code library. The content provided in the code library is provided on an “AS IS” basis.  LivePerson will not support any of the content found in the code library.  LivePerson makes no warranty: that content in the code library will meet your requirements or expectations, (ii) that your access to the code library will be uninterrupted, timely or error-free, or (iii) any errors in the code library will be corrected.  LIVEPERSON EXPRESSLY DISCLAIMS ALL WARRANTIES OF ANY KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT RELATED TO YOUR USE OF THE CODE LIBRARY.


An application is a solution that is built on top of the LivePerson platform and is developed using LivePerson’s Open Platform architecture - Read more on Getting Started with Applications



This section contains two programs

  • An objective-C model that wraps the Chat API Rest calls, and implements that chat session's life time
  • An objective-C application that enables chat over an iPhone/iPod


The model can be used in different iPhone applications for utilizing the chat.


The application can be used as a demo or a proof of concept


Whats New:

- Bug fixes

- Support chat availability with parameters


  • "" - The source code of the model
  • "" - The source code of the chat application. It also contains the model's source code.

Getting Started

To write your own chat application, download the model and add the source files to your project.

For a working application example, download the iPhone app.


1. Initialization

Before you run the application, you should replace the default app key that comes with the demo with your own key

a. Ask for a key with Chat Rest privilage

b. Edit chatApp4Model.m and replace the appKey value with your own app key. The line to be chanmged is


    model = [[chatApp4Model alloc] initialize];
    model.skill = <ChatSkill>;
    model.siteid = <site id>;
    model.uri = @"";

2. checking agent availability

[model isAvailableForChat:@"Agent"]; - To check availability of a specific agent named "Agent"
[model isAvailableForChat:@"skill" maxWaitTime:0 queue:"serviceQueue"]; - To check availability of a specific skill named "skill" with maxWaitTime of 0 and serviceQueue named "serviceQueue". if skill or queue are not required, set them to nil. if no maxWaitTime is needed, set it to -1


3. Starting a Chat

[model startChat:@"IPhone_User"];


4. Stopping a Chat

[model stopChat];


5. Toggle the Chat State

[model toggleChat:@"IPhone_User"]


6. Send a Line

[model sendLine:chatLine.text];


7. Receive Chat Information - Returns a boolean indicating the agent typing status

[model getLines] - Returns a NSMutableArray* object that contains all the chat lines gathered by the model so far. It is the responsibility of the application developer not to display the same line twice

model.chatState - The chat state. It can be one of the following:

typedef enum{
chatEnded} chatStates;


Delete Document

Are you sure you want to delete this document?