umbraco / Umbraco.Deploy.Issues

1 stars 0 forks source link

Add an event to hook into when Transferring content or Media between Umbraco Cloud environments #226

Open RichG-Fe opened 4 months ago

RichG-Fe commented 4 months ago

When Content or Media item(s) are transferred using the 'Queue for transfer' feature, there is apparently no event that one can hook into once the operation completes on the target.

Use case:

We have an Umbraco headless build with a Gatsby front end (static site generation)

When content or media is published we use a webhook to refresh the frond end static site.

We would like to be able to have the following:

When a client transfers Content or Media from Staging to Live we want to fire a webhook so we can kick off the front end build using the Live environment.

AndyButland commented 4 months ago

Possibly you can use the webhooks Deploy registers with Umbraco here. You'll need to review the properties available in the payload to determine the type of operation that's been triggered and what items it included.

Or perhaps by handling the underlyingTaskCompletedNotification. It's not only fired for content transfers so again you'll likely need to inspect the properties available on this to determine

RichG-Fe commented 4 months ago

Thanks for your response Andy,

I was advised by 2 different Umbraco support team members that it wasn't possible at all and would need a change at Umbraco, are we saying this isn't the case?

We need to get some extra resource to look into this, but don't want to go over work already looked into by the support team.

Assume this isn't a usual use case for headless sites?

AndyButland commented 4 months ago

It's worth you checking out I would say. Just to check the functionality I've added a webhook to my source environment and executed a transfer or a queued item. My wehbook receives the following payload:

{
  "Id": "0eef38de-a570-404e-bdfb-af91fdd8418a",
  "WorkItemType": "SourceDeployWorkItem",
  "Environment": {
    "Name": "Local",
    "Uri": "about:blank"
  },
  "Result": "Completed",
  "Duration": "00:00:02.0573681",
  "Udis": [
    "umb://document/cd99be2a42b84dec94fe94a3d5d99d64"
  ]
}
RichG-Fe commented 4 months ago

Thanks Andy, yes that works thanks.

Will need to change our logic slightly, as we'd assumed we would be able kick off a webhook the 'receiving' environment rather than the one sending it.

Thanks again for your help.