slack-go / slack

Slack API in Go, originally by @nlopes; Maintainers needed, contact @parsley42
https://pkg.go.dev/github.com/slack-go/slack
BSD 2-Clause "Simplified" License
4.64k stars 1.13k forks source link

Slack Audit logs endpoint host is wrong #1144

Open GalNakash-RecoLabs opened 1 year ago

GalNakash-RecoLabs commented 1 year ago

What happened

The API GetAuditLogs sends a request to https://slack.com/api/

Expected behavior

The audit logs API is accessible only via api.slack.com

Steps to reproduce

  1. Generate a slack client with a valid token for auditlogs:read
  2. Call to get GetAuditLogs
  3. Error will be the HTML page "You've found a glitch

reproducible code

_, nextCursor, err = slackClient.GetAuditLogs(slack.AuditLogParameters{ Limit: maxAuditLogMessages, Oldest: oldest, Latest: latest, Cursor: nextCursor, Action: eventType, })

manifest.yaml

Versions

kanata2 commented 1 year ago

Thanks for reporting. You can call Audit Log APIs correctly by setting Base URL as follows.

slack.New(token, slack.OptionAPIURL("https://slack.com/")

However, it seems inconvenient that only one endpoint can be set per Slack client, so I will consider some other way.