Unofficial LP Data API Wrapper
Project description
lp_api_wrapper: Unofficial LivePerson API Python Wrapper
lp_api_wrapper is a native Python library to interface with LivePerson's APIs. All methods will return decoded JSON in native Python data structures.
The following APIs are supported:
- Messaging Interactions API
- conversations - 1 offset of data in start date range
- all_conversations - All offsets of data in start date range
- get_conversation_by_conversation_id
- get_conversations_by_consumer_id
- Engagement History API
- engagements - 1 offset of data in start date range
- all_engagements - All offsets of data in start date range
- Agent Metrics API
- agent_status
- summary
- Messaging Operations API
- messaging_conversation
- messaging_current_queue_health
- messaging_queue_health
- messaging_csat_distribution
- Operational Realtime API
- queue_health
- engagement_activity
- agent_activity
- current_queue_state
- sla_histogram
- Predefined Content API
- get_predefined_content_items
- Predefined Categories API
- categories_list
Installation
$ pip install --upgrade lp_api_wrapper
Import lp_api_wrapper
# For Messaging Interactions API from lp_api_wrapper import MessagingInteractions # For Engagement History API from lp_api_wrapper import EngagementHistory # For Agent Metrics API from lp_api_wrapper import AgentMetrics # For Messaging Operations API from lp_api_wrapper import MessagingOperations # For Operational Realtime API from lp_api_wrapper import OperationalRealtime # For Predefined Content API from lp_api_wrapper import PredefinedContent # For Predefined Categories API from lp_api_wrapper import PredefinedCategories
Login/Authentication
Each class in lp_api_wrapper accepts user login or oauth1 authentication.
Login via the Login Service API: https://developers.liveperson.com/login-getting-started.html
from lp_api_wrapper import UserLogin auth = UserLogin( account_id='1234', username='YOURUSERNAME', password='YOURPASSWORD' )
Or, login using OAuth1 authentication
from lp_api_wrapper import OAuthLogin auth = OAuthLogin( account_id='1234', app_key='APP_KEY', app_secret='APP_SECRET', access_token='ACCESS_TOKEN', access_token_secret='ACCESS_TOKEN_SECRET' )
Messaging Interactions API
Create Messaging Interactions Connection
from lp_api_wrapper import MessagingInteractions mi_conn = MessagingInteractions(auth=auth)
1. Conversations
Documentation:
Note!
- Will return 1 offset of data.
Arguments:
- body: dict (Note: Check reference for details.)
- offset: int (Default: 0)
- limit: int (Default: 100)
- sort: str (Default: None)
body = {'start': {'from': 1491004800000, 'to': 1491091199000}} data = mi_conn.conversations(body)
2. All Conversations
Documentation:
Note!
- Will return all offsets of data as a list of conversations.
Arguments:
- body: dict (Note: Check reference for details.)
- max_workers: int (Max number of API requests at a time. Default:7)
- debug: int (Status of API requests: 1=full, 2=summary, default=0)
- parse_data: bool (Parses data and returns a Conversations data object. Default: False)
body = {'start': {'from': 1491004800000, 'to': 1491091199000}} data = mi_conn.all_conversations(body)
2. Get conversation by conversation id
Documentation:
Arguments:
- conversation_id: str
data = mi_conn.get_conversation_by_conversation_id(conversation_id='1234abc')
3. Get conversation by consumer id
Documentation:
Arguments:
- consumer_id: str
data = mi_conn.get_conversations_by_consumer_id(consumer_id='1234abc')
Engagement History API
Create Engagement History Connection.
from lp_api_wrapper import EngagementHistory mi_conn = EngagementHistory(auth=auth)
1. Engagements
Documentation:
Note!
- Will return 1 offset of data.
Arguments:
- body: dict (Note: Check reference for details.)
- offset: int (Default: 0)
- limit: int (Default: 100)
- sort: str (Default: None)
body = {'start': {'from': 1491004800000, 'to': 1491091199000}} data = eh_conn.engagements(body)
2. All Engagements
Documentation:
Note!
- Will return all offsets of data as a list of engagements.
Arguments:
- body: dict (Note: Check reference for details.)
- max_workers: int (Max number of API requests at a time. Default:7)
- debug: int (Status of API requests: 1=full, 2=summary, default=0)
- parse_data: bool (Parses data and returns an Engagements data object. Default: False)
body = {'start': {'from': 1491004800000, 'to': 1491091199000}} data = eh_conn.all_engagements(body)
Agent Metrics API
Create Agent Metrics Connection.
from lp_api_wrapper import AgentMetrics am_conn = AgentMetrics(auth=auth)
1. Agent Status
Documentation:
Note!
- If all are left blank, this method will return all agents' status for the account.
Arguments:
- status: List[str] (Default: None)
- agent_ids: List[str] (Default: None)
- skill_ids: List[str] (Default: None)
- agent_group_ids: List[str] (Default: None)
- agent_presence: bool (Default: None)
- connection_states: List[str] (Default: None)
data = am_conn.agent_status(skill_ids=['1234', '5678'])
2. Summary
Documentation:
Note!
- If all are left blank, this method will return the status for the account.
Arguments:
- status: List[str] (Default: None)
- agent_ids: List[str] (Default: None)
- skill_ids: List[str] (Default: None)
- agent_group_ids: List[str] (Default: None)
data = am_conn.summary()
Messaging Operations API
Create Messaging Operations Connection.
from lp_api_wrapper import MessagingOperations mo_conn = MessagingOperations(auth=auth)
1. Messaging Conversation
Documentation:
Arguments:
- time_frame: int
- skill_ids: str (Default: None)
- agent_ids: str (Default: None)
- interval: int (Default: None)
- version: int (Default: 1)
data = mo_conn.messaging_conversation(time_frame=1440)
2. Messaging Current Queue Health
Documentation
Arguments:
- skill_ids: str (Default: None)
- version: int (Default: 1)
data = mo_conn.messaging_current_queue_health()
3. Messaging Queue Health
Documentation
Arguments:
- time_frame: int
- skill_ids: str (Default: None)
- interval: int (Default: None)
- version: int (Default: 1)
data = mo_conn.messaging_queue_health()
4. Messaging CSAT Distribution
Documentation
Arguments:
- time_frame: int
- skill_ids: str (Default: None)
- agent_ids: str (Default: None)
- version: int (Default: 1)
data = mo_conn.messaging_csat_distribution(time_frame=1440)
5. Messaging Estimated Wait Time
Documentation
Arguments:
- skill_ids: str (Default: None)
- version: int (Default: 1)
data = mo_conn.messaging_estimated_wait_time()
Operational Realtime API
Create Operational Realtime Connection.
from lp_api_wrapper import OperationalRealtime or_conn = OperationalRealtime(auth=auth)
1. Queue Health
Documentation:
Arguments:
- time_frame: int
- skill_ids: str (Default: None)
- interval: int (Default: None)
- version: int (Default: 1)
data = or_conn.queue_health(time_frame=1440)
2. Engagement Activity
Documentation:
Arguments:
- time_frame: int
- skill_ids: str (Default: None)
- agent_ids: str (Default: None)
- interval: int (Default: None)
- version: int (Default: 1)
data = or_conn.engagement_activity(time_frame=1440)
3. Agent Activity
Documentation:
Arguments:
- time_frame: int
- agent_ids: str
- interval: int (Default: None)
- version: int (Default: 1)
data = or_conn.agent_activity(time_frame=1440, agent_ids='123, 456')
4. Current Queue State
Documentation:
Arguments:
- skill_ids: str (Default: None)
- version: int (Default: 1)
data = or_conn.current_queue_state()
5. SLA Histogram
Documentation:
Arguments:
- time_frame: int
- skill_ids: str (Default: None)
- group_ids: str (Default: None)
- histogram: str (Default: None)
- version: int (Default: 1)
data = or_conn.sla_histogram(time_frame=1440)
Predefined Content API
Create Predefined Content Connection.
from lp_api_wrapper import PredefinedContent pdc_conn = PredefinedContent(auth=auth)
1. Get Predefined Content Items
Documentation:
Arguments:
- include_deleted: bool (Default: None)
- sanitize_data: bool (Default: None)
- lang: str (Default: None)
- select: str (Default: None)
- group_by: str (Default: None)
- skill_ids: str (Default: None)
- ids: str (Default: None)
- version: float (Default: 2.0)
data = pdc_conn.get_predefined_content_items()
Predefined Categories API
Create Predefined Categories Connection.
from lp_api_wrapper import PredefinedCategories pdc_conn = PredefinedCategories(auth=auth)
1. Categories List
Documentation:
Arguments:
- select: str (Default: None)
- include_deleted: bool (Default: None)
- version: float (Default: 2.0)
data = pdc_conn.categories_list()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
| Filename, size | File type | Python version | Upload date | Hashes |
|---|---|---|---|---|
| Filename, size lp_api_wrapper-0.6.6-py3-none-any.whl (44.0 kB) | File type Wheel | Python version py3 | Upload date | Hashes View |
| Filename, size lp-api-wrapper-0.6.6.tar.gz (30.1 kB) | File type Source | Python version None | Upload date | Hashes View |
Hashes for lp_api_wrapper-0.6.6-py3-none-any.whl
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 | 6c11940c13ec81fc74e8ba60a61d5ef8eedb2520f53363136fc8470aa259a4f7 |
|
| MD5 | 81855b52fcf53ea3f14c06e063c2b6a3 |
|
| BLAKE2-256 | e206e2e4f0ceef7e98667dc56a4c2e972abddba2875fa75c195a015ef5f652d0 |

