MP_Addon_CalculatorsCallRail_Webhook::add_calls( int $post_id, array $new_call )

Add call to calls metabox.


Parameters Parameters

$post_id

(int) (Required) callrail post ID

$new_call

(array) (Required) Call data.

  • ''start_time''
    (string)
  • ''customer_phone_number''
    (string)
  • ''formatted_call_type''
    (string)
  • ''recording''
    (string)
  • ''formatted_duration''
    (string)
  • ''conversational_transcript''
    (string)
  • ''agent_email''
    (string)
  • ''device_type''
    (string)
  • ''call_highlights''
    (string)
  • ''resource_id''
    (string)
  • ''id''
    (string)
  • ''note''
    (string)
  • ''formatted_tracking_source''
    (string)
  • ''source_name''
    (string)
  • ''tags''
    (string)
  • ''keywords''
    (string)
  • ''referring_url''
    (string)
  • ''landing_page_url''
    (string)
  • ''last_requested_url''
    (string)
  • ''referrer_domain''
    (string)
  • ''keywords_spotted''
    (string)
  • ''keypad_entries''
    (string)


Top ↑

Source Source

File: calculator-callrail-add-on/inc/MP_Addon_CalculatorsCallRail_Webhook.php

	protected function add_calls( $post_id, $new_call ) {

		$calls = get_post_meta( $post_id, MortgagePlatform::$prefix . 'callrail_calls', false );
		$id    = false;

		foreach ( $calls as $call ) {
			if ( $call['resource_id'] === $new_call['resource_id'] ) {
				update_post_meta( $post_id, MortgagePlatform::$prefix . 'callrail_calls', $new_call, $call );
				$id = true;
			}
		}
		if ( ! $id ) {
			add_post_meta( $post_id, MortgagePlatform::$prefix . 'callrail_calls', $new_call, false );
		}
	}

Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0 Introduced.