curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
     curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     // Download the given URL, and return output
     $output = curl_exec($ch);
     // Close the cURL resource, and free system resources
     curl_close($ch);
 } else {
     if ($trigger_word == "setgoal") {
         $text = $_REQUEST['text'];
         $text_array = explode(" ", $text);
         $type = $text_array[1];
         $target_value = $text_array[2];
         $goal_period = $text_array[3];
         $params = array("slack_user_id" => $slack_user_id, "goal_type" => $type, "target" => $target_value, "period" => $goal_period);
         $response = $client->setGoal($params);
         $message = $response->person->messages->content;
         $data = "payload=" . json_encode(array("channel" => $channel, "text" => $message));
         $ch = curl_init("https://hooks.slack.com/services/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");
         curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
         curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
         // Download the given URL, and return output
         $output = curl_exec($ch);
         // Close the cURL resource, and free system resources
         curl_close($ch);
     } elseif ($trigger_word == "help") {
         $message = "We are here to help you! Here is what you can do: ";
         $attachment = array(['color' => '#5AAC56', 'fields' => array(array('title' => 'register', 'value' => 'Create an account before getting started', 'short' => false), array('title' => 'setgoal [goal_type] [target_value] [period]', 'value' => 'Set a fitness goal', 'short' => false), array('title' => 'run [distance] [time] [calories]', 'value' => 'Add a new run', 'short' => false), array('title' => 'goalstatus', 'value' => 'Check where you stand', 'short' => false))]);
         $data = json_encode(array("channel" => $channel, "text" => 'Hi *' . $user_name . '*. ' . $message, "attachments" => $attachment));
         $ch = curl_init("https://hooks.slack.com/services/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");