Making WordPress.org

Opened 5 years ago

Closed 2 years ago

#4306 closed defect (bug) (fixed)

Plugin Admin: Update Plugin Stats Report to use HelpScout

Reported by: ipstenu's profile Ipstenu Owned by: dd32's profile dd32
Milestone: Priority: normal
Component: Plugin Directory Keywords:
Cc:

Description

Currently Stats_Report (plugins/plugin-directory/tools/class-stats-report.php) checks SupportPress

We've moved so we'll need to update those checks to use (I think) the API for HelpScout

https://developer.helpscout.com/mailbox-api/endpoints/conversations/list/

Change History (16)

#1 @Ipstenu
5 years ago

  • Summary changed from Update Plugin Stats Report to use HelpScout to Plugin Admin: Update Plugin Stats Report to use HelpScout

#2 @Ipstenu
5 years ago

  • Keywords needs-patch added

This ticket was mentioned in Slack in #meta by tellyworth. View the logs.


5 years ago

#4 @tellyworth
5 years ago

  • Owner set to tellyworth
  • Status changed from new to accepted

This ticket was mentioned in Slack in #meta by ipstenu. View the logs.


4 years ago

#6 @dd32
2 years ago

  • Owner changed from tellyworth to dd32

@Ipstenu Two questions:

  1. Is this still actually wanted?
  2. What are the stats wanted?

Currently:

** Email Queue Stats **

Total open tickets* : 2633
→ (with no activity in last 7 days)** : 2633
Within defined 7 day time window:
   Total : 0
   Closed : 0
   Open : 0

The no activity in last-7-days isn't relevant anymore, due to the way HelpScout is being used I think?

Looking at the HelpScout API, here's the relevant parts

https://developer.helpscout.com/mailbox-api/endpoints/reports/company/reports-company-overall/

"current": {
  "customersHelped": 330,
  "closed": 385,
  "totalReplies": 620,
  "totalUsers": 3,
  "totalDays": 7,
  "repliesPerDay": 89,
  "resolvedPerDay": 38,
  "newConversationsPerDay": 35
},

or
https://developer.helpscout.com/mailbox-api/endpoints/reports/conversations/reports-conversations-overall/

current": {
  "totalConversations": 414,
  "conversationsCreated": 249,
  "newConversations": 249,
  "customers": 345,
  "messagesReceived": 568,
},

(Quick note on the above: 330 vs 345, there's been 15 new "unseen" emails from people who did not make contact in the past week, that's why the count differs)

It also seems to keep a tally of the number of times a saved reply is used, eg:

{
"name": "Review: Intro to new review",
"count": XXX,
"percent": X.y
}

or how often a Workflow or tag is used

{
"name": "auto-bounce",
"count": X,
"percent": X.y
}}}}

I can also query for the current list of emails in the inbox, for example, there's currently 29 assigned email & 1 new unassigned email.

I've rounded/changed a bunch of numbers above for ease of posting, also removed some stupid stat fields that are invalid (ie. `repliesPerDayPerUser: (totalReplies / totalActiveUsers)` is not relevant if 2 of those users only made 2% of total emails)
Version 0, edited 2 years ago by dd32 (next)

#7 follow-up: @Ipstenu
2 years ago

@dd32 Yes, because I have to manually copy/pasta from multiple pages :) Easier == Better. Also it means a future rep may not have to have admin access to HelpScout.

You can see from https://make.wordpress.org/updates/2022/03/28/plugin-review-team-28-march-2022/ that I use a different set which is a raw copy down. I think this is what I would used. "Resolved" isn't worth much since it's not like we really have a final state.

  • Total Conversations: 398
  • New Conversations: 231
  • Customers: 339
  • Conversations per Day: 49
  • Busiest Day: Tuesday
  • Messages Received: 507
  • Replies Sent: 579
  • Emails Created: 149

#8 in reply to: ↑ 7 @dd32
2 years ago

Replying to Ipstenu:

dd32 Yes, because I have to manually copy/pasta from multiple pages :)

Thanks! Silly me for not looking at your latest updates posts...

I'll get that page updated with the HelpScout details.

"Resolved" isn't worth much since it's not like we really have a final state.

I was about to ask where you're getting that from.. I'll add it if I can figure it out on the API :)

#9 @dd32
2 years ago

In 11726:

Plugin Directory: Admin: Stats: Retrieve email stats from Help Scout.

See #4306.

#10 @dd32
2 years ago

@Ipstenu I ended up going with exactly what you posted here, I found the resolved numbers eventually, but it didn't seem to be relevant like you say.

Let me know if this works, and if there's any other changes you'd like made here.

Emails Created: 149

Can you double check this specifically for the last report time period? I've got Emails Created: 177 which I can't tell if it's a bug or the actual number..

Also; It's only just now that I've noticed that Reports menu within HelpScout where you've been getting this data, up until now I've scoured the HelpScout UI looking for it, and never spotted that...

#11 follow-up: @Ipstenu
2 years ago

Emails created is off by like 1, which is understandable for a cached API.

This though...

Replies Sent: 0

#12 in reply to: ↑ 11 ; follow-up: @dd32
2 years ago

  • Keywords needs-patch removed

Replying to Ipstenu:

This though...

Replies Sent: 0

Seems the API request timed out, There's 3 different API calls needed for that set of numbers (One of them only needed for replies-sent), I probably should've included some better error handling...

All the API's are returning within 100ms for me, but, I also duplicated this, with the first load of the stats returning 0 for replies sent - so I guess that API endpoint is rather slow on HelpScouts end until their caching kicks in.

I'll bump the timeout, and throw a visual warning if an API fails to return.

#13 @dd32
2 years ago

In 11728:

Plugin Directory: Stats Report: Fix the first request to the HelpScout API endpoints.

  • The first non-cached request to the HelpScout API failed to use the proper Authorization header format, due to a missing BEARER prefix.
  • Increased the API timeout for HelpScout to 15s, although it probably doesn't need it.
  • Make it more obvious that something is wrong with the HelpScout details, by returning 0's for all numbers, rather than just one or two of them.

See #4306.

#14 in reply to: ↑ 12 @dd32
2 years ago

Replying to dd32:

Seems the API request timed out

No, I'm just silly. Hit it again, turned out I had failed to craft the Authorization header correctly when it had to fetch a new Access token.. 🤦‍♂️

I think this is now fixed.

#15 @dd32
2 years ago

In 11742:

Plugin Directory: Stats Report: Fix the stats page options, incorrect parameter name added in [11728].

See #4306.

#16 @dd32
2 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed
Note: See TracTickets for help on using tickets.