Intercom – Total Messages per Customer

Question

How many messages each of our customers has exchanged with our customer support?

Schema

Intercom

Output

 

Intercom - Total Messages per CustomerSQL Query

SELECT name,
       count(conversations.id) AS total_messages \
FROM conversations
INNER JOIN users ON (conversations.user_id = users.id)
GROUP BY name
ORDER BY total_messages DESC

 

 

 

 

in Customer Support