feat: add http as sms provider (#8540)

# Which Problems Are Solved

Send SMS messages as a HTTP call to a relay, for own logic on handling
different SMS providers.

# How the Problems Are Solved

Add HTTP as SMS provider type and handling of webhook messages in the
notification handlers.

# Additional Changes

Clean up old Twilio events, which were supposed to handle the general
SMS providers with deactivate, activate and remove.

# Additional Context

Partially closes #8270

---------

Co-authored-by: Livio Spring <livio.a@gmail.com>
This commit is contained in:
Stefan Benz
2024-09-06 15:11:36 +02:00
committed by GitHub
parent d2e0ac07f1
commit 5bdf1a4547
26 changed files with 2536 additions and 593 deletions

View File

@@ -5,8 +5,8 @@ import (
"github.com/zitadel/logging"
"github.com/zitadel/zitadel/internal/notification/channels/sms"
"github.com/zitadel/zitadel/internal/notification/channels/smtp"
"github.com/zitadel/zitadel/internal/notification/channels/twilio"
"github.com/zitadel/zitadel/internal/notification/channels/webhook"
"github.com/zitadel/zitadel/internal/notification/handlers"
"github.com/zitadel/zitadel/internal/notification/senders"
@@ -78,20 +78,20 @@ func (c *channels) Email(ctx context.Context) (*senders.Chain, *smtp.Config, err
return chain, smtpCfg, err
}
func (c *channels) SMS(ctx context.Context) (*senders.Chain, *twilio.Config, error) {
twilioCfg, err := c.q.GetTwilioConfig(ctx)
func (c *channels) SMS(ctx context.Context) (*senders.Chain, *sms.Config, error) {
smsCfg, err := c.q.GetActiveSMSConfig(ctx)
if err != nil {
return nil, nil, err
}
chain, err := senders.SMSChannels(
ctx,
twilioCfg,
smsCfg,
c.q.GetFileSystemProvider,
c.q.GetLogProvider,
c.counters.success.sms,
c.counters.failed.sms,
)
return chain, twilioCfg, err
return chain, smsCfg, err
}
func (c *channels) Webhook(ctx context.Context, cfg webhook.Config) (*senders.Chain, error) {