Hubspot_Helpers::remove_contact_from_list( mixed $list, mixed $email,  $action_data )

remove_contact_from_list


Parameters Parameters

$list

(Required)

$email

(Required)


Top ↑

Return Return

(void)


Source Source

File: src/integrations/hubspot/helpers/hubspot-helpers.php

	public function remove_contact_from_list( $list, $email, $action_data ) {

		if ( empty( $email ) ) {
			throw new \Exception( __( 'Email is missing', 'uncanny-automator' ) );
		}

		if ( empty( $list ) ) {
			throw new \Exception( __( 'List is missing', 'uncanny-automator' ) );
		}

		$params = array(
			'action' => 'remove_contact_from_list',
			'email'  => $email,
			'list'   => $list,
		);

		$response = $this->api_request( $params, $action_data );

		// If the email was not found in contacts
		if ( ! empty( $response['data']['discarded'] ) ) {
			throw new \Exception( __( 'Contact with such email address was not found in the list', 'uncanny-automator' ) );
		}

		return $response;
	}