Documentation ¶
Overview ¶
Package conversation synchronises email addresses with a Slack conversation.
Requirements ¶
In order to synchronise with Slack, you'll need to create a Slack app with the following OAuth Bot Token permissions:
- users:read
- users:read.email
- channels:manage
- channels:read
- groups:read
- groups:write
- im:write
- mpim:write
Examples ¶
Index ¶
Examples ¶
Constants ¶
View Source
const MuteRestrictedErrOnKickFromPublic gosync.ConfigKey = "mute_restricted_err_kick_from_public"
MuteRestrictedErrOnKickFromPublic mutes an error that occurs when Slack is configured to prevent kicking users from public conversations. Set this to true to mute this error and continue syncing.
View Source
const Name gosync.ConfigKey = "name"
Name is the Slack conversation name.
View Source
const SlackAPIKey gosync.ConfigKey = "slack_api_key" //nolint:gosec
SlackAPIKey is an API key for authenticating with Slack.
Variables ¶
This section is empty.
Functions ¶
func Init ¶
Init a new Slack Conversation gosync.Adapter.
Required config:
Example ¶
package main import ( "context" "log" "github.com/ovotech/go-sync/packages/gosync" "github.com/ovotech/go-sync/packages/slack/conversation" ) func main() { ctx := context.Background() adapter, err := conversation.Init(ctx, map[gosync.ConfigKey]string{ conversation.SlackAPIKey: "my-slack-token", conversation.Name: "C0123ABC456", }) if err != nil { log.Fatal(err) } gosync.New(adapter) }
Output:
Types ¶
type Conversation ¶
type Conversation struct { MuteRestrictedErrOnKickFromPublic bool // See [conversation.MuteRestrictedErrOnKickFromPublic] Logger *log.Logger // contains filtered or unexported fields }
func New ¶
func New(client *slack.Client, conversationName string, optsFn ...func(conversation *Conversation)) *Conversation
New Slack Conversation gosync.Adapter.
Example ¶
package main import ( "github.com/slack-go/slack" "github.com/ovotech/go-sync/packages/gosync" "github.com/ovotech/go-sync/packages/slack/conversation" ) func main() { client := slack.New("my-slack-token") adapter := conversation.New(client, "C0123ABC456") gosync.New(adapter) }
Output:
func (*Conversation) Add ¶
func (c *Conversation) Add(_ context.Context, emails []string) error
Add email addresses to a Slack Conversation.
Click to show internal directories.
Click to hide internal directories.