From 43b6f5afd47ba2faeec0e74d9b8dc88163074422 Mon Sep 17 00:00:00 2001
From: Erick Hitter <services@ethitter.com>
Date: Fri, 13 Jan 2017 22:17:44 -0800
Subject: [PATCH] Change layout to indicate location and PWS

---
 index.js | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/index.js b/index.js
index 4082ef3..d72b943 100644
--- a/index.js
+++ b/index.js
@@ -54,6 +54,8 @@ app.post('/post', function(req, res){
     var weatherCondition = conditionData.current_observation.weather;
     var icon_url = conditionData.current_observation.icon_url;
     var location = conditionData.current_observation.display_location.full;
+    var obsLocation = conditionData.current_observation.observation_location.full;
+    var stationID = conditionData.current_observation.station_id;
 
     parsed_url = url.format({
       pathname: 'http://api.wunderground.com/api/' + apikey + '/forecast/q/' + req.body.text + format,
@@ -63,21 +65,20 @@ app.post('/post', function(req, res){
       // Basic response for the conditions data already obtained
       var responseBody = {
         "response_type": "in_channel",
-        "icon": icon_url,
-        "text": "Forecast",
+        "text": '**' + location + "**\n" + obsLocation + ' (' + stationID + ')',
         "attachments": [
           {
-            "text": "Location: " + location + "\n"
+            "text": "**Current conditions**\n"
                   + "Temperature: " + temperature + "\n"
                   + "Condition: " + weatherCondition,
-            "image_url": icon_url,
+            "image_url": icon_url
           }
         ]
       };
 
       // If forecast wasn't available, return just the conditions
       if ( error || 200 !== response.statusCode ) {
-        responseBody.attachments[1] = { "text":"Could not retrieve forecast" };
+        responseBody.attachments[1] = { "text": "Could not retrieve forecast" };
 
         return res.send( responseBody );
       }
-- 
GitLab