From be14b24fcd0e065ec3e82e5817d11b9882e44d40 Mon Sep 17 00:00:00 2001 From: michplunkett <5885605+michplunkett@users.noreply.github.com> Date: Mon, 15 Jul 2024 23:41:09 -0500 Subject: [PATCH 01/12] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 223d684..1b7a47b 100644 --- a/README.md +++ b/README.md @@ -9,5 +9,5 @@ Various scripts written in Golang. #### Instructions ```console cp [YOUR_ARCHIVE_PATH_HERE]/*.json ./SlackMessages/ -go run slack_message_parser.go +go run ./cmd/slackMessageParser/main.go ``` From 836459ff7ec259b8b3f92f95eb8ea6748d5fe8e1 Mon Sep 17 00:00:00 2001 From: michplunkett <5885605+michplunkett@users.noreply.github.com> Date: Mon, 15 Jul 2024 23:51:17 -0500 Subject: [PATCH 02/12] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1b7a47b..6af5d1b 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Various scripts written in Golang. ## Scripts ### Slack Message Parser - +This tool is used to parse the `json`-formatted data that comes from [exporting Slack workspace data](https://slack.com/help/articles/201658943-Export-your-workspace-data). #### Instructions ```console From 9f43ec57f07456115c211754ec0646989e739b93 Mon Sep 17 00:00:00 2001 From: michplunkett <5885605+michplunkett@users.noreply.github.com> Date: Mon, 15 Jul 2024 23:52:31 -0500 Subject: [PATCH 03/12] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 6af5d1b..9a3dd9b 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ This tool is used to parse the `json`-formatted data that comes from [exporting #### Instructions ```console +mkdir -p ./SlackMessages cp [YOUR_ARCHIVE_PATH_HERE]/*.json ./SlackMessages/ go run ./cmd/slackMessageParser/main.go ``` From e0a00dc900beee898be91fb92a786541347e6550 Mon Sep 17 00:00:00 2001 From: michplunkett <5885605+michplunkett@users.noreply.github.com> Date: Mon, 15 Jul 2024 23:59:33 -0500 Subject: [PATCH 04/12] Update Makefile --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile b/Makefile index 1c050c8..33df1d4 100644 --- a/Makefile +++ b/Makefile @@ -10,3 +10,7 @@ lint: go fmt ./... go vet ./... staticcheck ./... + +.PHONY: parse-slack-data +parse-slack-data: + go run ./cmd/slackMessageParser/main.go From df6ea712bfbfbbeedb47300536db21021b45c90c Mon Sep 17 00:00:00 2001 From: michplunkett <5885605+michplunkett@users.noreply.github.com> Date: Mon, 15 Jul 2024 23:59:38 -0500 Subject: [PATCH 05/12] Update README.md --- README.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 9a3dd9b..311498c 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,12 @@ Various scripts written in Golang. This tool is used to parse the `json`-formatted data that comes from [exporting Slack workspace data](https://slack.com/help/articles/201658943-Export-your-workspace-data). #### Instructions -```console -mkdir -p ./SlackMessages -cp [YOUR_ARCHIVE_PATH_HERE]/*.json ./SlackMessages/ -go run ./cmd/slackMessageParser/main.go -``` +1. Move your files to the `SlackMessages` directory. + ```console + mkdir -p ./SlackMessages + cp [YOUR_ARCHIVE_PATH_HERE]/*.json ./SlackMessages/ + go run ./cmd/slackMessageParser/main.go + ``` +2. Run the application via one of the following commands: + - `make parse-slack-data` + - `go run ./cmd/slackMessageParser/main.go` From 6d0ef0743be005e5a7a4881465899308740d6ec4 Mon Sep 17 00:00:00 2001 From: michplunkett <5885605+michplunkett@users.noreply.github.com> Date: Tue, 16 Jul 2024 00:06:50 -0500 Subject: [PATCH 06/12] Update main.go --- cmd/slackMessageParser/main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/slackMessageParser/main.go b/cmd/slackMessageParser/main.go index aea22af..3b7b680 100644 --- a/cmd/slackMessageParser/main.go +++ b/cmd/slackMessageParser/main.go @@ -74,11 +74,11 @@ type CSVRecord struct { } func main() { - if _, err := os.Stat("../../SlackMessages"); os.IsNotExist(err) { + if _, err := os.Stat("./SlackMessages"); os.IsNotExist(err) { log.Fatal("the ./SlackMessages directory does not exist") } - files, err := filepath.Glob("../../SlackMessages/*.json") + files, err := filepath.Glob("./SlackMessages/*.json") if err != nil { log.Fatal(err) } From e543c3589d2d70901da4c2cf9cede5d955af4391 Mon Sep 17 00:00:00 2001 From: michplunkett <5885605+michplunkett@users.noreply.github.com> Date: Tue, 16 Jul 2024 00:07:14 -0500 Subject: [PATCH 07/12] Update README.md --- README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 311498c..c7422c0 100644 --- a/README.md +++ b/README.md @@ -10,9 +10,7 @@ This tool is used to parse the `json`-formatted data that comes from [exporting 1. Move your files to the `SlackMessages` directory. ```console mkdir -p ./SlackMessages - cp [YOUR_ARCHIVE_PATH_HERE]/*.json ./SlackMessages/ + cp [SLACK_WORKSPACE_DATA_PATH_HERE]/*.json ./SlackMessages/ go run ./cmd/slackMessageParser/main.go ``` -2. Run the application via one of the following commands: - - `make parse-slack-data` - - `go run ./cmd/slackMessageParser/main.go` +2. Run the Slack message parser using the command: `make parse-slack-data`. From 6a0451961919726793193c6c362b2ea0d03ca7f4 Mon Sep 17 00:00:00 2001 From: michplunkett <5885605+michplunkett@users.noreply.github.com> Date: Tue, 16 Jul 2024 00:07:21 -0500 Subject: [PATCH 08/12] Update README.md --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index c7422c0..f82750a 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,5 @@ This tool is used to parse the `json`-formatted data that comes from [exporting ```console mkdir -p ./SlackMessages cp [SLACK_WORKSPACE_DATA_PATH_HERE]/*.json ./SlackMessages/ - go run ./cmd/slackMessageParser/main.go ``` 2. Run the Slack message parser using the command: `make parse-slack-data`. From 604d52a36de1269b0b6d610b86c30913cc4dcc7b Mon Sep 17 00:00:00 2001 From: michplunkett <5885605+michplunkett@users.noreply.github.com> Date: Tue, 16 Jul 2024 00:15:48 -0500 Subject: [PATCH 09/12] Update main.go --- cmd/slackMessageParser/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/slackMessageParser/main.go b/cmd/slackMessageParser/main.go index 3b7b680..f721755 100644 --- a/cmd/slackMessageParser/main.go +++ b/cmd/slackMessageParser/main.go @@ -156,7 +156,7 @@ func main() { csvRecords = append(csvRecords, record) } - csvFile, err := os.Create("../../slack_records.csv") + csvFile, err := os.Create("slack_records.csv") if err != nil { log.Fatal(err) } From 9eb9b5084e3a2d8e1a6e7cb99f308f44398821ba Mon Sep 17 00:00:00 2001 From: michplunkett <5885605+michplunkett@users.noreply.github.com> Date: Tue, 16 Jul 2024 00:17:39 -0500 Subject: [PATCH 10/12] Update .gitignore --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index e0f7ecc..f1df632 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,9 @@ go.work go.work.sum +# Command directories +SlackMessages + # IDE directories and misc. files .idea .vscode From 4f3b079a075301ab67d8c0dd44ce1b22b16a33a3 Mon Sep 17 00:00:00 2001 From: michplunkett <5885605+michplunkett@users.noreply.github.com> Date: Tue, 16 Jul 2024 00:26:28 -0500 Subject: [PATCH 11/12] Update .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index f1df632..057b692 100644 --- a/.gitignore +++ b/.gitignore @@ -23,6 +23,7 @@ go.work.sum # Command directories SlackMessages +slack_records.csv # IDE directories and misc. files .idea From 8fa7b4666221c92d3121366909a02f72c103b278 Mon Sep 17 00:00:00 2001 From: michplunkett <5885605+michplunkett@users.noreply.github.com> Date: Tue, 16 Jul 2024 00:26:41 -0500 Subject: [PATCH 12/12] Update README.md --- README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f82750a..15ac263 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,14 @@ Various scripts written in Golang. ## Scripts ### Slack Message Parser -This tool is used to parse the `json`-formatted data that comes from [exporting Slack workspace data](https://slack.com/help/articles/201658943-Export-your-workspace-data). +This tool is used to parse the `json`-formatted data that comes from [exporting Slack workspace data](https://slack.com/help/articles/201658943-Export-your-workspace-data) into a `csv` file named: `slack_records.csv`. + +`csv` format: +TimeStamp,UserID,UserName,RealName,MessageType,Text,Attachments,Files + +| TimeStamp | UserID | UserName | RealName | MessageType | Text | Attachments | Files | +|:---------:|:------:|:--------:|:--------:|:-----------:|:------:|:-----------:|:--------:| +| string | string | string | string | string | string | []string | []string | #### Instructions 1. Move your files to the `SlackMessages` directory.