Package: lp-api-wrapper
lp_api_wrapper: Unofficial LivePerson API Python Wrapperlp_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 APIconversations -1 offset of data in start date rangeall_conversations -All offsets of data in start date rangeget_conversation_by_conversation_idget_conversations_by_consumer_idEngagement History APIengagements -1 offset of data in start date rangeall_engagements -All offsets of data in start date rangeAgent Metrics APIagent_statussummaryMessaging Operations APImessaging_conversationmessaging_current_queue_healthmessaging_queue_healthmessaging_csat_distributionOperational Realtime APIqueue_healthengagement_activityagent_activitycurrent_queue_statesla_histogramPredefined Content APIget_predefined_content_itemsPredefined Categories APIcategories_listInstallation$pipinstall--upgradelp_api_wrapperImport lp_api_wrapper# For Messaging Interactions APIfromlp_api_wrapperimportMessagingInteractions# For Engagement History APIfromlp_api_wrapperimportEngagementHistory# For Agent Metrics APIfromlp_api_wrapperimportAgentMetrics# For Messaging Operations APIfromlp_api_wrapperimportMessagingOperations# For Operational Realtime APIfromlp_api_wrapperimportOperationalRealtime# For Predefined Content APIfromlp_api_wrapperimportPredefinedContent# For Predefined Categories APIfromlp_api_wrapperimportPredefinedCategoriesLogin/AuthenticationEach class in lp_api_wrapper accepts user login or oauth1 authentication.Login via the Login Service API:https://developers.liveperson.com/login-getting-started.htmlfromlp_api_wrapperimportUserLoginauth=UserLogin(account_id='1234',username='YOURUSERNAME',password='YOURPASSWORD')Or, login using OAuth1 authenticationfromlp_api_wrapperimportOAuthLoginauth=OAuthLogin(account_id='1234',app_key='APP_KEY',app_secret='APP_SECRET',access_token='ACCESS_TOKEN',access_token_secret='ACCESS_TOKEN_SECRET')Messaging Interactions APICreate Messaging Interactions Connectionfromlp_api_wrapperimportMessagingInteractionsmi_conn=MessagingInteractions(auth=auth)1. ConversationsDocumentation:https://developers.liveperson.com/data-messaging-interactions-conversations.htmlNote!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 ConversationsDocumentation:https://developers.liveperson.com/data-messaging-interactions-conversations.htmlNote!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 idDocumentation:https://developers.liveperson.com/data-messaging-interactions-get-conversation-by-conversation-id.htmlArguments:conversation_id: strdata=mi_conn.get_conversation_by_conversation_id(conversation_id='1234abc')3. Get conversation by consumer idDocumentation:https://developers.liveperson.com/data-messaging-interactions-get-conversations-by-consumer-id.htmlArguments:consumer_id: strdata=mi_conn.get_conversations_by_consumer_id(consumer_id='1234abc')Engagement History APICreate Engagement History Connection.fromlp_api_wrapperimportEngagementHistorymi_conn=EngagementHistory(auth=auth)1. EngagementsDocumentation:https://developers.liveperson.com/data-engagement-history-methods.htmlNote!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 EngagementsDocumentation:https://developers.liveperson.com/data-engagement-history-methods.htmlNote!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 APICreate Agent Metrics Connection.fromlp_api_wrapperimportAgentMetricsam_conn=AgentMetrics(auth=auth)1. Agent StatusDocumentation:https://developers.liveperson.com/data-messaging-interactions-methods-agent-status.htmlNote!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. SummaryDocumentation:https://developers.liveperson.com/data-messaging-interactions-methods-summary.htmlNote!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 APICreate Messaging Operations Connection.fromlp_api_wrapperimportMessagingOperationsmo_conn=MessagingOperations(auth=auth)1. Messaging ConversationDocumentation:https://developers.liveperson.com/data-messaging-operations-messaging-conversation.htmlArguments:time_frame: intskill_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 HealthDocumentationhttps://developers.liveperson.com/data-messaging-operations-messaging-current-queue-health.htmlArguments:skill_ids: str (Default: None)version: int (Default: 1)data=mo_conn.messaging_current_queue_health()3. Messaging Queue HealthDocumentationhttps://developers.liveperson.com/data-messaging-operations-messaging-queue-health.htmlArguments:time_frame: intskill_ids: str (Default: None)interval: int (Default: None)version: int (Default: 1)data=mo_conn.messaging_queue_health()4. Messaging CSAT DistributionDocumentationhttps://developers.liveperson.com/data-messaging-operations-messaging-csat-distribution.htmlArguments:time_frame: intskill_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 TimeDocumentationhttps://developers.liveperson.com/data-messaging-operations-messaging-estimated-wait-time.htmlArguments:skill_ids: str (Default: None)version: int (Default: 1)data=mo_conn.messaging_estimated_wait_time()Operational Realtime APICreate Operational Realtime Connection.fromlp_api_wrapperimportOperationalRealtimeor_conn=OperationalRealtime(auth=auth)1. Queue HealthDocumentation:https://developers.liveperson.com/data-operational-realtime-queue-health.htmlArguments:time_frame: intskill_ids: str (Default: None)interval: int (Default: None)version: int (Default: 1)data=or_conn.queue_health(time_frame=1440)2. Engagement ActivityDocumentation:https://developers.liveperson.com/data-operational-realtime-engagement-activity.htmlArguments:time_frame: intskill_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 ActivityDocumentation:https://developers.liveperson.com/data-operational-realtime-agent-activity.htmlArguments:time_frame: intagent_ids: strinterval: int (Default: None)version: int (Default: 1)data=or_conn.agent_activity(time_frame=1440,agent_ids='123, 456')4. Current Queue StateDocumentation:https://developers.liveperson.com/data-operational-realtime-current-queue-state.htmlArguments:skill_ids: str (Default: None)version: int (Default: 1)data=or_conn.current_queue_state()5. SLA HistogramDocumentation:https://developers.liveperson.com/data-operational-realtime-sla-histogram.htmlArguments:time_frame: intskill_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 APICreate Predefined Content Connection.fromlp_api_wrapperimportPredefinedContentpdc_conn=PredefinedContent(auth=auth)1. Get Predefined Content ItemsDocumentation:https://developers.liveperson.com/account-configuration-predefined-content-get-items.htmlArguments: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 APICreate Predefined Categories Connection.fromlp_api_wrapperimportPredefinedCategoriespdc_conn=PredefinedCategories(auth=auth)1. Categories ListDocumentation:https://developers.liveperson.com/account-configuration-predefined-list.htmlArguments:select: str (Default: None)include_deleted: bool (Default: None)version: float (Default: 2.0)data=pdc_conn.categories_list()