/** * Send a simple text message. * * @param int $recipient This must be either: * <ul> * <li>an id that was retrieved through the Messenger entry points or through the Messenger callbacks</li> * <li>or instance of fritak\MessengerPlatform\UserRecipient</li> * </ul> * @param string $textMessage Text. * @param string $notificationType One of 3 types of notification, use constants (eg. NOTIFICATION_TYPE_REGULAR) * @return fritak\MessengerPlatform\Response * @see https://developers.facebook.com/docs/messenger-platform/send-api-reference#guidelines */ public function sendMessage($recipient, $textMessage, $notificationType = MessageSend::NOTIFICATION_TYPE_REGULAR) { $message = new MessageSend($recipient, $textMessage, $notificationType); return $this->gate->request(Gate::URL_MESSAGES, $message->getDataForCall()); }
/** * Send a complex message. * * @param fritak\MessengerPlatform\MessageSend|fritak\MessengerPlatform\StructuredMessage $message * @return fritak\MessengerPlatform\Response */ public function sendComplexMeesage($message) { return $this->gate->request(Gate::URL_MESSAGES, $message->getDataForCall()); }