Source: https://eventregistry.org/documentation?tab=n8n_sentiment_dashboard

# Example 3: Sentiment Analysis Workflow

This workflow retrieves articles from Event Registry API, processes them with sentiment data, and appends results to a Google Sheet for sentiment analysis purposes.

## Workflow Steps

1. **Schedule Trigger** - Runs at regular intervals (hourly, daily, etc.)
2. **HTTP Request** - Fetches articles with sentiment data
3. **Split Out** - Separates articles into individual items
4. **Edit Fields** - Transforms article data for spreadsheet
5. **Google Sheets** - Appends data to spreadsheet

## Step-by-Step Node Configuration

**1. Schedule Trigger Node:**

1. Add a **Schedule Trigger** node from the trigger nodes
2. Configure the following:
3. **Trigger Times:** Select your preferred schedule (e.g., `Every Hour`, `Every Day`, or `Custom Cron`)
4. For `Custom Cron`: Enter cron expression (e.g., `0 * * * *` for hourly, `0 0 * * *` for daily)
5. Click "**Back to canvas**" in the upper left corner

**2. HTTP Request Node:**

1. Add an **HTTP Request** node after the Schedule Trigger
2. Configure the following settings:
3. **Method:** Select `POST` from the dropdown
4. **URL:** Enter `https://eventregistry.org/api/v1/article/getArticles`
5. **Authentication:** Select `Generic Credential Type`
6. **Credential Type:** Select `Custom Auth`
7. **Credential for Custom Auth:** Select your `Event Registry API` credential
8. **Send Body:** Check the box
9. **Body Content Type:** Select `JSON`
10. **Specify Body:** Specify body using JSON
11. **Body:** Enter the following request body JSON:

  ```

              {
    "action": "getArticles",
    "keyword": "your search term",
    "articlesPage": 1,
    "articlesCount": 50,
    "articlesSortBy": "date",
    "includeArticleBody": true,
    "includeArticleSentiment": true
  }
  ```
12. **Important:** Set `includeArticleSentiment: true` to retrieve sentiment scores for each article
13. Click "**Back to canvas**" in the upper left corner

**3. Split Out Node:**

1. Add a **Split Out** node after the HTTP Request node
2. Configure the following:
3. **Fields to Split Out:** Enter `articles.results`
4. **Include:** Select `No Other Fields` from the dropdown
5. This separates each article into its own item for processing
6. Click "**Back to canvas**" in the upper left corner

**4. Edit Fields Node:**

1. Add an **Edit Fields** node after the Split Out node
2. Click **Add Value** for each field you want to map to spreadsheet columns:
3. **Field Name:**`title`, **Value:**`{{ $json.title }}`
4. **Field Name:**`date`, **Value:**`{{ $json.date }}`
5. **Field Name:**`source`, **Value:**`{{ $json.source.title }}`
6. **Field Name:**`url`, **Value:**`{{ $json.url }}`
7. **Field Name:**`sentiment`, **Value:**`{{ $json.sentiment }}`
8. **Field Name:**`body`, **Value:**`{{ $json.body }}`
9. **Note:** Ensure field names match your Google Sheet column headers exactly
10. Click "**Back to canvas**" in the upper left corner

**5. Google Sheets Node:**

1. Add a **Google Sheets** node after the Edit Fields node
2. Configure your Google Sheets credentials first (if not already done):
3. Go to **Credentials → Add credential → Google**
4. Follow the OAuth flow to connect your Google account
5. Back in the Google Sheets node, configure:
6. **Operation:** Select `Append` from the dropdown
7. **Credential:** Select your Google Sheets credential
8. **Document:** Click **Select** and choose your Google Sheet from the list
9. **Sheet Name:** Select the specific sheet/tab from the dropdown
10. **Data Mode:** Select `Map Each Column Manually`
11. For each column in your sheet, click **Add Column**:
12. **Column:** Select the column name (e.g., `Title`, `Date`, `Source`)
13. **Value:** Enter the corresponding field from Edit Fields (e.g., `{{ $json.title }}`, `{{ $json.date }}`)
14. Repeat for all columns (Title, Date, Source, URL, Sentiment, Body)
15. Click "**Back to canvas**" in the upper left corner

## Customization Ideas

- **Adjust article count:** Modify `articlesCount` (max 50 per request)
- **Filter by keyword:** Change the `keyword` parameter
- **Filter by date:** Add `dateStart` and `dateEnd` parameters
- **Filter by source:** Add `sourceUri` parameter
- **Prevent duplicates:** Add logic to check for existing articles before appending (use article URL or ID as unique identifier)

## Additional Resources

- For Google Sheets node setup, see [Google Sheets Node documentation](https://docs.n8n.io/integrations/builtin/credentials/google/)
- For Schedule Trigger configuration, see [n8n Schedule Trigger documentation](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.schedule/)
