Subscriptions: get package id and version from payload

(queil) #1

Hi support,

Subscribing to package pushed to built-in feed event (JSON at the bottom) - in order to retrieve package id and package version I have to parse textual data from the Payload.Event.Message field. IMO this should be available as a structured event-specific metadata. Moreover, Payload.Event should have a type discriminator so different event types can be easily modelled/dispatched in my webhook handler. There is the EventType field but it is always set to “SubscriptionPayload”.

Thanks,
queil

{
    "Timestamp": "2019-10-28T11:01:08.7559397+00:00",
    "EventType": "SubscriptionPayload",
    "Payload": {
        "ServerUri": "https://localhost:8443",
        "ServerAuditUri": "https://localhost:8443/#/configuration/audit?from=2019-10-28T11%3a00%3a08.%2b00%3a00&to=2019-10-28T11%3a00%3a39.%2b00%3a00",
        "BatchProcessingDate": "2019-10-28T11:00:39.1701336+00:00",
        "Subscription": {
            "Id": "Subscriptions-21",
            "Name": "My subscription",
            "Type": 0,
            "IsDisabled": false,
            "EventNotificationSubscription": {
                "Filter": {
                    "Users": [],
                    "Projects": [],
                    "ProjectGroups": [],
                    "Environments": [],
                    "EventGroups": [],
                    "EventCategories": [],
                    "EventAgents": [],
                    "Tenants": [],
                    "Tags": [],
                    "DocumentTypes": []
                },
                "EmailTeams": [],
                "EmailFrequencyPeriod": "01:00:00",
                "EmailPriority": 0,
                "EmailDigestLastProcessed": null,
                "EmailDigestLastProcessedEventAutoId": null,
                "EmailShowDatesInTimeZoneId": "GMT Standard Time",
                "WebhookURI": "http://localhost:5000/webhook",
                "WebhookTeams": [],
                "WebhookTimeout": "00:00:05",
                "WebhookHeaderKey": null,
                "WebhookHeaderValue": null,
                "WebhookLastProcessed": "2019-10-28T11:00:08.9949921+00:00",
                "WebhookLastProcessedEventAutoId": 20592
            },
            "SpaceId": "Spaces-1",
            "Links": {
                "Self": {}
            },
            "Event": {
                "Id": "Events-805",
                "RelatedDocumentIds": [
                    "feeds-builtin"
                ],
                "Category": "Created",
                "UserId": "Users-1",
                "Username": "admin",
                "IsService": false,
                "IdentityEstablishedWith": "Session cookie",
                "UserAgent": "OctopusClient-js/2019.8.6",
                "Occurred": "2019-10-28T11:00:17.4820962+00:00",
                "Message": "Package My.Package.Name version 1.0.23 was pushed to the Octopus Server (built-in) feed",
                "MessageHtml": "Package My.Package.Name version 1.0.23 was pushed to the <a href='#/library/feeds/feeds-builtin'>Octopus Server (built-in)</a> feed",
                "MessageReferences": [
                    {
                        "ReferencedDocumentId": "feeds-builtin",
                        "StartIndex": 65,
                        "Length": 25
                    }
                ],
                "Comments": null,
                "Details": null,
                "SpaceId": "Spaces-1",
                "Links": {
                    "Self": {}
                },
                "BatchId": "93864dff-a759-4190-8b66-9a421092f99e",
                "TotalEventsInBatch": 1,
                "EventNumberInBatch": 1
            }
        }
    }
}
(Ziaul Islam) #3

Hi Queil,

Thank you for the question.

I have raised this with the engineers at Octopus.

The way Octopus handles events, It would not as simple as it initially seems. The events aren’t structured like that, unfortunately.

What I would suggest is a UserVoice:

https://octopusdeploy.uservoice.com/

By doing this, Octopus will see if this is something they were willing to implement.

I’m sorry I could not bring better news.

If there’s anything else, I could assist you with.

Please feel free to reach out.

Kind regards,
Ziaul