Using a community node (Mediastack) in your agent
Community Nodes allow you to extend your agent’s functionality with tools built by other developers. In this section, we’ll integrate the Mediastack Node, created by JunyaoC, to fetch live news.
Prerequisites
Before starting, ensure you have:
A Mediastack API Key: Register an account at Mediastack to obtain your key.
Familiarity with the Live News API: Refer to the Mediastack documentation for details on how the API works.
This guide is a continued guide from Using ChatGPT node in your agent. Make sure you have go through the guide.
Step-by-Step Guide
The final agent are setup as below:

Add the Mediastack Node
Locate the Mediastack Node in the Community Nodes section of the Node Library.
Drag the node into your workspace.
Configure the Mediastack Node
The Mediastack Node has several inputs for filtering news based on your requirements. For this example, we’ll filter for news from Malaysia.
API Key:
Paste your Mediastack API key into the
api_key
field of the node.
Country Filter:
Double-tap an empty space in the editor and type
str
.Select Basic/String from the options and drag it to your workspace.
Enter the value
my
(country code for Malaysia) into the String node.Connect this String node to the
countries
input of the Mediastack Node.
Other Inputs:
If needed, you can use additional String nodes to specify filters like
sources
,categories
,keywords
, orlanguages
.For now, we’ll only filter by country.
Why Do We Need a JSON Stringify Node?
The Mediastack Node returns raw JSON data, which may not be easily readable or usable for downstream nodes like ChatGPT.
JSON Stringify converts this raw JSON data into a formatted string, making it compatible with nodes like ChatGPT for natural language processing.
It also ensures that any additional information can be passed in a structured and clean format.
To add the JSON Stringify Node:
Drag it from the library under Basic/Format or use the double-click shortcut (explained below).
Connect the
result
output of the Mediastack Node to thevalue
input of the JSON Stringify Node.
Connect the Workflow
Execution Flow (Exec):
Connect the
exec
output of the Input Node to theexec
input of the Mediastack Node.Link the
exec
output of the Mediastack Node to the JSON Stringify Node, and then to the ChatGPT Node.Finally, connect the execution flow to the Output Node.
Message/Data Flow:
Link the
message
output of the Input Node to themessage
input of the Mediastack Node.Connect the
result
output of the Mediastack Node to thevalue
input of the JSON Stringify Node.Pass the output of the JSON Stringify Node to the
message
input of the ChatGPT Node.Finally, link the
response
output of the ChatGPT Node to the Output Node.
Test Your Agent
Use the Message Box to input a test message.
For example, type: “Fetch the latest news from Malaysia.”
Observe the results:
The Mediastack Node fetches live news from Malaysia.
JSON Stringify formats the data.
ChatGPT processes and summarizes the news, which is returned to the Message Box.
Summary
Mediastack Node: Fetches live news with flexible filters.
String Nodes: Quickly assign values for filtering (e.g., country:
my
for Malaysia).JSON Stringify Node: Converts raw data into a readable string format for ChatGPT.
Double-Click Shortcut: Saves time by skipping manual node selection from the library.
This guide empowers users to efficiently integrate a Community Node and optimize their workflow.
Last updated