/** * Send a single message * * @param $message * @param $lead_id */ private function sendMessage($message, $lead_id = null) { if (is_null($lead_id)) { $lead_id = Conversation::get('lead_id'); } $message = Parser::parseShortcodes($message, Storage::get($lead_id)); $message['metadata'] = 'SENT_BY_GIGA_AI'; $body = ['recipient' => ['id' => $lead_id], 'message' => $message]; Request::send(self::PLATFORM_ENDPOINT . "me/messages?access_token=" . self::$token, $body); }
/** * Parse [a] answers without save * * @param $answers * @return mixed */ public function parseWithoutSave($answers) { if (!$this->isParsable($answers)) { return false; } // Short hand method of attachments if ($this->isSingleAnswer($answers)) { return [Parser::parseAnswer($answers)]; } return $this->parseQuickReplies($answers); }