Is there any way to get in detail variable change using Subscription

Hi Team,
I have created Subscription to get email notification if any Library variable change, i need little more details like in mail What variable got changed , Scoped value and previous value and current value .

Please help me .

Hi @santoshuponi,

Thanks for getting in touch!

The information included in the Subscription notifications is standardised without any way to include more or less information.

One way to achieve what you’re aiming for would be to configure the Subscription to send out a webhook notification, and then have a second application use that notification as a trigger to run a query directly against the Octopus Server API. This query could then retrieve more detailed information about the variable change and send out an email with the parts you require.

I hope this helps get you started, please let me know if you have any further questions.

Best regards,

Hi Paul,

Thanks for quick support , My requirement is to get notification for any variable updates in Project level or in LibrarySet Variable.
I am expecting like mail in format below.
1.Who made changes.
2.Variable Name.
3.what was the previous value which was configured before and what is the new value.
4.what is scoped .

Can you please let me know how i can get solution to this scenario .

Santhosh Shet

Hi @santoshuponi,

As mentioned, the content of the email isn’t customisable, so the information you are receiving is the most that it will provide.
You have two options from here; the email can include a link back to the Octopus Server audit screen so you can quickly arrive at a screen that would provide details on the exact variable changes made, as explained here:

Emails may also include a link to your Octopus Audit screen, filtered to match the events delivered in the email. To add this link, you need to have set the publicly-accessible URL of your Octopus instance (see the Configuration ➜ Nodes ➜ Configuration Settings menu or the Server Configuration documentation for more details).

The second option is to make use of the webhook notification instead. This includes more detail including the the html that would display the changes made to the variable.

{"Timestamp":"2019-12-27T15:54:07.4930453+00:00","EventType":"SubscriptionPayload","Payload":{"ServerUri":null,"ServerAuditUri":null,"BatchProcessingDate":"2019-12-27T15:54:06.0047894+00:00","Subscription":{"Id":"Subscriptions-1","Name":"Test","Type":0,"IsDisabled":false,"EventNotificationSubscription":{"Filter":{"Users":[],"Projects":[],"ProjectGroups":[],"Environments":[],"EventGroups":[],"EventCategories":["Created","Modified"],"EventAgents":[],"Tenants":[],"Tags":[],"DocumentTypes":["variableset"]},"EmailTeams":["teams-everyone"],"EmailFrequencyPeriod":"00:01:00","EmailPriority":0,"EmailDigestLastProcessed":"2019-12-27T15:53:05.2998515+00:00","EmailDigestLastProcessedEventAutoId":359,"EmailShowDatesInTimeZoneId":"GMT Standard Time","WebhookURI":"","WebhookTeams":[],"WebhookTimeout":"00:00:10","WebhookHeaderKey":null,"WebhookHeaderValue":null,"WebhookLastProcessed":"2019-12-27T15:51:35.0646546+00:00","WebhookLastProcessedEventAutoId":358},"SpaceId":"Spaces-1","Links":{"Self":{}}},"Event":{"Id":"Events-501","RelatedDocumentIds":["variableset-LibraryVariableSets-1","LibraryVariableSets-1"],"Category":"Modified","UserId":"Users-1","Username":"PaulCalvert","IsService":false,"IdentityEstablishedWith":"Session cookie","UserAgent":"OctopusClient-js/2019.10.8","Occurred":"2019-12-27T15:53:44.2624942+00:00","Message":"Variables for Test were changed","MessageHtml":"Variables for <a href='#/library/variables/LibraryVariableSets-1'>Test</a> were changed","MessageReferences":[{"ReferencedDocumentId":"LibraryVariableSets-1","StartIndex":14,"Length":4}],"Comments":null,"Details":"<span>{<br>  \"Id\": \"variableset-LibraryVariableSets-1\",<br>  \"OwnerId\": \"LibraryVariableSets-1\",<br>  \"Version\": </span><del style=\"background:#ffe6e6;\">8</del><ins style=\"background:#e6ffe6;\">9</ins><span>,<br>  \"Variables\": [<br>    {<br>      \"Id\": \"046dd6a0-9eba-9ef6-9212-64b8fd70c079\",<br>      \"Name\": \"test\",<br>      \"Description\": null,<br>      \"Type\": \"String\",<br>      \"Value\": \"new2\"<br>    },<br>    {<br>      \"Id\": \"1bd9ec91-da61-daa2-61e6-3ca27b325400\",<br>      \"Name\": \"newtest\",<br>      \"Description\": null,<br>      \"Type\": \"String\",<br>      \"Value\": \"test1</span><ins style=\"background:#e6ffe6;\">2</ins><span>\"<br>    }<br>  ],<br>  \"SpaceId\": \"Spaces-1\",<br>  \"RelatedDocumentIds\": []<br>}</span>","SpaceId":"Spaces-1","Links":{"Self":{}}},"BatchId":"11e46e88-1738-431a-834d-79f82fba77fd","TotalEventsInBatch":1,"EventNumberInBatch":1}}

This includes the HTML to display the changes made:

The challenge of using the webhook is that you will need to create something outside of Octopus to handle the JSON payload and process it the way you want.

Best regards,

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.