# Jump Into Our API Testing Adventure – $250 Prize + Swag for first 15 submissions

**URL:** <https://community.postman.com/t/jump-into-our-api-testing-adventure-250-prize-swag-for-first-15-submissions/81457>\
**Category:** Help Hub\
**Tags:** testing, challenge, postman-community\
**Created:** [June 24, 2025, 12:46pm UTC](https://community.postman.com/t/jump-into-our-api-testing-adventure-250-prize-swag-for-first-15-submissions/81457 "2025-06-24T12:46:22Z")\
**Posts on this page:** 1\
**Showing post:** 34

<div class="post-metadata">

**Author:** ![abdulkabirsultan](https://avatars.discourse-cdn.com/v4/letter/a/b782af/32.png) [@abdulkabirsultan](https://community.postman.com/u/abdulkabirsultan)\
**Post date:** [June 28, 2025, 6:18am UTC](https://community.postman.com/t/jump-into-our-api-testing-adventure-250-prize-swag-for-first-15-submissions/81457/34 "2025-06-28T06:18:19Z")

</div>

I wanted to explore how far I could go using **external npm packages** and ended up creating a little article/text analyzer that does:

- 🌍 Language detection
- 🧠 Sentiment analysis
- 📝 Article summarization
- 📊 Visual display using the Postman visualizer

* * *

### 🔧 What I Used

Here are the packages I pulled in and how I used each:

#### 1. [`franc`](https://www.npmjs.com/package/franc) – Language Detection

Used to detect the language of the article content.

```js
const francFunc = pm.require('npm:franc@6.2.0');
const lang = francFunc.franc(body);

```

#### 2. [`sentiment`](https://www.npmjs.com/package/sentiment) – Sentiment Analysis

Analyzes the article text and gives a sentiment score (positive, neutral, negative).

```js
const Sentiment = pm.require('npm:sentiment@5.0.2');
const sentiment = new Sentiment();
const sentimentResult = sentiment.analyze(body);

```

#### 3. [`node-summary`](https://www.npmjs.com/package/node-summary) – Summarization

Generates a short summary from the article title + body.

```js
const summary = pm.require('npm:node-summary@1.2.0');
summary.summarize(title, body, callback);

```

### 🧑‍💻 Full code

```js
const Sentiment = pm.require('npm:sentiment@5.0.2');
const francFunc = pm.require('npm:franc@6.2.0');
const summary = pm.require('npm:node-summary@1.2.0');

const sentiment = new Sentiment();

// Extract article data
const body = pm.response.json().data.content || '';
const title = pm.response.json()?.data.title || "Untitled Article";

console.log(`🔍 Analyzing: "${title}"`);
console.log(`📊 Content length: ${body.length} characters`);

// --- Language Detection ---
const lang = francFunc.franc(body);
const langName = getLangName(lang);
pm.environment.set("article_lang", lang);
console.log(`🌐 Language detected: ${langName} (${lang})`);

// --- Sentiment Analysis ---
const sentimentResult = sentiment.analyze(body);
const sentimentEmoji = getSentimentEmoji(sentimentResult.score);
pm.environment.set("article_sentiment", sentimentResult.score);
console.log(`${sentimentEmoji} Sentiment score: ${sentimentResult.score}`);

// --- Summarization ---
summary.summarize(title, body, (err, sum) => {
    if (err) {
        console.error("❌ Summarization failed:", err.message);
        sum = "⚠️ Unable to generate summary - content might be too short or complex.";
    } else {
        console.log(`✅ Summary generated (${sum.length} chars)`);
    }
    
    pm.environment.set("article_summary", sum);
    
    // --- Visualizer ---
    pm.visualizer.set(`
    <html>
      <head>
        <style>
          * { margin: 0; padding: 0; box-sizing: border-box; }
          
          body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            min-height: 100vh;
            padding: 20px;
          }
          
          .container {
            max-width: 800px;
            margin: 0 auto;
            background: rgba(255, 255, 255, 0.95);
            border-radius: 20px;
            overflow: hidden;
            box-shadow: 0 20px 40px rgba(0,0,0,0.1);
            backdrop-filter: blur(10px);
          }
          
          .header {
            background: linear-gradient(45deg, #4facfe 0%, #00f2fe 100%);
            color: white;
            padding: 30px;
            text-align: center;
          }
          
          .header h1 {
            font-size: 28px;
            margin-bottom: 10px;
            text-shadow: 0 2px 4px rgba(0,0,0,0.2);
          }
          
          .content {
            padding: 30px;
          }
          
          .metric {
            margin-bottom: 25px;
            padding: 20px;
            border-radius: 15px;
            background: white;
            border-left: 4px solid;
            box-shadow: 0 4px 15px rgba(0,0,0,0.05);
            transition: transform 0.2s ease;
          }
          
          .metric:hover {
            transform: translateY(-2px);
          }
          
          .metric.summary { border-color: #3498db; }
          .metric.language { border-color: #9b59b6; }
          .metric.sentiment { border-color: {{sentimentColor}}; }
          
          .metric-header {
            display: flex;
            align-items: center;
            margin-bottom: 12px;
          }
          
          .metric-icon {
            font-size: 24px;
            margin-right: 12px;
          }
          
          .metric-title {
            font-size: 18px;
            font-weight: 600;
            color: #2c3e50;
          }
          
          .metric-value {
            font-size: 16px;
            line-height: 1.6;
            color: #34495e;
          }
          
          .score {
            font-size: 24px;
            font-weight: bold;
            color: {{sentimentColor}};
          }
          
          .badge {
            display: inline-block;
            background: {{sentimentBg}};
            color: {{sentimentColor}};
            padding: 6px 12px;
            border-radius: 20px;
            font-size: 14px;
            font-weight: 500;
            margin-left: 10px;
          }
          
        </style>
      </head>
      <body>
        <div class="container">
          <div class="header">
            <h1>📰 Your Article Analysis</h1>
          </div>
          
          <div class="content">
            <div class="metric summary">
              <div class="metric-header">
                <span class="metric-icon">📝</span>
                <span class="metric-title">Summary</span>
              </div>
              <div class="metric-value">{{summary}}</div>
            </div>
            
            <div class="metric language">
              <div class="metric-header">
                <span class="metric-icon">🌐</span>
                <span class="metric-title">Language</span>
              </div>
              <div class="metric-value">
                <strong>{{langName}}</strong> ({{lang}})
              </div>
            </div>
            
            <div class="metric sentiment">
              <div class="metric-header">
                <span class="metric-icon">{{sentimentEmoji}}</span>
                <span class="metric-title">Sentiment Analysis</span>
              </div>
              <div class="metric-value">
                <span class="score">{{sentiment}}</span>
                <span class="badge">{{sentimentLabel}}</span>
              </div>
            </div>
          </div>
        </div>
      </body>
    </html>
    `, {
        summary: sum,
        lang: lang,
        langName: langName,
        sentiment: sentimentResult.score,
        sentimentEmoji: sentimentEmoji,
        sentimentLabel: getSentimentLabel(sentimentResult.score),
        sentimentColor: getSentimentColor(sentimentResult.score),
        sentimentBg: getSentimentBg(sentimentResult.score)
    });
});

// --- Functions ---
function getLangName(code) {
    const languages = {
        'eng': 'English', 'spa': 'Spanish', 'fra': 'French', 'deu': 'German',
        'ita': 'Italian', 'por': 'Portuguese', 'rus': 'Russian', 'jpn': 'Japanese',
        'kor': 'Korean', 'cmn': 'Chinese', 'ara': 'Arabic', 'hin': 'Hindi'
    };
    return languages[code] || 'Unknown';
}

function getSentimentEmoji(score) {
    if (score > 2) return '😍';
    if (score > 0) return '😊';
    if (score === 0) return '😐';
    if (score > -2) return '😕';
    return '😤';
}

function getSentimentLabel(score) {
    if (score > 2) return 'Very Positive';
    if (score > 0) return 'Positive';
    if (score === 0) return 'Neutral';
    if (score > -2) return 'Negative';
    return 'Very Negative';
}

function getSentimentColor(score) {
    if (score > 0) return '#27ae60';
    if (score === 0) return '#f39c12';
    return '#e74c3c';
}

function getSentimentBg(score) {
    if (score > 0) return '#d5f4e6';
    if (score === 0) return '#fef9e7';
    return '#fadbd8';
}

pm.test("🎯 Article has substantial content", function () {
    pm.expect(body.length).to.be.above(100);
    console.log(`✅ Content check passed: ${body.length} characters`);
});

pm.test("📖 Summary generation successful", function () {
    const summary = pm.environment.get("article_summary");
    pm.expect(summary).to.be.a("string");
    pm.expect(summary.length).to.be.above(10);
    console.log("✅ Summary check passed");
});

pm.test("🌍 Language detection completed", function () {
    const detectedLang = pm.environment.get("article_lang");
    pm.expect(detectedLang).to.be.a("string");
    pm.expect(detectedLang.length).to.equal(3);
    console.log(`✅ Language detection passed: ${detectedLang}`);
});

pm.test("🧠 Sentiment analysis completed", function () {
    const sentiment = pm.environment.get("article_sentiment");
    pm.expect(sentiment).to.be.a("number");
    console.log(`✅ Sentiment analysis passed: ${sentiment}`);
});

console.log("🎉 Analysis complete! Check the visualizer for beautiful results.");

```

* * *

### 💡 How It Works

- The request sends an article (title + content) in JSON

- The test script runs all 3 analyses using the packages above

- A **custom HTML visualizer** shows:

* * *

### 📸 Screenshots

 ![Screenshot](https://us1.discourse-cdn.com/getpostman/original/3X/b/4/b46c25d542bc993f63e907f9d753e5454dfc853e.png)  
 ![Tests](https://us1.discourse-cdn.com/getpostman/original/3X/5/b/5b827741e7945df2e0da06d3bb8dfa4d75ef5878.png)  
 ![Visual UI](https://us1.discourse-cdn.com/getpostman/original/3X/e/5/e5330a0d6a60b2d3d310800c688dc7247a14018d.png)

---

_[View the full topic](https://community.postman.com/t/jump-into-our-api-testing-adventure-250-prize-swag-for-first-15-submissions/81457)._
