friendlyName:'Receive from customer Fleet instance',
description:'Receive webhook requests from a customer\'s Fleet instance and sends a request to unenroll a specfied host from the customer\'s Workspace One instance.',
inputs:{
timestamp:{
type:'string',
required:true,
description:'An ISO 8601 timestamp representing when this request was sent.',
extendedDescription:'This value is not used by the webhook.',
description:'An dictionary containing information about a host that will be unenrolled from the customers Workspace ONE instance.'
},
webhookSecret:{
type:'string',
required:true,
description:'A shared secret used to confirm that this request came from a customer\'s Fleet instance.',
extendedDescription:'This webhook handler should always be requested over TLS. It is not safe to transmit shared secrets without transport-layer encryption.',
}
},
exits:{
unauthorized:{
responseType:'unauthorized',
description:'This webhook request could not be verified.',
thrownewError('No sails.config.custom.customerWorkspaceOneBaseUrl configured! Please set this value to be the base url of the customers Workspace One instance.');
thrownewError('No sails.config.custom.customerWorkspaceOneOauthId configured! Please set this value to be the client id of the Oauth token for requests to the customer\'s Workspace One instance.');
thrownewError('No sails.config.custom.customerWorkspaceOneOauthSecret configured! Please set this value to be the client id of the Oauth token for requests to the customer\'s Workspace One instance.');
thrownewError('No sails.config.custom.customerMigrationWebhookSecret configured! Please set this value to be the shared webhook secret for the host migration webhook.');
returnnewError(`When sending a request to get a Workspace ONE authorization token for the recieve-from-customer-fleet-instance webhook, an error occured. Full error: ${err.stack}`);
// The body in responses returned from the sendHttpRequest helper will always be a string, so we need to parse the raw JSON response body to get the access_token returned from the OAuth URL.
returnnewError(`When sending a request to unenroll a host from a Workspace One instance (Host information: Serial number: ${host.hardware_serial}, id: ${host.id}, uuid: ${host.uuid}), the specified host was not found on the customer's Workspace One instance. Full error: ${err.stack}`);
return{badRequest:`When sending a request to unenroll a host from a Workspace One instance (Host information: Serial number: ${host.hardware_serial}, id: ${host.id}, uuid: ${host.uuid}), the Workspace One instance could not unenroll the specified host. Full error: ${err.stack}`};
returnnewError(`When sending a request to unenroll a host from a Workspace One instance (Host information: Serial number: ${host.hardware_serial}, id: ${host.id}, uuid: ${host.uuid}), an error occured. Full error: ${err.stack}`);