conversation

package
v0.0.0-...-ef49813 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 5, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

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:

Examples

See New and Init.

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

func Init(_ context.Context, config map[gosync.ConfigKey]string) (gosync.Adapter, error)

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.

func (*Conversation) Get

func (c *Conversation) Get(_ context.Context) ([]string, error)

Get email addresses in a Slack Conversation.

func (*Conversation) Remove

func (c *Conversation) Remove(_ context.Context, emails []string) error

Remove email addresses from a Slack Conversation.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL