-
-
Notifications
You must be signed in to change notification settings - Fork 392
Feature/autoreply modes #87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
rakshabesafe
wants to merge
25
commits into
asternic:main
Choose a base branch
from
rakshabesafe:feature/autoreply-modes
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
4ae3f53
feat: Implement chat auto-reply feature
google-labs-jules[bot] 83015fc
Merge pull request #1 from rakshabesafe/feat/chat-autoreply
rakshabesafe 2994d3a
Update main.go
rakshabesafe fa0a96c
Update Dockerfile
rakshabesafe 291892c
feat: Implement WhatsApp autoreply feature
google-labs-jules[bot] 4935c8a
Merge pull request #2 from rakshabesafe/feature/autoreply
rakshabesafe ab23e53
Update main.go
rakshabesafe b945ed9
Update wmiau.go
rakshabesafe 7c6f1de
Create adduser.sh
rakshabesafe a396f37
feat: Implement autoreply modes functionality
google-labs-jules[bot] f0d20e0
feat: Implement autoreply modes and Google Contacts integration
google-labs-jules[bot] 0fcf450
fix: Add missing strings import to db.go
google-labs-jules[bot] 524269b
feat: Implement live Google Contacts fetching for autoreply modes
google-labs-jules[bot] 226c815
refactor: Standardize autoreply URLs and Swagger tags
google-labs-jules[bot] b07092d
fix: Add missing io import to handlers.go
google-labs-jules[bot] b1a9405
fix: Correct database table creation order
google-labs-jules[bot] 9b01d1e
refactor: Remove unused strings import from db.go
google-labs-jules[bot] 8ce1e48
I've addressed an issue in the migrations.go file. It was using `log.…
google-labs-jules[bot] 4b404b3
fix: Remove duplicate AutoReplyEntry definition in spec.yml
google-labs-jules[bot] a56416a
refactor: Isolate Google Contacts logic into separate files
google-labs-jules[bot] 315b617
fix: Correct syntax errors in handlers
google-labs-jules[bot] a63eaef
fix: Resolve redeclaration and usage errors
google-labs-jules[bot] a8cb87a
Jules was unable to complete the task in time. Please review the work…
google-labs-jules[bot] ea9e125
refactor: Consolidate all handlers into handlers.go for upstream alig…
google-labs-jules[bot] cf13b53
fix: Replace respondWithJSON with Respond in admin handlers
google-labs-jules[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Script to create a user via curl | ||
|
|
||
| # Validate the number of arguments | ||
| if [ "$#" -ne 3 ]; then | ||
| echo "Usage: $0 <adminpass> <username> <passwd>" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Assign arguments to variables | ||
| ADMIN_PASS="$1" | ||
| USERNAME="$2" | ||
| USER_PASSWD="$3" | ||
|
|
||
| # Execute the curl command | ||
| curl -X POST http://localhost:8089/admin/users \ | ||
| -H "Authorization: ${ADMIN_PASS}" \ | ||
| -H "Content-Type: application/json" \ | ||
| -d "{\"name\": \"${USERNAME}\", \"token\": \"${USER_PASSWD}\"}" | ||
|
|
||
| echo # Add a newline for cleaner output |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| package main | ||
|
|
||
| import ( | ||
| "github.com/gorilla/mux" | ||
| "github.com/justinas/alice" | ||
| ) | ||
|
|
||
| func registerAutoreplyRoutes(s *server, r *mux.Router, c alice.Chain) { | ||
| // Simple Autoreply routes (formerly in /chat/autoreply) | ||
| r.Handle("/chat/autoreply", c.Then(s.AddAutoReply())).Methods("POST") | ||
| r.Handle("/chat/autoreply", c.Then(s.DeleteAutoReply())).Methods("DELETE") | ||
| r.Handle("/chat/autoreply", c.Then(s.GetAutoReplies())).Methods("GET") | ||
|
|
||
| // Mode Autoreply routes (formerly /mode/..., now /autoreply/...) | ||
| r.Handle("/autoreply/mode", c.Then(s.AddModeAutoreply())).Methods("POST") | ||
| r.Handle("/autoreply/mode", c.Then(s.GetModeAutoreplies())).Methods("GET") | ||
| r.Handle("/autoreply/mode", c.Then(s.DeleteModeAutoreply())).Methods("DELETE") | ||
|
|
||
| r.Handle("/autoreply/enablemode", c.Then(s.EnableMode())).Methods("POST") | ||
| r.Handle("/autoreply/disablemode", c.Then(s.DisableMode())).Methods("POST") | ||
| r.Handle("/autoreply/currentmode", c.Then(s.GetCurrentMode())).Methods("GET") | ||
| r.Handle("/autoreply/clearmode", c.Then(s.ClearModes())).Methods("POST") | ||
|
|
||
| // Google Contacts integration routes (already under /autoreply/) | ||
| r.Handle("/autoreply/contactgroupauth", c.Then(s.SetGoogleContactsAuthToken())).Methods("POST") | ||
| r.Handle("/autoreply/contactgroup", c.Then(s.AddContactGroupToMode())).Methods("POST") | ||
| r.Handle("/autoreply/contactgroup", c.Then(s.DeleteContactGroupFromMode())).Methods("DELETE") | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| package main | ||
|
|
||
| // supportedEventTypes lists the valid event types for webhooks. | ||
| var supportedEventTypes = []string{"Message", "ReadReceipt", "Presence", "HistorySync", "ChatPresence", "All"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description for
Add/Update Auto-Reply(line 711) states, "If an auto-reply for the given phone number already exists for the user, it will be updated." However, the409 Conflictresponse (line 733) is documented for the case "If an auto-reply for this phone number already exists for the user."This seems contradictory. The current handler implementation (
handlers.go:AddAutoReply) also reflects an "add-only" behavior, returning a409 Conflictif the entry exists, rather than updating it.Could you clarify the intended behavior?
409 Conflictis appropriate.handlers.gowould need to be changed (e.g., usingON CONFLICT DO UPDATEfor PostgreSQL andINSERT OR REPLACEor equivalent for SQLite), and the success status code might need adjustment (e.g.,200 OKfor update,201 Createdfor new).