This adapter synchronises email addresses with a Slack conversation.
The Slack usergroup API doesn't allow a usergroup to have no members. If this behaviour is expected, we recommend
setting adapter.MuteGroupCannotBeEmpty = true
to mute the error. No members will be removed, but Go Sync will continue
processing.
In order to synchronise with Slack, you'll need to create a Slack app with the following OAuth permissions:
Bot Token Scopes |
---|
users:read |
users:read.email |
channels:manage |
channels:read |
groups:read |
groups:write |
im:write |
mpim:write |
package main
import (
"context"
"log"
"github.com/ovotech/go-sync"
"github.com/ovotech/go-sync/adapters/slack/conversation"
"github.com/slack-go/slack"
)
func main() {
slackClient := slack.New("my-slack-token")
conversationAdapter := conversation.New(slackClient, "UG000123")
svc := gosync.New(conversationAdapter)
// Synchronise a Slack User group with something else.
anotherServiceAdapter := someAdapter.New()
err := svc.SyncWith(context.Background(), anotherServiceAdapter)
if err != nil {
log.Fatal(err)
}
}