Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
coverage.*
*.coverprofile
profile.cov
.env.local

# Build output
bin/
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/opsorch/opsorch-slack-adapter
go 1.22

require (
github.com/opsorch/opsorch-core v0.0.4
github.com/opsorch/opsorch-core v0.4.0
github.com/slack-go/slack v0.12.5
)

Expand Down
6 changes: 6 additions & 0 deletions integ/messaging.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ func main() {
log.Printf("❌ Failed to send simple message: %v", err)
} else {
fmt.Printf("✅ Sent simple message. ID: %s, Timestamp: %s\n", res.ID, res.SentAt)
if res.URL != "" {
fmt.Printf(" URL: %s\n", res.URL)
}
}

// Test 2: Send a rich message with blocks
Expand All @@ -67,5 +70,8 @@ func main() {
log.Printf("❌ Failed to send rich message: %v", err)
} else {
fmt.Printf("✅ Sent rich message. ID: %s, Timestamp: %s\n", res.ID, res.SentAt)
if res.URL != "" {
fmt.Printf(" URL: %s\n", res.URL)
}
}
}
7 changes: 7 additions & 0 deletions messaging/slack_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,17 @@ func (p *SlackProvider) Send(ctx context.Context, msg schema.Message) (schema.Me
return schema.MessageResult{}, err
}

// Get permalink for the message
permalink, _ := p.client.GetPermalinkContext(ctx, &slack.PermalinkParameters{

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

style: Error from GetPermalinkContext silently ignored with blank identifier.

If permalink retrieval is critical, consider logging the error:

Suggested change
permalink, _ := p.client.GetPermalinkContext(ctx, &slack.PermalinkParameters{
// Get permalink for the message
permalink, err := p.client.GetPermalinkContext(ctx, &slack.PermalinkParameters{
Channel: channelID,
Ts: timestamp,
})
if err != nil {
// Log but don't fail the send operation
}

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Prompt To Fix With AI
This is a comment left during a code review.
Path: messaging/slack_provider.go
Line: 91:91

Comment:
**style:** Error from `GetPermalinkContext` silently ignored with blank identifier.

If permalink retrieval is critical, consider logging the error:
```suggestion
	// Get permalink for the message
	permalink, err := p.client.GetPermalinkContext(ctx, &slack.PermalinkParameters{
		Channel: channelID,
		Ts:      timestamp,
	})
	if err != nil {
		// Log but don't fail the send operation
	}
```

<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>

How can I resolve this? If you propose a fix, please make it concise.

Channel: channelID,
Ts: timestamp,
})

return schema.MessageResult{
ID: timestamp,
Channel: channelID,
SentAt: time.Now(),
URL: permalink,
}, nil
}

Expand Down
Loading