title: Express/node Pipe specific JSON object/s into POST request
body: <p>I'm building a middleware service. When called, it provides a JSON object with certain information. I need to grab specific objects and pass that through to a new POST request. However, I'm struggling to grab it as it's outside of the scope and I think I'm just getting confused. Example below; </p>
  
  <pre><code>var createStory = {
      url: url,
      headers: {
          'Content-Type': 'application/json',
          'Token': Token
          },
      body: {
          current_state: req.body.data.item.user.name,
          name: 'API testing posts',
          description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam et dui a nisi molestie vestibulum non id ante. Sed aliquet neque augue, a vestibulum lectus euismod et. Maecenas porta justo quis maximus tempor. Sed ante libero, posuere vitae efficitur sit amet, feugiat at dolor.',
          story_type: 'bug',
          label_ids: [20949434]
          },
      json: true
      };
  </code></pre>
  
  <pre><code>app.post('/api/something', function (req, res) {
      if (req.body.data.item.conversation_parts.conversation_parts[0].body === 'match'){
          request.post(createStory, function (error, response, body) {
              console.log('error:', error);
              console.log('statusCode:', response &amp;&amp; response.statusCode);
              console.log('body:', body);
          });
          res.sendStatus(200);
      };
      res.sendStatus(200);
  });
  </code></pre>
  
  <p><code>current_state: req.body.data.item.user.name,</code> is what I'm trying to use here - I'm trying to pull the user name from the JSON object I receive and forward that into the <code>current state</code> key value pair. </p>
  
  <p>The <code>if</code> statement works as it's within the scope. </p>
  
  <p>I hope that makes sense?</p>