$message Message. * @param array $config Channel config. * @return true|\WP_Error */ public function send( array $message, array $config ) { $body = array( array( 'type' => 'TextBlock', 'text' => (string) $message['title'], 'weight' => 'Bolder', 'size' => 'Medium', 'wrap' => true, ), ); if ( '' !== (string) ( $message['intro'] ?? '' ) ) { $body[] = array( 'type' => 'TextBlock', 'text' => (string) $message['intro'], 'wrap' => true, ); } $lines = $this->item_lines( $message ); if ( $lines ) { $body[] = array( 'type' => 'TextBlock', 'text' => '- ' . implode( "\r- ", $lines ), 'wrap' => true, ); } $body[] = array( 'type' => 'TextBlock', 'text' => (string) $message['site'], 'isSubtle' => true, 'size' => 'Small', ); return $this->post_json( (string) $config['webhook_url'], array( 'type' => 'message', 'attachments' => array( array( 'contentType' => 'application/vnd.microsoft.card.adaptive', 'content' => array( '$schema' => 'http://adaptivecards.io/schemas/adaptive-card.json', 'type' => 'AdaptiveCard', 'version' => '1.4', 'body' => $body, 'actions' => array( array( 'type' => 'Action.OpenUrl', 'title' => (string) $message['link_label'], 'url' => esc_url_raw( (string) $message['url'] ), ), ), ), ), ), ) ); } }