Repository: TwiN/gatus

Issue:
incident.io provider does not send deduplication_key on first firing, causing 422 error
### Describe the bug

When using the native incident.io alert provider in Gatus, the first firing does not include a `deduplication_key` in the request body. As a result, incident.io responds with HTTP 422 ("Deduplication key is required") and no incident is created. This prevents incident.io integration from working out of the box.


### What do you see?

- Gatus triggers an alert for an endpoint configured with the incident.io provider.
- The POST request sent to incident.io does not include a `deduplication_key`.
- The incident.io API responds with a 422 error: "Deduplication key is required".
- No incident is created in incident.io.

### What do you expect to see?

- On the first firing, Gatus should generate and send a valid `deduplication_key` in the incident.io payload so that an incident is created.
- If `send-on-resolved` is enabled, the same key should be reused for resolve events.
- If not, a new key should be generated for each firing as needed.

### List the steps that must be taken to reproduce this issue

1. Configure Gatus with the incident.io alert provider:
   ```yaml
   alerting:
     incident-io:
       url: "https://api.incident.io/v2/alert_events/http/<id>"
       auth-token: "<token>"
   endpoints:
     - name: example
       url: "https://example.org/health"
       conditions:
         - "[STATUS] == 200"
       alerts:
         - type: incident-io
           description: "service down"
           send-on-resolved: true
   ```
2. Trigger an alert (e.g., stop the monitored service so that the endpoint fails).
3. Observe the outgoing POST request to incident.io and the 422 response.
4. Confirm that no incident appears in incident.io dashboard.



### Version

5.24.3

### Additional information

**Additional context**
- This happens because the provider only sets `deduplication_key` from `alert.ResolveKey`, which is empty on the first firing.
- See [alerting/provider/incidentio/incidentio.go](https://github.com/TwiN/gatus/blob/64a504365576cb8faa99a5242f9093783cb22591/alerting/provider/incidentio/incidentio.go) for reference.

Discussion:
@TwiN: @KevPace very detailed issue! Would you like to try fixing it?@KevPace: @TwiN thanks, I could give it a try, I'm not that golang pro but, i can try it :) @KevPace: @TwiN  fix is done by my private profile :)
i also added that the metadata object will also use the extraLabels 

Solution patch:
diff --git a/alerting/provider/awsses/awsses.go b/alerting/provider/awsses/awsses.go
index aa071450..a944a6d3 100644
--- a/alerting/provider/awsses/awsses.go
+++ b/alerting/provider/awsses/awsses.go
@@ -1,18 +1,18 @@
 package awsses
 
 import (
+	"context"
 	"errors"
 	"fmt"
 	"strings"
 
 	"github.com/TwiN/gatus/v5/alerting/alert"
 	"github.com/TwiN/gatus/v5/config/endpoint"
-	"github.com/TwiN/logr"
-	"github.com/aws/aws-sdk-go/aws"
-	"github.com/aws/aws-sdk-go/aws/awserr"
-	"github.com/aws/aws-sdk-go/aws/credentials"
-	"github.com/aws/aws-sdk-go/aws/session"
-	"github.com/aws/aws-sdk-go/service/ses"
+	"github.com/aws/aws-sdk-go-v2/aws"
+	"github.com/aws/aws-sdk-go-v2/config"
+	"github.com/aws/aws-sdk-go-v2/credentials"
+	"github.com/aws/aws-sdk-go-v2/service/ses"
+	"github.com/aws/aws-sdk-go-v2/service/ses/types"
 	"gopkg.in/yaml.v3"
 )
 
@@ -102,63 +102,50 @@ func (provider *AlertProvider) Send(ep *endpoint.Endpoint, alert *alert.Alert, r
 	if err != nil {
 		return err
 	}
-	awsSession, err := provider.createSession(cfg)
+	ctx := context.Background()
+	svc, err := provider.createClient(ctx, cfg)
 	if err != nil {
 		return err
 	}
-	svc := ses.New(awsSession)
 	subject, body := provider.buildMessageSubjectAndBody(ep, alert, result, resolved)
 	emails := strings.Split(cfg.To, ",")
-
 	input := &ses.SendEmailInput{
-		Destination: &ses.Destination{
-			ToAddresses: aws.StringSlice(emails),
+		Destination: &types.Destination{
+			ToAddresses: emails,
 		},
-		Message: &ses.Message{
-			Body: &ses.Body{
-				Text: &ses.Content{
+		Message: &types.Message{
+			Body: &types.Body{
+				Text: &types.Content{
 					Charset: aws.String(CharSet),
 					Data:    aws.String(body),
 				},
 			},
-			Subject: &ses.Content{
+			Subject: &types.Content{
 				Charset: aws.String(CharSet),
 				Data:    aws.String(subject),
 			},
 		},
 		Source: aws.String(cfg.From),
 	}
-	if _, err = svc.SendEmail(input); err != nil {
-		if aerr, ok := err.(awserr.Error); ok {
-			switch aerr.Code() {
-			case ses.ErrCodeMessageRejected:
-				logr.Error(ses.ErrCodeMessageRejected + ": " + aerr.Error())
-			case ses.ErrCodeMailFromDomainNotVerifiedException:
-				logr.Error(ses.ErrCodeMailFromDomainNotVerifiedException + ": " + aerr.Error())
-			case ses.ErrCodeConfigurationSetDoesNotExistException:
-				logr.Error(ses.ErrCodeConfigurationSetDoesNotExistException + ": " + aerr.Error())
-			default:
-				logr.Error(aerr.Error())
-			}
-		} else {
-			// Print the error, cast err to awserr.Error to get the Code and
-			// Message from an error.
-			logr.Error(err.Error())
-		}
-
+	if _, err = svc.SendEmail(ctx, input); err != nil {
 		return err
 	}
 	return nil
 }
 
-func (provider *AlertProvider) createSession(cfg *Config) (*session.Session, error) {
-	awsConfig := &aws.Config{
-		Region: aws.String(cfg.Region),
+func (provider *AlertProvider) createClient(ctx context.Context, cfg *Config) (*ses.Client, error) {
+	var opts []func(*config.LoadOptions) error
+	if len(cfg.Region) > 0 {
+		opts = append(opts, config.WithRegion(cfg.Region))
 	}
 	if len(cfg.AccessKeyID) > 0 && len(cfg.SecretAccessKey) > 0 {
-		awsConfig.Credentials = credentials.NewStaticCredentials(cfg.AccessKeyID, cfg.SecretAccessKey, "")
+		opts = append(opts, config.WithCredentialsProvider(credentials.NewStaticCredentialsProvider(cfg.AccessKeyID, cfg.SecretAccessKey, "")))
+	}
+	awsConfig, err := config.LoadDefaultConfig(ctx, opts...)
+	if err != nil {
+		return nil, err
 	}
-	return session.NewSession(awsConfig)
+	return ses.NewFromConfig(awsConfig), nil
 }
 
 // buildMessageSubjectAndBody builds the message subject and body
diff --git a/alerting/provider/incidentio/dedup.go b/alerting/provider/incidentio/dedup.go
new file mode 100644
index 00000000..2bea72be
--- /dev/null
+++ b/alerting/provider/incidentio/dedup.go
@@ -0,0 +1,18 @@
+package incidentio
+
+import (
+	"crypto/sha256"
+	"encoding/hex"
+	"fmt"
+	"time"
+
+	"github.com/TwiN/gatus/v5/alerting/alert"
+	"github.com/TwiN/gatus/v5/config/endpoint"
+)
+
+// generateDeduplicationKey generates a unique deduplication_key for incident.io
+func generateDeduplicationKey(ep *endpoint.Endpoint, alert *alert.Alert) string {
+	data := fmt.Sprintf("%s|%s|%s|%d", ep.Key(), alert.Type, alert.GetDescription(), time.Now().UnixNano())
+	hash := sha256.Sum256([]byte(data))
+	return hex.EncodeToString(hash[:])
+}
diff --git a/alerting/provider/incidentio/incidentio.go b/alerting/provider/incidentio/incidentio.go
index 52039261..6783f571 100644
--- a/alerting/provider/incidentio/incidentio.go
+++ b/alerting/provider/incidentio/incidentio.go
@@ -153,27 +153,44 @@ func (provider *AlertProvider) buildRequestBody(cfg *Config, ep *endpoint.Endpoi
 		} else {
 			prefix = "🔴"
 		}
-		// No need for \n since incident.io trims it anyways.
 		formattedConditionResults += fmt.Sprintf(" %s %s ", prefix, conditionResult.Condition)
 	}
 	if len(alert.GetDescription()) > 0 {
 		message += " with the following description: " + alert.GetDescription()
 	}
 	message += fmt.Sprintf(" and the following conditions: %s ", formattedConditionResults)
-	var body []byte
+
+	// Generate deduplication key if empty (first firing)
+	if alert.ResolveKey == "" {
+		// Generate unique key (endpoint key, alert type, timestamp)
+		alert.ResolveKey = generateDeduplicationKey(ep, alert)
+	}
+	// Extract alert_source_config_id from URL
 	alertSourceID := strings.TrimPrefix(cfg.URL, restAPIUrl)
-	body, _ = json.Marshal(Body{
+	// Merge metadata: cfg.Metadata + ep.ExtraLabels (if present)
+	mergedMetadata := map[string]interface{}{}
+	// Copy cfg.Metadata
+	for k, v := range cfg.Metadata {
+		mergedMetadata[k] = v
+	}
+	// Add extra labels from endpoint (if present)
+	if ep.ExtraLabels != nil && len(ep.ExtraLabels) > 0 {
+		for k, v := range ep.ExtraLabels {
+			mergedMetadata[k] = v
+		}
+	}
+
+	body, _ := json.Marshal(Body{
 		AlertSourceConfigID: alertSourceID,
 		Title:               "Gatus: " + ep.DisplayName(),
 		Status:              status,
 		DeduplicationKey:    alert.ResolveKey,
 		Description:         message,
 		SourceURL:           cfg.SourceURL,
-		Metadata:            cfg.Metadata,
+		Metadata:            mergedMetadata,
 	})
 	fmt.Printf("%v", string(body))
 	return body
-
 }
 func (provider *AlertProvider) GetConfig(group string, alert *alert.Alert) (*Config, error) {
 	cfg := provider.DefaultConfig
diff --git a/go.mod b/go.mod
index 5c20b553..0dfdcdd7 100644
--- a/go.mod
+++ b/go.mod
@@ -11,8 +11,11 @@ require (
 	github.com/TwiN/gocache/v2 v2.4.0
 	github.com/TwiN/health v1.6.0
 	github.com/TwiN/logr v0.3.1
-	github.com/TwiN/whois v1.1.11
-	github.com/aws/aws-sdk-go v1.55.8
+	github.com/TwiN/whois v1.2.0
+	github.com/aws/aws-sdk-go-v2 v1.39.2
+	github.com/aws/aws-sdk-go-v2/config v1.31.12
+	github.com/aws/aws-sdk-go-v2/credentials v1.18.16
+	github.com/aws/aws-sdk-go-v2/service/ses v1.34.5
 	github.com/coreos/go-oidc/v3 v3.14.1
 	github.com/gofiber/fiber/v2 v2.52.8
 	github.com/google/go-github/v48 v48.2.0
@@ -41,6 +44,16 @@ require (
 	cloud.google.com/go/compute/metadata v0.7.0 // indirect
 	github.com/42wim/httpsig v1.2.2 // indirect
 	github.com/andybalholm/brotli v1.2.0 // indirect
+	github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.9 // indirect
+	github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.9 // indirect
+	github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.9 // indirect
+	github.com/aws/aws-sdk-go-v2/internal/ini v1.8.3 // indirect
+	github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.1 // indirect
+	github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.9 // indirect
+	github.com/aws/aws-sdk-go-v2/service/sso v1.29.6 // indirect
+	github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.1 // indirect
+	github.com/aws/aws-sdk-go-v2/service/sts v1.38.6 // indirect
+	github.com/aws/smithy-go v1.23.0 // indirect
 	github.com/beorn7/perks v1.0.1 // indirect
 	github.com/cespare/xxhash/v2 v2.3.0 // indirect
 	github.com/davidmz/go-pageant v1.0.2 // indirect
@@ -56,7 +69,6 @@ require (
 	github.com/googleapis/enterprise-certificate-proxy v0.3.6 // indirect
 	github.com/googleapis/gax-go/v2 v2.14.2 // indirect
 	github.com/hashicorp/go-version v1.7.0 // indirect
-	github.com/jmespath/go-jmespath v0.4.0 // indirect
 	github.com/klauspost/compress v1.18.0 // indirect
 	github.com/kylelemons/godebug v1.1.0 // indirect
 	github.com/mattn/go-colorable v0.1.13 // indirect
diff --git a/go.sum b/go.sum
index 89af2786..643fc49f 100644
--- a/go.sum
+++ b/go.sum
@@ -18,21 +18,46 @@ github.com/TwiN/health v1.6.0 h1:L2ks575JhRgQqWWOfKjw9B0ec172hx7GdToqkYUycQM=
 github.com/TwiN/health v1.6.0/go.mod h1:Z6TszwQPMvtSiVx1QMidVRgvVr4KZGfiwqcD7/Z+3iw=
 github.com/TwiN/logr v0.3.1 h1:CfTKA83jUmsAoxqrr3p4JxEkqXOBnEE9/f35L5MODy4=
 github.com/TwiN/logr v0.3.1/go.mod h1:BZgZFYq6fQdU3KtR8qYato3zUEw53yQDaIuujHb55Jw=
-github.com/TwiN/whois v1.1.11 h1:lYiYgPRSQ3kH8sQfgHcBY/uNSGGvWPRikEjn+LJZ9+Q=
-github.com/TwiN/whois v1.1.11/go.mod h1:TjipCMpJRAJYKmtz/rXQBU6UGxMh6bk8SHazu7OMnQE=
+github.com/TwiN/whois v1.2.0 h1:/Z22SrS3Z0FQgMl1+4bKSu9UmEQTfGx9i9J4Hn18eQk=
+github.com/TwiN/whois v1.2.0/go.mod h1:TjipCMpJRAJYKmtz/rXQBU6UGxMh6bk8SHazu7OMnQE=
 github.com/andybalholm/brotli v1.2.0 h1:ukwgCxwYrmACq68yiUqwIWnGY0cTPox/M94sVwToPjQ=
 github.com/andybalholm/brotli v1.2.0/go.mod h1:rzTDkvFWvIrjDXZHkuS16NPggd91W3kUSvPlQ1pLaKY=
 github.com/aryann/difflib v0.0.0-20210328193216-ff5ff6dc229b h1:uUXgbcPDK3KpW29o4iy7GtuappbWT0l5NaMo9H9pJDw=
 github.com/aryann/difflib v0.0.0-20210328193216-ff5ff6dc229b/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A=
-github.com/aws/aws-sdk-go v1.55.8 h1:JRmEUbU52aJQZ2AjX4q4Wu7t4uZjOu71uyNmaWlUkJQ=
-github.com/aws/aws-sdk-go v1.55.8/go.mod h1:ZkViS9AqA6otK+JBBNH2++sx1sgxrPKcSzPPvQkUtXk=
+github.com/aws/aws-sdk-go-v2 v1.39.2 h1:EJLg8IdbzgeD7xgvZ+I8M1e0fL0ptn/M47lianzth0I=
+github.com/aws/aws-sdk-go-v2 v1.39.2/go.mod h1:sDioUELIUO9Znk23YVmIk86/9DOpkbyyVb1i/gUNFXY=
+github.com/aws/aws-sdk-go-v2/config v1.31.12 h1:pYM1Qgy0dKZLHX2cXslNacbcEFMkDMl+Bcj5ROuS6p8=
+github.com/aws/aws-sdk-go-v2/config v1.31.12/go.mod h1:/MM0dyD7KSDPR+39p9ZNVKaHDLb9qnfDurvVS2KAhN8=
+github.com/aws/aws-sdk-go-v2/credentials v1.18.16 h1:4JHirI4zp958zC026Sm+V4pSDwW4pwLefKrc0bF2lwI=
+github.com/aws/aws-sdk-go-v2/credentials v1.18.16/go.mod h1:qQMtGx9OSw7ty1yLclzLxXCRbrkjWAM7JnObZjmCB7I=
+github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.9 h1:Mv4Bc0mWmv6oDuSWTKnk+wgeqPL5DRFu5bQL9BGPQ8Y=
+github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.9/go.mod h1:IKlKfRppK2a1y0gy1yH6zD+yX5uplJ6UuPlgd48dJiQ=
+github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.9 h1:se2vOWGD3dWQUtfn4wEjRQJb1HK1XsNIt825gskZ970=
+github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.9/go.mod h1:hijCGH2VfbZQxqCDN7bwz/4dzxV+hkyhjawAtdPWKZA=
+github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.9 h1:6RBnKZLkJM4hQ+kN6E7yWFveOTg8NLPHAkqrs4ZPlTU=
+github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.9/go.mod h1:V9rQKRmK7AWuEsOMnHzKj8WyrIir1yUJbZxDuZLFvXI=
+github.com/aws/aws-sdk-go-v2/internal/ini v1.8.3 h1:bIqFDwgGXXN1Kpp99pDOdKMTTb5d2KyU5X/BZxjOkRo=
+github.com/aws/aws-sdk-go-v2/internal/ini v1.8.3/go.mod h1:H5O/EsxDWyU+LP/V8i5sm8cxoZgc2fdNR9bxlOFrQTo=
+github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.1 h1:oegbebPEMA/1Jny7kvwejowCaHz1FWZAQ94WXFNCyTM=
+github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.1/go.mod h1:kemo5Myr9ac0U9JfSjMo9yHLtw+pECEHsFtJ9tqCEI8=
+github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.9 h1:5r34CgVOD4WZudeEKZ9/iKpiT6cM1JyEROpXjOcdWv8=
+github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.9/go.mod h1:dB12CEbNWPbzO2uC6QSWHteqOg4JfBVJOojbAoAUb5I=
+github.com/aws/aws-sdk-go-v2/service/ses v1.34.5 h1:NwOeuOFrWoh4xWKINrmaAK4Vh75jmmY0RAuNjQ6W5Es=
+github.com/aws/aws-sdk-go-v2/service/ses v1.34.5/go.mod h1:m3BsMJZD0eqjGIniBzwrNUqG9ZUPquC4hY9FyE2qNFo=
+github.com/aws/aws-sdk-go-v2/service/sso v1.29.6 h1:A1oRkiSQOWstGh61y4Wc/yQ04sqrQZr1Si/oAXj20/s=
+github.com/aws/aws-sdk-go-v2/service/sso v1.29.6/go.mod h1:5PfYspyCU5Vw1wNPsxi15LZovOnULudOQuVxphSflQA=
+github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.1 h1:5fm5RTONng73/QA73LhCNR7UT9RpFH3hR6HWL6bIgVY=
+github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.1/go.mod h1:xBEjWD13h+6nq+z4AkqSfSvqRKFgDIQeaMguAJndOWo=
+github.com/aws/aws-sdk-go-v2/service/sts v1.38.6 h1:p3jIvqYwUZgu/XYeI48bJxOhvm47hZb5HUQ0tn6Q9kA=
+github.com/aws/aws-sdk-go-v2/service/sts v1.38.6/go.mod h1:WtKK+ppze5yKPkZ0XwqIVWD4beCwv056ZbPQNoeHqM8=
+github.com/aws/smithy-go v1.23.0 h1:8n6I3gXzWJB2DxBDnfxgBaSX6oe0d/t10qGz7OKqMCE=
+github.com/aws/smithy-go v1.23.0/go.mod h1:t1ufH5HMublsJYulve2RKmHDC15xu1f26kHCp/HgceI=
 github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
 github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
 github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
 github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
 github.com/coreos/go-oidc/v3 v3.14.1 h1:9ePWwfdwC4QKRlCXsJGou56adA/owXczOzwKdOumLqk=
 github.com/coreos/go-oidc/v3 v3.14.1/go.mod h1:HaZ3szPaZ0e4r6ebqvsLWlk2Tn+aejfmrfah6hnSYEU=
-github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
 github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
 github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
 github.com/davidmz/go-pageant v1.0.2 h1:bPblRCh5jGU+Uptpz6LgMZGD5hJoOt7otgT454WvHn0=
@@ -78,10 +103,6 @@ github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKe
 github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
 github.com/ishidawataru/sctp v0.0.0-20230406120618-7ff4192f6ff2 h1:i2fYnDurfLlJH8AyyMOnkLHnHeP8Ff/DDpuZA/D3bPo=
 github.com/ishidawataru/sctp v0.0.0-20230406120618-7ff4192f6ff2/go.mod h1:co9pwDoBCm1kGxawmb4sPq0cSIOOWNPT4KnHotMP1Zg=
-github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
-github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
-github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8=
-github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
 github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo=
 github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ=
 github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
@@ -126,7 +147,6 @@ github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
 github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
 github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII=
 github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o=
-github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
 github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
 github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
 github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
@@ -260,9 +280,6 @@ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntN
 gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
 gopkg.in/mail.v2 v2.3.1 h1:WYFn/oANrAGP2C0dcV6/pbkPzv8yGzqTjPmTeO7qoXk=
 gopkg.in/mail.v2 v2.3.1/go.mod h1:htwXN1Qh09vZJ1NVKxQqHPBaCBbzKhp5GzuJEA4VJWw=
-gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
-gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
-gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
 gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
 gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
 modernc.org/cc/v4 v4.26.2 h1:991HMkLjJzYBIfha6ECZdjrIYz2/1ayr+FL8GN+CNzM=



Test patch:
diff --git a/alerting/provider/incidentio/incidentio_test.go b/alerting/provider/incidentio/incidentio_test.go
index bab479bf..ccab5125 100644
--- a/alerting/provider/incidentio/incidentio_test.go
+++ b/alerting/provider/incidentio/incidentio_test.go
@@ -183,39 +183,63 @@ func TestAlertProvider_BuildRequestBody(t *testing.T) {
 	secondDescription := "description-2"
 	restAPIUrl := "https://api.incident.io/v2/alert_events/http/"
 	scenarios := []struct {
-		Name         string
-		Provider     AlertProvider
-		Alert        alert.Alert
-		Resolved     bool
-		ExpectedBody string
+		Name                     string
+		Provider                 AlertProvider
+		Alert                    alert.Alert
+		Resolved                 bool
+		ExpectedAlertSourceID    string
+		ExpectedStatus           string
+		ExpectedTitle            string
+		ExpectedDescription      string
+		ExpectedSourceURL        string
+		ExpectedMetadata         map[string]interface{}
+		ShouldHaveDeduplicationKey bool
 	}{
 		{
-			Name:         "triggered",
-			Provider:     AlertProvider{DefaultConfig: Config{URL: restAPIUrl + "some-id", AuthToken: "some-token"}},
-			Alert:        alert.Alert{Description: &firstDescription, SuccessThreshold: 5, FailureThreshold: 3},
-			Resolved:     false,
-			ExpectedBody: `{"alert_source_config_id":"some-id","status":"firing","title":"Gatus: endpoint-name","description":"An alert has been triggered due to having failed 3 time(s) in a row with the following description: description-1 and the following conditions:  🔴 [CONNECTED] == true  🔴 [STATUS] == 200  "}`,
+			Name:                     "triggered",
+			Provider:                 AlertProvider{DefaultConfig: Config{URL: restAPIUrl + "some-id", AuthToken: "some-token"}},
+			Alert:                    alert.Alert{Description: &firstDescription, SuccessThreshold: 5, FailureThreshold: 3},
+			Resolved:                 false,
+			ExpectedAlertSourceID:    "some-id",
+			ExpectedStatus:           "firing",
+			ExpectedTitle:            "Gatus: endpoint-name",
+			ExpectedDescription:      "An alert has been triggered due to having failed 3 time(s) in a row with the following description: description-1 and the following conditions:  🔴 [CONNECTED] == true  🔴 [STATUS] == 200  ",
+			ShouldHaveDeduplicationKey: true,
 		},
 		{
-			Name:         "resolved",
-			Provider:     AlertProvider{DefaultConfig: Config{URL: restAPIUrl + "some-id", AuthToken: "some-token"}},
-			Alert:        alert.Alert{Description: &secondDescription, SuccessThreshold: 5, FailureThreshold: 3},
-			Resolved:     true,
-			ExpectedBody: `{"alert_source_config_id":"some-id","status":"resolved","title":"Gatus: endpoint-name","description":"An alert has been resolved after passing successfully 5 time(s) in a row with the following description: description-2 and the following conditions:  🟢 [CONNECTED] == true  🟢 [STATUS] == 200  "}`,
+			Name:                     "resolved",
+			Provider:                 AlertProvider{DefaultConfig: Config{URL: restAPIUrl + "some-id", AuthToken: "some-token"}},
+			Alert:                    alert.Alert{Description: &secondDescription, SuccessThreshold: 5, FailureThreshold: 3},
+			Resolved:                 true,
+			ExpectedAlertSourceID:    "some-id",
+			ExpectedStatus:           "resolved",
+			ExpectedTitle:            "Gatus: endpoint-name",
+			ExpectedDescription:      "An alert has been resolved after passing successfully 5 time(s) in a row with the following description: description-2 and the following conditions:  🟢 [CONNECTED] == true  🟢 [STATUS] == 200  ",
+			ShouldHaveDeduplicationKey: true,
 		},
 		{
-			Name:         "resolved-with-metadata-source-url",
-			Provider:     AlertProvider{DefaultConfig: Config{URL: restAPIUrl + "some-id", AuthToken: "some-token", Metadata: map[string]interface{}{"service": "some-service", "team": "very-core"}, SourceURL: "some-source-url"}},
-			Alert:        alert.Alert{Description: &secondDescription, SuccessThreshold: 5, FailureThreshold: 3},
-			Resolved:     true,
-			ExpectedBody: `{"alert_source_config_id":"some-id","status":"resolved","title":"Gatus: endpoint-name","description":"An alert has been resolved after passing successfully 5 time(s) in a row with the following description: description-2 and the following conditions:  🟢 [CONNECTED] == true  🟢 [STATUS] == 200  ","source_url":"some-source-url","metadata":{"service":"some-service","team":"very-core"}}`,
+			Name:                     "resolved-with-metadata-source-url",
+			Provider:                 AlertProvider{DefaultConfig: Config{URL: restAPIUrl + "some-id", AuthToken: "some-token", Metadata: map[string]interface{}{"service": "some-service", "team": "very-core"}, SourceURL: "some-source-url"}},
+			Alert:                    alert.Alert{Description: &secondDescription, SuccessThreshold: 5, FailureThreshold: 3},
+			Resolved:                 true,
+			ExpectedAlertSourceID:    "some-id",
+			ExpectedStatus:           "resolved",
+			ExpectedTitle:            "Gatus: endpoint-name",
+			ExpectedDescription:      "An alert has been resolved after passing successfully 5 time(s) in a row with the following description: description-2 and the following conditions:  🟢 [CONNECTED] == true  🟢 [STATUS] == 200  ",
+			ExpectedSourceURL:        "some-source-url",
+			ExpectedMetadata:         map[string]interface{}{"service": "some-service", "team": "very-core"},
+			ShouldHaveDeduplicationKey: true,
 		},
 		{
-			Name:         "group-override",
-			Provider:     AlertProvider{DefaultConfig: Config{URL: restAPIUrl + "some-id", AuthToken: "some-token"}, Overrides: []Override{{Group: "g", Config: Config{URL: restAPIUrl + "different-id", AuthToken: "some-token"}}}},
-			Alert:        alert.Alert{Description: &firstDescription, SuccessThreshold: 5, FailureThreshold: 3},
-			Resolved:     false,
-			ExpectedBody: `{"alert_source_config_id":"different-id","status":"firing","title":"Gatus: endpoint-name","description":"An alert has been triggered due to having failed 3 time(s) in a row with the following description: description-1 and the following conditions:  🔴 [CONNECTED] == true  🔴 [STATUS] == 200  "}`,
+			Name:                     "group-override",
+			Provider:                 AlertProvider{DefaultConfig: Config{URL: restAPIUrl + "some-id", AuthToken: "some-token"}, Overrides: []Override{{Group: "g", Config: Config{URL: restAPIUrl + "different-id", AuthToken: "some-token"}}}},
+			Alert:                    alert.Alert{Description: &firstDescription, SuccessThreshold: 5, FailureThreshold: 3},
+			Resolved:                 false,
+			ExpectedAlertSourceID:    "different-id",
+			ExpectedStatus:           "firing",
+			ExpectedTitle:            "Gatus: endpoint-name",
+			ExpectedDescription:      "An alert has been triggered due to having failed 3 time(s) in a row with the following description: description-1 and the following conditions:  🔴 [CONNECTED] == true  🔴 [STATUS] == 200  ",
+			ShouldHaveDeduplicationKey: true,
 		},
 	}
 
@@ -237,13 +261,42 @@ func TestAlertProvider_BuildRequestBody(t *testing.T) {
 				},
 				scenario.Resolved,
 			)
-			if string(body) != scenario.ExpectedBody {
-				t.Errorf("expected:\n%s\ngot:\n%s", scenario.ExpectedBody, body)
-			}
-			out := make(map[string]interface{})
-			if err := json.Unmarshal(body, &out); err != nil {
+			
+			// Parse the JSON body
+			var parsedBody Body
+			if err := json.Unmarshal(body, &parsedBody); err != nil {
 				t.Error("expected body to be valid JSON, got error:", err.Error())
 			}
+			
+			// Validate individual fields
+			if parsedBody.AlertSourceConfigID != scenario.ExpectedAlertSourceID {
+				t.Errorf("expected alert_source_config_id to be %s, got %s", scenario.ExpectedAlertSourceID, parsedBody.AlertSourceConfigID)
+			}
+			if parsedBody.Status != scenario.ExpectedStatus {
+				t.Errorf("expected status to be %s, got %s", scenario.ExpectedStatus, parsedBody.Status)
+			}
+			if parsedBody.Title != scenario.ExpectedTitle {
+				t.Errorf("expected title to be %s, got %s", scenario.ExpectedTitle, parsedBody.Title)
+			}
+			if parsedBody.Description != scenario.ExpectedDescription {
+				t.Errorf("expected description to be %s, got %s", scenario.ExpectedDescription, parsedBody.Description)
+			}
+			if scenario.ExpectedSourceURL != "" && parsedBody.SourceURL != scenario.ExpectedSourceURL {
+				t.Errorf("expected source_url to be %s, got %s", scenario.ExpectedSourceURL, parsedBody.SourceURL)
+			}
+			if scenario.ExpectedMetadata != nil {
+				metadataJSON, _ := json.Marshal(parsedBody.Metadata)
+				expectedMetadataJSON, _ := json.Marshal(scenario.ExpectedMetadata)
+				if string(metadataJSON) != string(expectedMetadataJSON) {
+					t.Errorf("expected metadata to be %s, got %s", string(expectedMetadataJSON), string(metadataJSON))
+				}
+			}
+			// Validate that deduplication_key exists and is not empty
+			if scenario.ShouldHaveDeduplicationKey {
+				if parsedBody.DeduplicationKey == "" {
+					t.Error("expected deduplication_key to be present and non-empty")
+				}
+			}
 		})
 	}
 }