$message Message. * @param array $config Channel config. * @return true|\WP_Error */ public function send( array $message, array $config ) { $body = (string) wp_json_encode( array( 'event' => (string) $message['event'], 'title' => (string) $message['title'], 'intro' => (string) ( $message['intro'] ?? '' ), 'items' => array_values( (array) ( $message['items'] ?? array() ) ), 'more' => (int) ( $message['more'] ?? 0 ), 'url' => (string) $message['url'], 'site' => (string) $message['site'], 'sent_at' => gmdate( 'c' ), ) ); $headers = array( 'User-Agent' => 'ProfitEngine/' . PROFIT_ENGINE_VERSION, 'X-ProfitEngine-Event' => (string) $message['event'], ); // Lets the receiver verify the request really came from this store. if ( '' !== (string) $config['secret'] ) { $headers['X-ProfitEngine-Signature'] = 'sha256=' . hash_hmac( 'sha256', $body, (string) $config['secret'] ); } return $this->post_raw( (string) $config['url'], $body, $headers ); } }