1
0
mirror of https://github.com/zitadel/zitadel.git synced 2024-12-24 16:47:47 +00:00

39 lines
1.1 KiB
Go
Raw Normal View History

package senders
import (
"context"
"github.com/zitadel/zitadel/internal/notification/channels"
"github.com/zitadel/zitadel/internal/notification/channels/fs"
"github.com/zitadel/zitadel/internal/notification/channels/instrumenting"
"github.com/zitadel/zitadel/internal/notification/channels/log"
"github.com/zitadel/zitadel/internal/notification/channels/twilio"
)
const twilioSpanName = "twilio.NotificationChannel"
func SMSChannels(
ctx context.Context,
twilioConfig *twilio.Config,
getFileSystemProvider func(ctx context.Context) (*fs.Config, error),
getLogProvider func(ctx context.Context) (*log.Config, error),
successMetricName,
failureMetricName string,
) (chain *Chain, err error) {
channels := make([]channels.NotificationChannel, 0, 3)
if twilioConfig != nil {
channels = append(
channels,
instrumenting.Wrap(
ctx,
twilio.InitChannel(*twilioConfig),
twilioSpanName,
successMetricName,
failureMetricName,
),
)
}
channels = append(channels, debugChannels(ctx, getFileSystemProvider, getLogProvider)...)
return ChainChannels(channels...), nil
}