Skip to content

Latest commit

 

History

History
 
 

conversation

Slack Conversation adapter for Go Sync

This adapter synchronises email addresses with a Slack conversation.

Warning

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.

Requirements

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

Example

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)
	}
}