Leaddesk

How to integrate Plecto with Leaddesk.

Plecto is easy to integrate with LeadDesk. LeadDesk provides an SQL server to clients which can be used for reporting. Plecto integrates directly with SQL and it's just a matter of a few clicks to connect. However, you first need to request a login from LeadDesk.

 

To obtain your login, send an e-mail to support@leadddesk.com and ask for a SQL Reporting Server login (username, password & database), for use with Plecto. They will want to know our public IP adresses.

As soon as you receive the reply, you can add a new SQL data source in Plecto. Fill out the information as defined below:

  • Type: MySQL
  • Host: reporting.leaddesk.com
  • Port: 3306
  • Username: Provided by leaddesk
  • Password: Provided by leaddesk
  • Database: Provided by leaddesk


You can get virtually any information from LeadDesk into Plecto using SQL statements. Here are a few examples:


Importing Calls: 

SELECT 

    agents.name as "member_name",

    call_logs.agent_id as "member_id",

    CONVERT_TZ(call_logs.talk_end, @@session.time_zone, '+00:00') as "date",

    call_logs.id as "reference",

    call_logs.status,

    call_logs.talk_time,

    call_logs.number,

    calling_lists.name as "calling_list",

    call_logs.direction,

    call_logs.reason_name

FROM call_logs

INNER JOIN agents on call_logs.agent_id = agents.id

INNER JOIN campaigns on call_logs.campaign = campaigns.id

LEFT JOIN calling_lists on call_logs.calling_list_id = calling_lists.id

WHERE

    CONVERT_TZ(call_logs.handling_stop,@@session.time_zone, '+00:00') > DATE_ADD({{ last_update_time }}, INTERVAL -60 MINUTE) 

    OR 

    CONVERT_TZ(call_logs.talk_end,@@session.time_zone, '+00:00') > DATE_ADD({{ last_update_time }}, INTERVAL -60 MINUTE)

ORDER BY date DESC;

Importing Working Time:

SELECT

    agents.name as 'member_name',

    agents.id as 'member_id',

    duration,

    agents_history.id as reference,

    CONVERT_TZ(log_out,@@session.time_zone, '+00:00') as date

FROM agents_history

INNER JOIN agents ON (agents.id = agents_history.agent_id)

WHERE log_out > {{ last_update_time }}

Importing Orders:

SELECT

    agents.name as "member_name",

    agents.id as "member_id",

    orders.id as "reference",

    CONVERT_TZ(orders.created_at, @@session.time_zone, '+00:00') as "date",

    SUM(orders_products.quantity) as "Number of products",

    SUM(orders_products.salesprice) as "Sales price"

FROM orders

INNER JOIN orders_products on orders.id = orders_products.order_id

INNER JOIN agents on orders.agent_id = agents.id

WHERE

    CONVERT_TZ(orders.created_at,@@session.time_zone, '+00:00') > {{ last_update_time }}

GROUP BY orders.id;