Skip to content

Instantly share code, notes, and snippets.

@phunehehe
Last active March 1, 2024 19:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phunehehe/6fbf165973d464d1eec5c5054aae3071 to your computer and use it in GitHub Desktop.
Save phunehehe/6fbf165973d464d1eec5c5054aae3071 to your computer and use it in GitHub Desktop.
Slack Timesheet Bookmarlet

Create a browser bookmark with the following code as the URL, name it Slack Timesheet or something

javascript:(async function() {
  allMessages = [];
  while (true) {
    buttons = document.getElementsByClassName('c-search__expand');
    buttons = Array.from(buttons);
    for (b of buttons) { b.click(); }

    pageMessages = document.getElementsByClassName('p-rich_text_section');
    pageMessages = Array.from(pageMessages).map(m => m.innerText.replace('\n', ' ... '));
    allMessages = allMessages.concat(pageMessages);

    button = document.querySelector('[data-qa=c-pagination_forward_btn]');
    if (button.disabled) { break }
    button.click();
    await new Promise(r => setTimeout(r, 500))
  }

  text = allMessages.join(' ... ');
  instruction = [
    'Act like a personal assistant',
    'I need a timesheet',
    'You will determine the tasks I did using the chat messages that I sent at work',
    'In the process, you should write 1 line of description for each task, but only consider the 5 most important tasks if there are more than 5',
    'Please do not exceed 14 words for each task, and avoid any output other than the 1 line description for each task',
    'The chat messages that I sent will follow',
  ].join('. ');
  prompt('Copy this', `${instruction} >>> ${text}`)
})()

Go to Slack, search for all messages that you sent on a certain date, for example:

from:@Phu before:2024-02-24 after:2024-02-22

Stay on the first result page, click the bookmarklet to run it. It will:

  • Expand long messages
  • Go to all result pages to get all messages
  • Build a prompt suitable for LLMs like ChatGPT and present it so you can copy

Copy the prompt and paste it at e.g. https://chat.openai.com/

The result looks something like this

1. Analyzed autovacuum performance, proposing optimization strategies.
2. Investigated session limit and CPU usage for database operations.
3. Prioritized DB migration ticket DO-3512 for execution.
4. Identified missing database migration in pay_staging-policies-137.
5. Discussed data export/import plan with concerns about permissions.

Touch up as needed

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