Skip to main content

Crate omnisocials

Crate omnisocials 

Source
Expand description

§OmniSocials Rust SDK

The official Rust client for the OmniSocials API: schedule and publish social media posts to Instagram, Facebook, LinkedIn, YouTube, TikTok, X, Pinterest, Bluesky, Threads, Mastodon, and Google Business from one API.

use omnisocials::{Client, CreatePostParams};

#[tokio::main]
async fn main() -> Result<(), omnisocials::Error> {
    let client = Client::from_env()?; // reads OMNISOCIALS_API_KEY

    let post = client
        .posts()
        .create(CreatePostParams {
            content: "Hello from the SDK".into(),
            channels: Some(vec!["instagram".into(), "linkedin".into()]),
            scheduled_at: Some("2026-08-01T09:00:00Z".into()),
            ..Default::default()
        })
        .await?;

    println!("created {}", post["data"]["id"]);
    Ok(())
}

All methods return the parsed response body as a serde_json::Value, as-is (single items as {"data": {...}}, lists as {"data": [...], "pagination": {...}}); 204 No Content returns serde_json::Value::Null. Retries on 429 / 5xx / connection errors are automatic, with exponential backoff and Retry-After support.

Webhook deliveries are verified with webhooks::verify_signature.

Modules§

resources
Resource accessors, one per API endpoint group. Obtain them from crate::Client: client.posts(), client.media(), and so on.
webhooks
Webhook signature verification (Stripe-style scheme).

Structs§

AccountAnalyticsParams
Query for GET /analytics/accounts.
AdBudget
A campaign budget, in MAJOR currency units (10 = 10 EUR). Network minimums apply (for example TikTok 20 a day).
AdDraftAd
One ad of a draft: written once, mapped onto every network.
AdDraftParams
Body for POST /ads/drafts and PUT /ads/drafts/:group_id (the full draft; see crate::resources::AdDrafts::create).
AdDraftSchedule
How long a draft runs.
AdDraftTargeting
Who a draft reaches.
AdMediaFile
One picture or video of a draft ad.
AdPlacementMedia
Extra files for one kind of placement.
AdSchedule
When a campaign runs (ISO 8601 datetimes).
AnalyticsOverviewParams
Query for GET /analytics/overview.
ApplyTagsParams
Body for POST /tags/apply: change the tags of up to 500 posts at once, published ones included.
ApprovePostParams
Body for POST /posts/:id/approve (see crate::resources::Posts::approve_with).
AttachAdDraftAccountParams
Body for POST /ads/drafts/:group_id/account (see crate::resources::AdDrafts::attach_account).
BestTimesParams
Query for GET /analytics/best-times.
BoostPostMultiParams
Body for POST /ads/boost-multi (see crate::resources::Ads::boost_multi): one draft boost per ad account, each with the SAME budget.
BoostPostParams
Body for POST /ads/boost (see crate::resources::Ads::boost).
CheckMediaParams
Body for POST /media/check. Provide one of: a public url, an existing media_id, or size_bytes + mime.
Client
Async client for the OmniSocials API.
ClientBuilder
Builder for Client. Created via Client::builder.
CreateAutomationParams
Body for POST /automations (see crate::resources::Automations::create).
CreateFeatureRequestParams
Body for POST /feature-requests.
CreateFolderParams
Body for POST /folders.
CreateHashtagSetParams
Body for POST /hashtag-sets.
CreatePostParams
Body for POST /posts/create and POST /posts/create-and-publish.
CreateTagParams
Body for POST /tags.
CreateWebhookParams
Body for POST /webhooks.
GetMessagesParams
Query for GET /inbox/conversations/:id/messages.
KeywordMetricsParams
Body for POST /ads/research/keywords/metrics (see crate::resources::Ads::keyword_metrics).
KeywordResearchParams
Body for POST /ads/research/keywords (see crate::resources::Ads::research_keywords). Give keywords, url or both.
LaunchAdDraftParams
Body for POST /ads/drafts/:group_id/launch (see crate::resources::AdDrafts::launch). Give confirm_budget_amount (one daily amount for every network) or confirm_budget_amounts (per campaign id). Each must equal that campaign’s daily amount, else 400 budget_confirmation_required and nothing is written. Needs a key with ads:spend: without it the call answers 403 start_in_app with the draft’s page. A network in api_draft_only (Google) is skipped with code start_in_app.
ListAdCampaignsParams
Query for GET /ads/campaigns (see crate::resources::Ads::list). Every field is optional.
ListAutomationEventsParams
Query for GET /automations/:id/events (see crate::resources::Automations::list_events). Every field is optional.
ListAutomationsParams
Query for GET /automations (see crate::resources::Automations::list). Every field is optional.
ListConversationsParams
Query for GET /inbox/conversations.
ListLimitsParams
Query for GET /limits.
ListMediaParams
Query for GET /media.
ListPinterestProductsParams
Query for GET /pinterest/products (see crate::resources::Pinterest::list_products). Every field is optional.
ListPostsParams
Query for GET /posts.
NextUnansweredParams
Query for GET /inbox/next. All fields are optional.
RecentPlatformPostsParams
Query for GET /posts/recent-platform.
RejectPostParams
Body for POST /posts/:id/reject (see crate::resources::Posts::reject_with).
ReplyParams
Body for POST /inbox/conversations/:id/reply.
SearchLocationsParams
Query for GET /locations/search (see crate::resources::Locations::search_with).
TagAnalyticsParams
Query for GET /analytics/tags.
UpdateAccountParams
Body for PATCH /accounts/{id}.
UpdateAdCampaignParams
Body for PATCH /ads/campaigns/:id (see crate::resources::Ads::update). Every field is optional. A draft changes with ads:write. A campaign that reached the network changes only with a key that has ads:spend (never on Google); without it the call answers 403 start_in_app.
UpdateAutomationParams
Body for PATCH /automations/:id (see crate::resources::Automations::update). Every field is optional; a body with nothing is a 400 no_fields.
UpdateFolderParams
Body for PATCH /folders/:id.
UpdateHashtagSetParams
Body for PATCH /hashtag-sets/:id.
UpdateMediaParams
Body for PATCH /media/:id.
UpdatePostParams
Body for PATCH /posts/:id.
UpdateTagParams
Body for PATCH /tags/:id. A field left None keeps its value.
UpdateWebhookParams
Body for PATCH /webhooks/:id.
UploadMediaFromBase64Params
Body for POST /media/upload-from-base64.
UploadMediaFromUrlParams
Body for POST /media/upload-from-url.
UploadMediaParams
Multipart body for POST /media/upload (max 50MB for images, 100MB request cap overall; use upload_from_url or create_upload_url for larger videos, up to 1GB).
UserTag
An Instagram user tag positioned on an image.
XStatisticsInput
The X statistics change. Set one field or more; a None field is left out and keeps its value.
XStatisticsPostSchedule
A custom check schedule (OmniSocials Connect keys, with posts: "custom").

Enums§

AdDraftPlatform
One network of AdDraftParams::platforms: a network key, or a key with its own daily amount or ad account.
Content
Post caption: either a single string used everywhere, or a per-platform map with a default key (e.g. {"default": "...", "x": "..."}).
Error
All errors returned by this crate.
Hashtags
The tags of a hashtag set: a list of tags, or one string of tags.
MediaEntry
One media entry, optionally carrying alt text (accessibility description, max 1500 chars). Alt text is delivered to Mastodon (media description), Bluesky (embed alt), X (photo/GIF media metadata), Pinterest (pin alt_text fallback), Instagram (images), and LinkedIn (images). Plain and alt-carrying entries can be mixed in the same list.
MediaRefs
Media attachments: either a list shared by all platforms, or a per-platform map (e.g. {"instagram": ["id1"], "x": ["id2"]}). The *Entries variants accept MediaEntry values for per-media alt text.
TagRef
One tag in a list of tags: a tag id, or a tag name. A name matches case-insensitively; a new name in tags on a post, or in add / set of ApplyTagsParams, becomes a tag of the workspace.

Constants§

VERSION
Crate version, used in the User-Agent header.
X_STATISTICS_WEBHOOK_EVENTS
The X statistics webhook events: x_statistics.paused (the organisation’s X statistics stopped at 0 credits) and x_statistics.resumed (they started again after a top-up). One delivery per workspace with X; data is { workspace_id, account_id, reason } with reason insufficient_credits or credits_added.