Action trigger for new published request

Is there an action trigger that I can use when a new request gets published?
And if so, how can I extract title, budget and other attributes from it to use in a webhook?

Hi,

You can use this hook hivepress/v1/models/request/update_status, please note that you can also find it here Home | HivePress Hook Reference, the hook is general, for models like listing, vendor, and others when changing status.

1 Like

Thanks, this works like a charm.

For anybody interested, I made a snippet now for every document so that it gets updated whenever it makes sense. Replace pago_autonomos with your field title. The other field titles under set value 0 you need to replace as well with all file field titles.

	//If listing upload send to Make
	add_action(
		'hivepress/v1/models/vendor/update_pago_autonomos',
	function($vendor_id,$value) {

			//Set all values 0
			$titulaciones_acreditaciones_url = "0";
			$vida_laboral_url = "0";
			$certificado_hacienda_url = "0";
			$pago_autonomos_url = "0";
			$cv_url ="0";
			$today = date("Ymd");
		
			//Set value of this Hook
			$vendor = \HivePress\Models\Vendor::query()->get_by_id($vendor_id);
			//$titulaciones_acreditaciones_id = $vendor->get_titulaciones_acreditaciones();
			//$vida_laboral_id = $vendor->get_vida_laboral();
			//$certificado_hacienda_id = $vendor->get_certificado_hacienda();
			$pago_autonomos_id = $vendor->get_pago_autonomos();
			//$cv_id = $vendor->get_cv();
			
			if(!$pago_autonomos_id){
				return;
			}
		
			//$titulaciones_acreditaciones = \HivePress\Models\Attachment::query()->get_by_id($titulaciones_acreditaciones_id);
			//$titulaciones_acreditaciones_url = $titulaciones_acreditaciones->get_url();
			
			//$vida_laboral = \HivePress\Models\Attachment::query()->get_by_id($vida_laboral_id);
			//$vida_laboral_url = $vida_laboral->get_url();
			
			//$certificado_hacienda = \HivePress\Models\Attachment::query()->get_by_id($certificado_hacienda_id);
			//$certificado_hacienda_url = $certificado_hacienda->get_url();

			$pago_autonomos = \HivePress\Models\Attachment::query()->get_by_id($pago_autonomos_id);
			$pago_autonomos_url = $pago_autonomos->get_url();

			//$cv = \HivePress\Models\Attachment::query()->get_by_id($cv_id);
			//$cv_url = $cv->get_url();			
			
			$user = $vendor->get_user();
	
			$data = array(
				'date' => $today,
				'vendor_id' => $vendor_id,
				'titulaciones_acreditaciones_url' => $titulaciones_acreditaciones_url,
				'vida_laboral_url' => $vida_laboral_url,
				'certificado_hacienda_url' => $certificado_hacienda_url,
				'pago_autonomos_url' => $pago_autonomos_url,
				'cv_url' => $cv_url,
				'titulaciones_url' => $titulaciones_url,				
				'vendor_email' => $user->get_email(),
				'vendor_name' =>$user->get_display_name(),
				'vendor_title' =>$vendor->get_title(),
			);

			wp_remote_post(
				'Replae with HOOKURL',
				['body' => $data],
			);
					
		
			
		
	},
	1000,
	2
);