Socialhose is a social-listening and media-monitoring API for turning large streams of public mentions into usable campaign intelligence. It helps backend applications answer questions like:
- What are people saying about a campaign, brand, organization, product, policy, person, or event?
- Which platforms are driving the conversation?
- Is sentiment improving or deteriorating?
- Which mentions have the most reach or engagement?
- Which keywords, topics, or entities are trending?
- Who should receive alerts or mailing-list updates?
The SDK wraps the Socialhose REST API with typed JavaScript/TypeScript methods for campaign discovery, analytics dashboards, mention search, mailing lists, and SDK-composed entity analytics. It handles API-key auth, browser-compatible headers, retries, timeouts, GET caching, and normalized response shapes so product code can focus on the analysis instead of raw HTTP plumbing.
## What you can build with it
Use `@socialhose/api` from server-side JavaScript/TypeScript to build:
- Social-listening dashboards for campaigns, topics, brands, people, organizations, or locations.
- Monitoring tools that search public mentions across supported platforms.
API keys are issued by Socialhose. The SDK does not create keys, and there is no self-service key-generation flow documented in this package.
To use the SDK:
1. Request Socialhose Public API access from the Socialhose team or your account administrator.
2. Ask for an API key with access to the campaigns you need to query.
3. Store it as a server-side environment variable:
```bash
exportSOCIALHOSE_API_KEY="sh_your_key_here"
```
4. Pass it to the client:
```ts
constsocialhose=newSocialhoseClient({
apiKey: process.env.SOCIALHOSE_API_KEY!,
});
```
Do not commit API keys, expose them in frontend bundles, or send them to browsers. If you are building a web app, call Socialhose from your server/API route and return only the data your frontend needs.
Node 18+ is required because the SDK uses built-in `fetch`, `Response`, and `AbortSignal.timeout`. You can pass a custom `fetch` implementation if needed.
Campaigns are the API's top-level monitoring containers. Use them to discover what this API key can access, resolve IDs, and scope analytics or mention search.
-`getOverview()` — total mentions, authors, estimated reach, sentiment distribution, platform breakdown, engagement, and growth.
-`getTimeline()` — time-series mention volume with sentiment and engagement buckets.
-`getSentiment()` — aggregate and platform-specific sentiment splits.
-`getShareOfVoice()` — compares campaigns by mention share, engagement, and sentiment.
-`getPlatforms()` — mention and engagement totals grouped by platform.
-`getTopKeywords()` — most frequent keywords with sentiment split.
-`getTrending()` — keywords whose volume changed against the previous period.
-`getTopMentions()` — high-impact mentions with reach, engagement, author, URL, and content preview.
### Mention search
Mentions are the underlying public posts/articles/items Socialhose has collected and classified. Search them by campaign, date, platform, sentiment, content, page, and ordering.
Use this for feeds, search results, moderation queues, source inspection, custom reports, or downstream enrichment.
### Entity analytics
Entity helpers build analytics around one search term even when native analytics endpoints are campaign-scoped. They use `/mentions/` facets to produce compact profiles for people, organizations, brands, products, places, hashtags, or arbitrary terms.
The SDK sends `Authorization: Api-Key <key>` and a browser-like `User-Agent` by default. The user-agent is intentional: the current Socialhose API edge rejects some non-browser requests.
Preferred publish path is the release workflow, which runs with npm provenance from CI. Before publishing, verify npm authentication and `@socialhose` scope access:
For the actual release, publish from CI with provenance enabled. If you must publish locally, first confirm whether npm provenance is supported in that environment.