Send the HipChat notification message.

@param $to
@param mixed $message
@return \Psr\Http\Message\ResponseInterface
433587
protected function sendMessage($to, $message)
    {
        if ($message instanceof HipChatMessage) {
            return $this->hipChat->sendMessage($to, $message->toArray());
        }

        if ($message instanceof HipChatFile) {
            return $this->hipChat->shareFile($to, $message->toArray());
        }
    }
466359
public function sendPresenceSubscription($to)
    {
        $node = new ProtocolNode('presence', ['type' => 'subscribe', 'to' => $this->getJID($to)], null, '');
        $this->sendNode($node);
    }
648030
public function call($to, $message, array $params = [])
    {
        if (is_callable($message)) {
            $query = http_build_query([
                'Twiml' => $this->twiml($message),
            ]);

            $message = 'https://twimlets.com/echo?'.$query;
        }

        $params['url'] = $message;

        return $this->getTwilio()->calls->create(
            $to,
            $this->from,
            $params
        );
    }
457030
final public function send($message)
    {

        $response = $this->client()->{$this->config->getRequestMethod()}($this->config->getMessageUri(), array_merge(
                $this->config->getProviderConfig(), [
                    'command' => 'send',
                    'to' => $this->recipient,
                    'message' => $message,
                ])
        );

        return $this->getResponse($response);
    }
1013643
public function endpoint_sendmessage($to = NULL, $from = NULL, $body = NULL)
        {
            return $this->sendmessage($to, $from, $body);
        }
928325
public function sendMessage($message)
    {
        $message = sprintf("%s\r\n", $message);
        fwrite($this->getSocketStream(), $message, strlen($message));
        return $this->receiveMessage();
    }
238040
public function notify($to, $message)
    {
        $type = Arr::get($this->config, 'type', 'TextMessage');

        if (!in_array($type, $this->allowedTypeMessages)) {
            $type = 'TextMessage';
        }

        $params = ['type' => $type];

        if ($type === 'SoundMessage') {
            $params['body'] = in_array($message, $this->allowedSounds) ? $message : 'horn';
        } else {
            $params['body'] = $message;
        }

        return $this->send($this->buildUrlFromString("room/{$to}/speak.json"), $params);
    }
118641
public function fire($recipient, $message)
    {
        $headers = [
            'connect_timeout' => 30,
            'timeout' => 30,
            'verify' => false,
            'debug' => false,
            'Content-Type' => 'application/json',
            'Authorization' => 'Bearer '.$recipient->meta['token'],
        ];

        $body = [
            'color' => $message->isError() ? 'red' : 'green',
            'notify' => ($message->severity() === 'high' && $message->isError()) ? true : false,
            'from' => 'Eyewitness.io',
            'message_format' => 'html',
            'message' => '<b>'.config('app.name', 'Your Application').': '.$message->title().'</b><br/>'.$message->markupDescription(),
        ];

        try {
            app(Client::class)->post('https://api.hipchat.com/v2/room/'.$recipient->address.'/notification', [
                'body' => json_encode($body),
                'headers' => $headers
            ]);
        } catch (Exception $e) {
            app(Eye::class)->logger()->error('Unable to send Hipchat notification', $e);
        }
    }
1003694
protected function sendNotification($to, array $changedValues)
    {
        $message = \Swift_Message::newInstance()
            ->setSubject('User details updated')
            ->setFrom($this->getContainer()->getParameter('fos_user.resetting.email.from_email'))
            ->setTo($to)
            ->setBody(
                $this->getContainer()->get('twig')->render(
                    '@WebtownKunstmaanExtension/email/user_edit.html.twig',
                    ['changes' => $changedValues]
                ),
                'text/html'
            );
        $this->getContainer()->get('mailer')->send($message);
    }
1110554
public function send(Message $message)
    {
        $mailer = $this->getMailer();
        $mailer->SetFrom($this->getFrom($message));
        $mailer->AddReplyTo($this->getFrom($message));
        $mailer->Subject = $message->getTitle();
        $mailer->AltBody = strip_tags(preg_replace("/<br.*>/i", "\n", $message->getBody()));
        $mailer->MsgHTML($message->getBody());
        $mailer->AddAddress($this->getUserMail($message->getTo()));

        $result = false;
        try {
            if ($mailer->Send()) {
                $message->setStatus(\oat\tao\model\messaging\Message::STATUS_SENT);
                $result = true;
            }
            if ($mailer->IsError()) {
                $message->setStatus(\oat\tao\model\messaging\Message::STATUS_ERROR);
            }
        } catch (phpmailerException $pe) {
            \common_Logger::e($pe->getMessage());
        }
        $mailer->ClearReplyTos();
        $mailer->ClearAllRecipients();
        $mailer->SmtpClose();

        return $result;
    }
590850
public function send($notifiable, Notification $notification)
    {
        $message = $notification->toHipChat($notifiable);

        if (is_string($message)) {
            $message = new HipChatMessage($message);
        }

        if (! in_array(get_class($message), [HipChatMessage::class, HipChatFile::class])) {
            throw CouldNotSendNotification::invalidMessageObject($message);
        }

        $to = $message->room ?: $notifiable->routeNotificationFor('HipChat');
        if (! $to = $to ?: $this->hipChat->room()) {
            throw CouldNotSendNotification::missingTo();
        }

        try {
            $this->sendMessage($to, $message);
        } catch (ClientException $exception) {
            throw CouldNotSendNotification::hipChatRespondedWithAnError($exception);
        } catch (Exception $exception) {
            throw CouldNotSendNotification::internalError($exception);
        }
    }
1319880
public function call(Message $message) : Message
    {
        $aggregate = $message->getHeaders()->containsKey(CqrsMessagingModule::INTEGRATION_MESSAGING_CQRS_AGGREGATE_HEADER)
                            ? $message->getHeaders()->get(CqrsMessagingModule::INTEGRATION_MESSAGING_CQRS_AGGREGATE_HEADER)
                            : null;
        $methodInvoker = MethodInvoker::createWith(
            $aggregate ? $aggregate : $message->getHeaders()->get(CqrsMessagingModule::INTEGRATION_MESSAGING_CQRS_AGGREGATE_CLASS_NAME_HEADER),
            $message->getHeaders()->get(CqrsMessagingModule::INTEGRATION_MESSAGING_CQRS_AGGREGATE_METHOD_HEADER),
            $this->messageToParameterConverters
        );

        $resultMessage = MessageBuilder::fromMessage($message);
        try {
            $result = $methodInvoker->processMessage($message);

            if (!$aggregate) {
                $resultMessage = $resultMessage
                    ->setHeader(CqrsMessagingModule::INTEGRATION_MESSAGING_CQRS_AGGREGATE_HEADER, $result);
            }
        } catch (\Throwable $e) {
            throw MessageHandlingException::fromOtherException($e, $message);
        }

        if (!is_null($result)) {
            $resultMessage = $resultMessage
                ->setPayload($result);
        }

        return $resultMessage
                ->build();
    }
587090
public function send($message, $to, $from = null, $options = [])
    {
        $query = [
            'username' => $this->config->get('username'),
            'password' => $this->config->get('password'),
            'message'  => mb_convert_encoding($message, 'UTF-8'),
            'from'     => is_null($from) ? $this->config->get('sms_biuras.from', 'ecosms') : $from,
            'to'       => $to,
        ];

        if (isset($options['validityperiod'])) {
            $query['validityperiod'] = $this->convertToHoursMins((int)$options['validityperiod']);
        }

        if (isset($options['sendtime'])) {
            $query['sendtime'] = $this->convertToDaysHoursMinsSecs((int)$options['sendtime']);
        }

        if (isset($options['flash']) && (bool)$options['flash']) {
            $query['flash'] = '1';
        }

        // TODO: validate query values

        $result = $this->client->request('GET', 'send.php', [
            'query' => $query,
            'verify' => false
        ]);

        if ($result->getStatusCode() != 200) {
            throw new \Exception('Response code: ' . $result->getStatusCode());
        }

        $resultContent = explode(':', $result->getBody()->getContents());

        if (count($resultContent) !== 2) {
            throw new \Exception('Can\'t parse response');
        }



        if (preg_replace('/[\x00-\x1F\x7F-\xFF]/', '', $resultContent[0]) != 'OK') {
            throw new \Exception($resultContent[1]);
        }
        
        return $resultContent[1];
    }
794087
public function sendMessage($recipient, $message, $notificationType = NotificationType::REGULAR, $messagingType = MessagingType::RESPONSE)
    {
        $message = $this->createMessage($message);
        $options = RequestOptionsFactory::createForMessage($recipient, $message, $notificationType, $messagingType);
        $response = $this->client->send('POST', '/me/messages', null, [], [], $options);
        $responseData = $this->decodeResponse($response);

        return new MessageResponse($responseData['recipient_id'], $responseData['message_id']);
    }
179938
protected function sendMessage($to, $subject, $view, $params = [])
    {
        /** @var \yii\mail\BaseMailer $mailer */
        $mailer = Yii::$app->mailer;
        $mailer->viewPath = $this->viewPath;
        $mailer->getView()->theme = Yii::$app->view->theme;

        return $mailer->compose(['html' => $view, 'text' => 'text/' . $view], $params)
            ->setTo($to)
            ->setFrom([$mailer->transport->getUsername() => \Yii::$app->name ?? Url::to(['/'], true)])
            ->setSubject($subject)
            ->send();
    }
78779
public function notify($to, $message)
    {
        $params = [
            'token'   => $this->config['token'],
            'user'    => $to,
            'device'  => Arr::get($this->config, 'device', ''),
            'title'   => Arr::get($this->config, 'title', ''),
            'message' => $message,
        ];

        if (isset($this->config['sound'])) {
            $params['sound'] = in_array($this->config['sound'], $this->allowedSounds) ? $$this->config['sound'] : 'pushover';
        }

        return $this->send($this->buildUrlFromString('messages.json'), $params);
    }
343570
public function notify($to, $message)
    {
        $params = [
            'UN'      => Arr::get($this->config, 'username', ''),
            'PW'      => Arr::get($this->config, 'password', ''),
            'O'       => urlencode(Arr::get($this->config, 'sender', '')),
            'D'       => Arr::get($this->config, 'D', $to),
            'LONGSMS' => Arr::get($this->config, 'LONGSMS', ''),
            'M'       => $message,
        ];

        return $this->send($this->buildUrlFromString('http/get/SendSms.php'), array_filter($params));
    }