SDKs overview
PeakMetrics offers Software Development Kits (SDKs) and libraries designed to facilitate programmatic interaction with its media intelligence platform. These tools abstract the underlying RESTful API, allowing developers to integrate PeakMetrics's AI-powered media monitoring, crisis monitoring, and PR measurement functionalities into custom applications, dashboards, and workflows. The SDKs typically handle authentication, request formatting, and response parsing, streamlining development efforts for tasks such as retrieving mentions, analyzing sentiment, and managing topics. PeakMetrics's API adheres to common web standards, supporting JSON for data exchange over HTTPS for secure communication, as detailed in the PeakMetrics API documentation.
Developers often leverage these SDKs to build custom integrations with existing internal systems, automate reporting, or create specialized user interfaces tailored to specific analytical needs. The availability of SDKs in multiple languages addresses diverse development environments and preferences, promoting broader adoption and utility of the PeakMetrics platform's core capabilities.
Official SDKs by language
PeakMetrics provides official SDKs to support direct integration with popular programming languages. These SDKs are maintained by PeakMetrics and offer comprehensive access to the platform's features, including data retrieval, search functionalities, and configuration management. The official offerings are designed to ensure compatibility and ease of use, reflecting the most current API versions and best practices for interacting with PeakMetrics services.
| Language | Package Name | Installation Command | Maturity |
|---|---|---|---|
| Python | peakmetrics-python |
pip install peakmetrics-python |
Stable |
| Node.js | @peakmetrics/node |
npm install @peakmetrics/node |
Stable |
These official SDKs are regularly updated to incorporate new features and improvements to the PeakMetrics API, ensuring developers have access to the latest tools for media intelligence integration. Comprehensive guides and API references for each SDK are available through the official PeakMetrics developer documentation.
Installation
Installing PeakMetrics SDKs typically involves using the package managers native to each programming language environment. The following instructions detail the common installation methods for the officially supported SDKs.
Python SDK
For Python projects, the peakmetrics-python package can be installed using pip, the standard package installer for Python. It is recommended to use a virtual environment to manage dependencies.
python -m venv venv
source venv/bin/activate # On Windows, use `venv\Scripts\activate`
pip install peakmetrics-python
After installation, the SDK can be imported into Python scripts to begin interacting with the PeakMetrics API. The Python Package Index (PyPI) hosts the PeakMetrics Python package, providing further details on versions and dependencies.
Node.js SDK
For Node.js applications, the @peakmetrics/node package is available via npm, the default package manager for Node.js. Install it within your project directory:
npm install @peakmetrics/node
Once installed, the SDK can be required or imported into your JavaScript/TypeScript files. The npm registry provides the PeakMetrics Node.js package with additional installation and usage information.
Quickstart example
This section provides basic quickstart examples for interacting with the PeakMetrics API using the official Python and Node.js SDKs. These examples demonstrate common tasks such as fetching recent media mentions.
Before running these examples, ensure you have an API key from your PeakMetrics account. Replace YOUR_API_KEY with your actual key.
Python Quickstart
To fetch recent mentions using the Python SDK:
from peakmetrics import PeakMetricsClient
# Initialize the client with your API key
client = PeakMetricsClient(api_key="YOUR_API_KEY")
try:
# Fetch recent mentions
# Parameters can be adjusted, e.g., limit, start_date, end_date
mentions = client.get_mentions(limit=5)
print("Recent Mentions:")
for mention in mentions:
print(f"- Title: {mention.get('title')}")
print(f" Source: {mention.get('source_name')}")
print(f" URL: {mention.get('url')}")
print("\n")
except Exception as e:
print(f"An error occurred: {e}")
This example initializes the PeakMetricsClient and calls the get_mentions method to retrieve a specified number of recent media mentions. The output includes the title, source, and URL for each mention.
Node.js Quickstart
To fetch recent mentions using the Node.js SDK:
const { PeakMetricsClient } = require('@peakmetrics/node');
async function getRecentMentions() {
// Initialize the client with your API key
const client = new PeakMetricsClient("YOUR_API_KEY");
try {
// Fetch recent mentions
// Parameters can be adjusted, e.g., limit, startDate, endDate
const mentions = await client.getMentions({ limit: 5 });
console.log("Recent Mentions:");
mentions.forEach(mention => {
console.log(`- Title: ${mention.title}`);
console.log(` Source: ${mention.source_name}`);
console.log(` URL: ${mention.url}`);
console.log("\n");
});
} catch (error) {
console.error(`An error occurred: ${error.message}`);
}
}
getRecentMentions();
This Node.js example uses an asynchronous function to initialize the client and retrieve recent mentions. Error handling is included to catch potential issues during the API call. More detailed examples and available methods are described in the PeakMetrics developer documentation.
Community libraries
Beyond the officially supported SDKs, the PeakMetrics community may contribute libraries, connectors, and tools that extend the platform's reach into various ecosystems. These community-driven projects can offer integrations with specific frameworks, additional language support, or specialized utilities that complement the core SDK functionalities.
While official SDKs are maintained by PeakMetrics, community libraries are developed and supported by individual developers or groups within the broader tech community. Their quality, maintenance, and adherence to the latest API specifications can vary. Developers interested in using community libraries are advised to review the project's documentation, community activity, and contribution guidelines.
Common types of community contributions might include:
- Third-party connectors: Integrations with popular data visualization tools, business intelligence platforms, or workflow automation services (e.g., Tray.io or Zapier-like platforms).
- Alternative language wrappers: SDKs for languages not officially supported, such as Go, Ruby, or PHP, developed by community members.
- Specialized utilities: Tools for specific data processing tasks, advanced analytics, or unique reporting formats built on top of the PeakMetrics API.
Developers are encouraged to explore community forums, GitHub repositories, and package registries (like PyPI or npm) for new and emerging community projects related to PeakMetrics. Engaging with the community can also provide opportunities to contribute to these projects or share custom solutions.