You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: alerts.go
    path of file: ./repos/highlight/backend/alerts
    
    the code of the file until where you have to start completion: package alerts

import (
	"context"
	"net/url"
	"strings"
	"time"

	microsoft_teams "github.com/highlight-run/highlight/backend/alerts/integrations/microsoft-teams"
	"github.com/highlight-run/highlight/backend/alerts/integrations/webhook"
	"github.com/highlight-run/highlight/backend/model"
	"github.com/highlight-run/highlight/backend/routing"
	tempalerts "github.com/highlight-run/highlight/backend/temp-alerts"
	"golang.org/x/sync/errgroup"

	"github.com/highlight-run/highlight/backend/alerts/integrations"
	"github.com/highlight-run/highlight/backend/alerts/integrations/discord"
	"golang.org/x/text/cases"
	"golang.org/x/text/language"
)

type SendErrorAlertEvent struct {
	Session         *model.Session
	ErrorAlert      *model.ErrorAlert
	ErrorGroup      *model.ErrorGroup
	ErrorObject     *model.ErrorObject
	Workspace       *model.Workspace
	ErrorCount      int64
	VisitedURL      string
	FirstErrorAlert bool
}

func SendErrorAlert(ctx context.Context, event SendErrorAlertEvent) error {
	payload := integrations.ErrorAlertPayload{
		ErrorCount:      event.ErrorCount,
		ErrorTitle:      event.ErrorGroup.Event,
		UserIdentifier:  event.Session.Identifier,
		ErrorURL:        getErrorURL(event.ErrorAlert, event.ErrorGroup, event.ErrorObject),
		ErrorResolveUR
    
func SendErrorAlert(ctx context.Context, event SendErrorAlertEvent) error {
	payload := integrations.ErrorAlertPayload{
		ErrorCount:      event.ErrorCount,
		ErrorTitle:      event.ErrorGroup.Event,
		UserIdentifier:  event.Session.Identifier,
		ErrorURL:        getErrorURL(event.ErrorAlert, event.ErrorGroup, event.ErrorObject),
		ErrorResolveURL: getErrorResolveURL(event.ErrorAlert, event.ErrorGroup, event.ErrorObject),
		ErrorIgnoreURL:  getErrorIgnoreURL(event.ErrorAlert, event.ErrorGroup, event.ErrorObject),
		ErrorSnoozeURL:  getErrorSnoozeURL(event.ErrorAlert, event.ErrorGroup, event.ErrorObject),
		SessionSecureID: event.Session.SecureID,
		SessionURL:      getSessionURL(event.ErrorAlert.ProjectID, event.Session),
		SessionExcluded: event.Session.Excluded && *event.Session.Processed,
		VisitedURL:      event.VisitedURL,
		FirstTimeAlert:  event.FirstErrorAlert,
	}

	var g errgroup.Group
	g.Go(func() error {
		payload = attachReferrerToErrorAlertPayload(ctx, payload, routing.Webhook)
		for _, wh := range event.ErrorAlert.WebhookDestinations {
			if err := webhook.SendErrorAlert(wh, &payload); err != nil {
				return err
			}
		}
		return nil
	})

	g.Go(func() error {
		if !isWorkspaceIntegratedWithDiscord(*event.Workspace) {
			return nil
		}

		bot, err := discord.NewDiscordBot(*event.Workspace.DiscordGuildId)
		if err != nil {
			return err
		}

		payload = attachReferrerToErrorAlertPayload(ctx, payload, routing.Discord)
		for _, channel := range event.ErrorAlert.DiscordChannelsToNotify {
			err = bot.SendErrorAlert(channel.ID, payload)

			if err != nil {
				return err
			}
		}
		return nil
	})

	g.Go(func() error {
		if !isWorkspaceIntegratedWithMicrosoftTeams(*event.Workspace) {
			return nil
		}

		bot, err := microsoft_teams.NewMicrosoftTeamsBot(*event.Workspace.MicrosoftTeamsTenantId)
		if err != nil {
			return err
		}

		payload = attachReferrerToErrorAlertPayload(ctx, payload, routing.MicrosoftTeams)
		for _, channel := range event.ErrorAlert.MicrosoftTeamsChannelsToNotify {
			err = bot.SendErrorAlert(channel.ID, payload)

			if err != nil {
				return err
			}
		}
		return nil
	})

	return g.Wait()
}