Skip to content

Send monthly digest#23

Open
ramikg wants to merge 4 commits intooriser:mainfrom
ramikg:feature/monthly-digest
Open

Send monthly digest#23
ramikg wants to merge 4 commits intooriser:mainfrom
ramikg:feature/monthly-digest

Conversation

@ramikg
Copy link
Copy Markdown
Contributor

@ramikg ramikg commented Jun 15, 2024

Overview

This PR makes Bolt send a monthly digest on the 1st day of every month:
Monthly digest screenshot
Bolt automatically finds the channels in which there has been activity in the past month, and sends a personalized digest to those channels.

Some notes

  • I updated Go to version 1.22, in order to use slices.Concat.
  • At first I thought of adding a new Slack command, but now I think that the monthly variant would have a nicer "social effect". In any case, it should now be simple to implement something similar in a Slack command.
  • The code for building the top venues & top hosts parts is pretty similar, but I think that making it generic would make it unnecessarily complicated. This might change in the future in case this feature evolves.
  • The number of positions is at most 5 because the maximum number of fields in a section block is 10 (and each row uses two fields).

@ramikg
Copy link
Copy Markdown
Contributor Author

ramikg commented Jun 17, 2024

Slightly changed digest format following some comments.
(Monthly (Total) instead of Monthly/Total. See here for a visual comparison.)

@ramikg ramikg force-pushed the feature/monthly-digest branch 2 times, most recently from 6e570d5 to 2df2a64 Compare June 21, 2024 11:08
@ramikg
Copy link
Copy Markdown
Contributor Author

ramikg commented Jun 21, 2024

I've replaced the "top hosts" category with one that I think is more interesting – the people who've had the most participants in their orders.
(The host is excluded from the count, as well as people who didn't order anything.)

@ramikg ramikg force-pushed the feature/monthly-digest branch from 2df2a64 to a7f5310 Compare June 24, 2024 10:48
@oriser
Copy link
Copy Markdown
Owner

oriser commented Jun 24, 2024

Very nice :)
I think that it must have the ability to disable this behaviour using a configuration env, some people will not want that.
In addition, add the option to customize the channel/s where this message is sent.
I think it will be valuable to allow it also using a slash command.

return nil
}

func (d *DBStore) GetVenuesWithMostOrders(startTime time.Time, limit uint64, channelId string, filteredVenueIds []string) ([]order.VenueOrderCount, error) {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a test for that

return venueOrderCounts, nil
}

func (d *DBStore) GetHostsWithMostMouthsFed(startTime time.Time, limit uint64, channelId string, filteredHostIds []string) ([]order.MouthsFedCount, error) {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a test for that

return mouthsFedCount, nil
}

func (d *DBStore) GetActiveChannelIds(lastDateConsideredActive time.Time) ([]string, error) {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a test for that

@ramikg ramikg force-pushed the feature/monthly-digest branch from a7f5310 to 4e033e3 Compare June 30, 2024 11:52
@ramikg
Copy link
Copy Markdown
Contributor Author

ramikg commented Jun 30, 2024

Thank you for your comments!

I probably won't be able to get to it in the near future, but I think it'd be nice to have some design decisions at hand in case I get to work on it:

In addition, add the option to customize the channel/s where this message is sent.

Assuming you mean adding a whitelist/blacklist determining which channels receive this message –
Would a whitelist/blacklist be enough, or do you want another configuration option for disabling the feature completely?
(I think the first option would suffice.)

Alternatively, if you mean sending the digest of channel A to channel B, then that might be a nice addition to the proposed slash command.
(I've used this to test this feature, but the code is not in this PR as it doesn't check that the user is part of the requested channel.)

I think it will be valuable to allow it also using a slash command.

Would the output of the command be in the same format as in the screenshot above?
(Although you'd have to replace the month's name with "The past month"/"Past month" for it to make sense.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants