diff --git a/cmd/events/trigger.go b/cmd/events/trigger.go index bcae150..d7fd461 100644 --- a/cmd/events/trigger.go +++ b/cmd/events/trigger.go @@ -47,7 +47,8 @@ func TriggerCommand() (command *cobra.Command) { command.Flags().StringVarP(&description, "description", "d", "", "Title the stream should be updated with.") command.Flags().StringVarP(&gameID, "game-id", "G", "", "Sets the game/category ID for applicable events.") command.Flags().StringVarP(&tier, "tier", "", "", "Sets the subscription tier. Valid values are 1000, 2000, and 3000.") - command.Flags().StringVarP(&eventID, "subscription-id", "u", "", "Manually set the subscription/event ID of the event itself.") // TODO: This description will need to change with https://github.com/twitchdev/twitch-cli/issues/184 + command.Flags().StringVarP(&eventID, "subscription-id", "u", "", "Manually set the subscription/event ID of the event itself.") + command.Flags().StringVarP(&eventMessageID, "event-id", "I", "", "Manually set the Twitch-Eventsub-Message-Id header value for the event.") command.Flags().StringVar(×tamp, "timestamp", "", "Sets the timestamp to be used in payloads and headers. Must be in RFC3339Nano format.") command.Flags().IntVar(&charityCurrentValue, "charity-current-value", 0, "Only used for \"charity-*\" events. Manually set the current dollar value for charity events.") command.Flags().IntVar(&charityTargetValue, "charity-target-value", 1500000, "Only used for \"charity-*\" events. Manually set the target dollar value for charity events.") @@ -94,6 +95,7 @@ func triggerCmdRun(cmd *cobra.Command, args []string) error { res, err := trigger.Fire(trigger.TriggerParameters{ Event: args[0], EventID: eventID, + EventMessageID: eventMessageID, Transport: transport, ForwardAddress: forwardAddress, FromUser: fromUser, diff --git a/cmd/events/variables.go b/cmd/events/variables.go index 13eebec..187a999 100644 --- a/cmd/events/variables.go +++ b/cmd/events/variables.go @@ -11,6 +11,7 @@ var ( toUser string giftUser string eventID string + eventMessageID string secret string eventStatus string subscriptionStatus string diff --git a/cmd/events/verify_subscription.go b/cmd/events/verify_subscription.go index 8e74dcd..f27b149 100644 --- a/cmd/events/verify_subscription.go +++ b/cmd/events/verify_subscription.go @@ -33,7 +33,8 @@ func VerifySubscriptionCommand() (command *cobra.Command) { command.Flags().StringVarP(&transport, "transport", "T", "webhook", fmt.Sprintf("Preferred transport method for event. Defaults to EventSub.\nSupported values: %s", events.ValidTransports())) command.Flags().StringVarP(&secret, "secret", "s", "", "Webhook secret. If defined, signs all forwarded events with the SHA256 HMAC and must be 10-100 characters in length.") command.Flags().StringVar(×tamp, "timestamp", "", "Sets the timestamp to be used in payloads and headers. Must be in RFC3339Nano format.") - command.Flags().StringVarP(&eventID, "subscription-id", "u", "", "Manually set the subscription/event ID of the event itself.") // TODO: This description will need to change with https://github.com/twitchdev/twitch-cli/issues/184 + command.Flags().StringVarP(&eventID, "subscription-id", "u", "", "Manually set the subscription/event ID of the event itself.") + command.Flags().StringVarP(&eventMessageID, "event-id", "I", "", "Manually set the Twitch-Eventsub-Message-Id header value for the event.") command.Flags().StringVarP(&version, "version", "v", "", "Chooses the EventSub version used for a specific event. Not required for most events.") command.Flags().BoolVarP(&noConfig, "no-config", "D", false, "Disables the use of the configuration, if it exists.") command.Flags().StringVarP(&toUser, "broadcaster", "b", "", "User ID of the broadcaster for the verification event.") @@ -91,6 +92,7 @@ https://dev.twitch.tv/docs/eventsub/handling-webhook-events#processing-an-event` Secret: secret, Timestamp: timestamp, EventID: eventID, + EventMessageID: eventMessageID, BroadcasterUserID: toUser, Version: version, }) diff --git a/internal/events/trigger/retrigger_event.go b/internal/events/trigger/retrigger_event.go index eabaf89..d6738b5 100644 --- a/internal/events/trigger/retrigger_event.go +++ b/internal/events/trigger/retrigger_event.go @@ -48,6 +48,7 @@ func RefireEvent(id string, p TriggerParameters) (string, error) { Secret: p.Secret, JSON: []byte(res.JSON), Event: topic, + EventMessageID: "", Type: EventSubMessageTypeNotification, SubscriptionVersion: e.SubscriptionVersion(), }) diff --git a/internal/events/verify/subscription_verify.go b/internal/events/verify/subscription_verify.go index 71ad27e..61933ea 100644 --- a/internal/events/verify/subscription_verify.go +++ b/internal/events/verify/subscription_verify.go @@ -53,8 +53,8 @@ func VerifyWebhookSubscription(p VerifyParameters) (VerifyResponse, error) { } } - if p.EventID == "" { - p.EventID = util.RandomGUID() + if p.EventMessageID == "" { + p.EventMessageID = util.RandomGUID() } if p.BroadcasterUserID == "" {