Skip to content

Latest commit

 

History

History

fxslack

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Fx Slack Module

ci go report codecov Deps PkgGoDev

Fx module for Slack.

Overview

This module provides to your Fx application a slack.Client, that you can inject anywhere to interact with the Slack API.

Installation

This module requires fxhttpclient.

Install the modules:

go get github.com/ankorstore/yokai/fxhttpclient
go get github.com/ankorstore/yokai-contrib/fxslack

Then activate them in your application bootstrapper:

// internal/bootstrap.go
package internal

import (
	"github.com/ankorstore/yokai-contrib/fxslack"
	"github.com/ankorstore/yokai/fxcore"
	"github.com/ankorstore/yokai/fxhttpclient"
)

var Bootstrapper = fxcore.NewBootstrapper().WithOptions(
	// load modules
	fxhttpclient.FxHttpClientModule,
	fxslack.FxSlackModule,
	// ...
)

Configuration

Configuration reference:

# ./configs/config.yaml
app:
  name: app
  env: dev
  version: 0.1.0
  debug: true
modules:
  slack:
    auth_token: ${SLACK_AUTH_TOKEN}  # Slack Auth Token
    app_level_token: ${SLACK_APP_LEVEL_TOKEN} # Slack App level Token

Testing

In test mode, this client is configured to interact with a fake slack server.

See example.