diff --git a/index.js b/index.js index 4082ef3df9410a4c99a8c67d5f4534d146fb1da5..d72b943be8d8098bce2a3fb3fcc4a10f4f57cf45 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 ); }