OmniSocialsOmniSocials
DocumentationAPI reference
Help centerSupport
  • Documentation
  • API reference
Developers
  • Quickstart
  • API reference
  • SDKs
  • MCP server
  • CLI
For AI agents
  • Docs for AI agents
  • llms.txt
  • OpenAPI spec
  • Postman collection
Product
  • OmniSocials
  • Pricing
  • Changelog
  • Help center
Company
  • Support
  • Privacy policy
  • Terms of service

© 2026 OmniSocials

OmniSocials on GitHubOmniSocials on XOmniSocials on LinkedIn
Overview
Get started
SDKs
    Node.jsPythonGoRubyJavaPHP.NETRust
CLI
MCPDocs for AI agentsWebhooks
Guides
Platforms
Integrations
Connect
Migrate
Plans and billing
GlossaryChangelogAPI reference
SDKs

Ruby SDK reference: install, auth and methods

The official Ruby SDK. Ruby 3.0+, zero runtime dependencies (Net::HTTP, OpenSSL, JSON), plain-Hash responses.

This page is the reference. For an overview of the Ruby SDK, see omnisocials.com/sdk/ruby.

Install

TerminalTerminal
gem install omnisocials

Or in your Gemfile:

Ruby
gem "omnisocials"

Authentication

Ruby
require "omnisocials" client = OmniSocials::Client.new(api_key: "omsk_live_...") # or: export OMNISOCIALS_API_KEY=omsk_live_... and just OmniSocials::Client.new

Create a post

Ruby
post = client.posts.create( content: "Big announcement coming Friday", channels: ["instagram", "facebook", "linkedin"], scheduled_at: "2026-08-01T09:00:00Z", media_urls: ["https://example.com/teaser.jpg"] )

Any media_urls (or media_ids) entry can also be a Hash carrying per-media alt text (max 1500 chars), delivered to Mastodon, Bluesky, X (photos), Pinterest, Instagram (images), and LinkedIn (images):

Ruby
media_urls: [{ "url" => "https://example.com/teaser.jpg", "alt" => "Red sneaker on a white background" }]

Publish immediately:

Ruby
post = client.posts.create_and_publish( content: "We are live!", channels: ["x", "bluesky"] )

Upload media

Ruby
media = client.media.upload_from_url( url: "https://example.com/promo.mp4", name: "promo-august", folder: "Campaigns" ) media_id = media["data"]["id"]

Local files: client.media.upload(file: "/path/to/image.jpg", name: "hero-shot") (file accepts a path String/Pathname, an IO, or a raw binary String). Base64: client.media.upload_from_base64(data: b64_string, mime_type: "image/png").

Analytics

Ruby
# One post stats = client.analytics.post("123") # Up to 100 posts in one request (avoids rate limit trouble when syncing) bulk = client.analytics.posts(["123", "124", "125"]) # Workspace overview overview = client.analytics.overview(period: "30d") # Account-level stats (followers etc.) accounts = client.analytics.accounts(platform: "instagram")

X statistics

X bills every statistics read, so these calls can use credits. See X statistics and credits for the prices and the rules. accounts:write and credits:read are opt-in: the Credits and X statistics switch when you create the key, and billing rights for the key's creator.

Ruby
# How often an X account is read: posts full / light / off, followers daily / weekly / off client.accounts.update("1234_x", x_statistics: { posts: "light" }) # "Update now": read one post's X numbers now fresh = client.analytics.refresh_post(9123) puts fresh["data"]["credits_used"] # The balance and the X statistics use credits = client.credits.get["data"] puts credits["balance"], credits["x_statistics"]["total_credits_month"]

Post tags

Tags are your own labels for posts (a hook style, a format), to filter posts and compare how each kind does. They never go to a platform. A tag is { "id", "name", "color", "created_at" }.

Ruby
client.tags.create(name: "Question", color: "teal") client.tags.list # On a post: ids or names, a new name becomes a tag. On update, tags: nil or [] removes all. client.posts.create(content: "Would you post this?", channels: ["instagram"], tags: ["Question"]) # Up to 500 posts at once: add, remove or set (replace) client.tags.apply(post_ids: ["1024", "1025"], add: ["Question"]) # Filter, and compare each tag with your normal client.posts.list(tag: "Question") compare = client.analytics.tags(start_date: "2026-08-01") compare["data"]["tags"].each do |row| puts "#{row["tag"]["name"]} #{row["vs_normal"]}" # 0.38 = 38% above your normal end

client.tags.update(tag_id, name: ..., color: ...) and client.tags.delete(tag_id) manage a tag; analytics.overview(tag: ...) narrows the post numbers to tagged posts.

Limits and feature requests

client.limits.list (GET /limits) lists what OmniSocials cannot do, why, and what to do instead. client.feature_requests.create sends a request to the OmniSocials team for the person who owns the key, so send it only after the person agrees; a platform rule answers 409 not_requestable and stores nothing. More in Limits and feature requests.

Ruby
limits = client.limits.list(platform: "tiktok") limits["data"].each do |limit| puts [limit["title"], limit["says"], limit["instead"], limit["requestable"]].inspect end # Only after the person agrees result = client.feature_requests.create( summary: "Post our daily update to the Announcements topic of our Telegram group.", platform: "telegram", limit_id: "telegram.forum_topics" ) puts result["outcome"], result["data"]["id"] # "created", "voted" (a vote on your organisation's open request) or "already_requested" mine = client.feature_requests.list # newest first, with status and team_replies

Social Inbox

Read and answer DMs, comments and mentions from your connected accounts. The API key needs the opt-in inbox:read / inbox:write scopes. The lists use cursor pagination (cursor: in, pagination["next_cursor"] out).

Ruby
conversations = client.inbox.list_conversations(platform: "instagram", unread: true) conversation_id = conversations["data"][0]["conversation_id"] messages = client.inbox.get_messages(conversation_id) client.inbox.reply(conversation_id, text: "Thanks for reaching out!") client.inbox.mark_read(conversation_id) # Comment moderation: hide (hide: false unhides) or delete client.inbox.hide(messages["data"][0]["id"]) client.inbox.delete_message(messages["data"][0]["id"])

inbox.next hands out the next conversation that still needs an answer, with the thread and the post it belongs to. On a comment thread, pass message_id: so the reply goes under the comment you answer and not under the newest comment on the post. On a Facebook comment, mention_author: true tags the commenter: the reply starts with their name as a clickable link, and the answer carries mention with the result (tagged, plain_name, failed or unverified).

Ruby
item = client.inbox.next while item["data"] message = item["data"]["message"] unless item["data"]["reply_window"]["open"] # An Instagram/Facebook DM past Meta's 24-hour window: answer it in the app client.inbox.mark_read(message["conversation_id"]) item = client.inbox.next next end reply = client.inbox.reply( message["conversation_id"], text: "Thanks! DM sent.", message_id: message["id"], include_next: true ) item = { "data" => reply["next"], "remaining" => reply["remaining"] || 0 } end

See the Social Inbox guide for the platforms, the reply rules and the error codes.

Pinterest product tags

Tag products on a Pin so people can shop the items in the image. List the product Pins of the connected Pinterest account, then pass up to 24 of their Pin ids as "product_tags" in the pinterest: options of the post. Only product Pins of your own account can be tagged; products of other merchants cannot.

Ruby
result = client.pinterest.list_products if result["error"] warn "#{result["error"]["code"]}: #{result["error"]["message"]}" else client.posts.create( content: "Our summer picks", channels: ["pinterest"], media_urls: ["https://example.com/summer-look.jpg"], scheduled_at: "2026-08-01T09:00:00Z", pinterest: { "board_id" => "1234567890", "product_tags" => result["products"].first(3).map { |product| product["pin_id"] } } ) end

The list answers with HTTP 200 in both cases: "products" on success, or an "error" hash (pinterest_not_connected, pinterest_catalog_access_required, platform_error) when it could not be read. It reads the Pinterest catalog when the connection has catalog access (given one time in the OmniSocials composer: Pinterest options, Add products, Connect catalog), else the account's own Pins. The tags are added right after the Pin is published. A product that Pinterest refuses never fails the post: the post then carries pinterest["product_tags_result"] with the tagged and the skipped Pin ids. client.pinterest.validate_product(id) checks one Pin id or Pin link before you post. On posts.update the pinterest: hash replaces the stored one, so leave "product_tags" out to remove the tags.

Approve or reject a post

Pass the step you reviewed: the current_step of the post's approval review. When the review is on another step now (somebody decided since you read it, or a retried call already went through), nothing is decided and the call fails with 409 step_changed; error.current_step_order in the error body is the step the review is on now. Without a step the call acts on whatever step is current. approve(post_id) and reject(post_id, comment: ...) still work.

Ruby
review = client.posts.get_approval(post_id)["data"] begin client.posts.approve(post_id, step_order: review["current_step"]) # or: client.posts.reject(post_id, comment: "Wrong CTA link", step_order: review["current_step"]) rescue OmniSocials::APIError => e raise unless e.code == "step_changed" # The review moved on; nothing was decided. Read the approval again. end

Verify webhooks

Rails controller:

Ruby
class OmnisocialsWebhooksController < ApplicationController skip_before_action :verify_authenticity_token def create payload = request.body.read # raw body, exactly as received signature = request.headers["X-OmniSocials-Signature"] begin event = OmniSocials::Webhooks.verify( payload: payload, signature: signature, secret: ENV.fetch("OMNISOCIALS_WEBHOOK_SECRET"), tolerance: 300 ) rescue OmniSocials::WebhookVerificationError return head :bad_request end if event["type"] == "post.published" event["data"]["targets"].each do |target| Rails.logger.info "#{target["platform"]} #{target["status"]} #{target["native_post_id"]}" end elsif event["type"] == "post.rejected" Rails.logger.info "Rejected: #{event["data"]["post_id"]} #{event["data"]["approval"]["reason"]}" end head :ok end end

Events: post.scheduled, post.published, post.failed, post.approved and post.rejected. The two approval events carry data.approval with status, decided_by (the approver's user id) and reason (nil on post.approved). To read the full review of a post (steps, approvers, the rejection reason and the comment thread), call client.posts.get_approval(post_id).

Rotate the secret without missing deliveries

For 24 hours after client.webhooks.rotate_secret(webhook_id), every delivery also carries X-OmniSocials-Signature-Previous, signed with the old secret (same format, same timestamp and body). Verify X-OmniSocials-Signature with the new secret and, when that fails, the Previous header with the old one:

Ruby
begin event = OmniSocials::Webhooks.verify(payload: payload, signature: headers["X-OmniSocials-Signature"], secret: new_secret) rescue OmniSocials::WebhookVerificationError previous = headers["X-OmniSocials-Signature-Previous"] raise if previous.nil? event = OmniSocials::Webhooks.verify(payload: payload, signature: previous, secret: old_secret) end

Errors

The base class is OmniSocials::Error. OmniSocials::APIError covers HTTP errors with subclasses AuthenticationError (401), PermissionDeniedError (403), NotFoundError (404), ValidationError (400/422), RateLimitError (429, with #retry_after), and ServerError (5xx), plus APIConnectionError and WebhookVerificationError. Each carries status, code, message, and body.

Ruby
begin client.posts.get("does-not-exist") rescue OmniSocials::NotFoundError => e puts "Gone: #{e.code} #{e.message}" rescue OmniSocials::RateLimitError => e puts "Slow down, retry in #{e.retry_after}s" rescue OmniSocials::ValidationError => e puts "Bad request: #{e.body}" rescue OmniSocials::AuthenticationError puts "Check your API key" rescue OmniSocials::APIConnectionError puts "Network problem" rescue OmniSocials::APIError => e puts "API error: #{e.status} #{e.message}" end

Configuration

Ruby
client = OmniSocials::Client.new( api_key: "omsk_live_...", timeout: 60, # seconds max_retries: 5, # retries after the first attempt base_url: "https://api.omnisocials.com/v1" # override for testing )

Notes

  • A fresh connection is used per request; there is nothing to close
  • All responses are plain Hashes with string keys
  • Omitting folder_id/parent_id leaves a value unchanged; passing nil explicitly moves to root/top level
  • Source: github.com/OmniSocials/omnisocials-ruby
Last modified on November 24, 2026
GoJava
On this page
  • Install
  • Authentication
  • Create a post
  • Upload media
  • Analytics
    • X statistics
  • Post tags
  • Limits and feature requests
  • Social Inbox
  • Pinterest product tags
  • Approve or reject a post
  • Verify webhooks
    • Rotate the secret without missing deliveries
  • Errors
  • Configuration
  • Notes
Ruby
Ruby
Ruby
Ruby
Ruby
Ruby
Ruby
Ruby
Ruby
Ruby
Ruby
Ruby
Ruby
Ruby
Ruby
Ruby
Ruby
Ruby