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

Go SDK reference: install, auth and methods

The official Go SDK. Standard library only, Go 1.21+, context-first API with typed errors and generics for response envelopes.

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

Install

TerminalTerminal
go get github.com/OmniSocials/omnisocials-go

Authentication

Go
client, err := omnisocials.NewClient(omnisocials.WithAPIKey("omsk_live_..."))

Reads OMNISOCIALS_API_KEY if no option is passed. A missing key returns *omnisocials.AuthenticationError.

Create a post

Go
res, err := client.Posts.Create(ctx, &omnisocials.PostCreateParams{ Content: "New drop this Friday", Channels: []string{"instagram", "facebook", "linkedin"}, ScheduledAt: "2026-08-01T09:00:00Z", MediaURLs: []string{"https://example.com/teaser.jpg"}, }) fmt.Println(res.Data.ID, res.Data.Status)

MediaURLs / MediaIDs entries can also carry per-media alt text (max 1500 chars) via MediaURLEntry / MediaIDEntry, delivered to Mastodon, Bluesky, X (photos), Pinterest, Instagram (images), and LinkedIn (images):

Go
MediaURLs: []omnisocials.MediaURLEntry{ {URL: "https://example.com/teaser.jpg", Alt: "Red sneaker on a white background"}, },

Publish immediately:

Go
res, err := client.Posts.CreateAndPublish(ctx, &omnisocials.PostCreateParams{ Content: "Going live right now", Channels: []string{"x", "bluesky"}, })

Upload media

Go
upload, err := client.Media.UploadFromURL(ctx, &omnisocials.MediaUploadFromURLParams{ URL: "https://example.com/launch-video.mp4", Name: "launch-video-v2", Folder: "Campaigns", }) fmt.Println(upload.Data.ID, upload.Compatibility)

Local files via multipart (any io.Reader):

Go
file, err := os.Open("./photos/product.jpg") if err != nil { log.Fatal(err) } defer file.Close() res, err := client.Media.Upload(ctx, &omnisocials.MediaUploadParams{ File: file, Filename: "product.jpg", Name: "product-hero", })

Analytics

Go
// One post's latest per-platform metrics stats, err := client.Analytics.Post(ctx, "post_id") fmt.Println(stats.Data.Platforms["instagram"].Metrics) // Batch: up to 100 posts in one call batch, err := client.Analytics.Posts(ctx, []string{"id1", "id2", "id3"}) // Workspace-wide overview overview, err := client.Analytics.Overview(ctx, &omnisocials.AnalyticsOverviewParams{Period: "30d"}) fmt.Println(overview.Data.TotalImpressions, overview.Data.TotalEngagement) // Account-level stats (followers etc) accountStats, err := client.Analytics.Accounts(ctx, &omnisocials.AccountAnalyticsParams{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.

Go
// How often an X account is read: posts full / light / off, followers daily / weekly / off account, err := client.Accounts.Update(ctx, "1234_x", &omnisocials.AccountUpdateParams{ XStatistics: &omnisocials.XStatisticsInput{Posts: omnisocials.XStatisticsPostsLight}, }) // "Update now": read one post's X numbers now fresh, err := client.Analytics.RefreshPost(ctx, "9123") fmt.Println(fresh.Data.CreditsUsed, len(fresh.Data.Tweets)) // The balance and the X statistics use credits, err := client.Credits.Get(ctx) fmt.Println(credits.Data.Balance, credits.Data.XStatistics.TotalCreditsMonth)

Post tags

Tags are your own labels for posts, such as a hook style or a format, to filter and compare posts in Analytics. They never go to a platform.

Go
tag, err := client.Tags.Create(ctx, &omnisocials.TagCreateParams{Name: "Question hook"}) tags, err := client.Tags.List(ctx) // Tag posts: ids or names; a new name becomes a tag _, err = client.Posts.Create(ctx, &omnisocials.PostCreateParams{ Content: "Would you post this?", Channels: []string{"tiktok"}, Tags: []any{"Question hook"}, }) _, err = client.Tags.Apply(ctx, &omnisocials.TagApplyParams{ PostIDs: []string{"1024", "1025"}, Add: []any{tag.Data.ID}, }) // Filter and compare posts, err := client.Posts.List(ctx, &omnisocials.PostListParams{Tag: "Question hook"}) cmp, err := client.Analytics.Tags(ctx, &omnisocials.TagAnalyticsParams{Platform: "tiktok"}) for _, row := range cmp.Data.Tags { fmt.Println(row.Tag.Name, row.VsNormal, row.EnoughPosts) // VsNormal 0.38 = 38% above your normal }

Tags.Update renames or recolours a tag, Tags.Delete takes it off every post, and PostUpdateParams.Tags replaces a post's tags (omnisocials.Null removes them all). AnalyticsOverviewParams.Tag narrows the overview to the posts with a tag. Every Post carries Tags and TrialReel.

Limits and feature requests

client.Limits.List (GET /limits) lists what OmniSocials cannot do, why, and what to do instead. client.FeatureRequests.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.

Go
limits, err := client.Limits.List(ctx, &omnisocials.LimitListParams{Platform: "tiktok"}) for _, limit := range limits.Data { fmt.Println(limit.Title, limit.Says, limit.Requestable) // limit.Instead is a *string } // Only after the person agrees res, err := client.FeatureRequests.Create(ctx, &omnisocials.FeatureRequestCreateParams{ Summary: "Post our daily update to the Announcements topic of our Telegram group.", Platform: "telegram", LimitID: "telegram.forum_topics", }) fmt.Println(res.Outcome, res.Data.ID) // omnisocials.FeatureRequestCreated, FeatureRequestVoted or FeatureRequestAlreadyRequested mine, err := client.FeatureRequests.List(ctx) // newest first, with Status and TeamReplies

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.NextCursor out).

Go
conversations, err := client.Inbox.ListConversations(ctx, &omnisocials.InboxListParams{ Platform: "instagram", Unread: omnisocials.Bool(true), }) conversationID := conversations.Data[0].ConversationID thread, err := client.Inbox.GetMessages(ctx, conversationID, nil) _, err = client.Inbox.Reply(ctx, conversationID, &omnisocials.InboxReplyParams{ Text: "Thanks for reaching out!", }) _, err = client.Inbox.MarkRead(ctx, conversationID) // Comment moderation: hide (false unhides) or delete _, err = client.Inbox.Hide(ctx, thread.Data[0].ID, true) _, err = client.Inbox.DeleteMessage(ctx, thread.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, set MessageID so the reply goes under the comment you answer and not under the newest comment on the post. On a Facebook comment, MentionAuthor: 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).

Go
next, err := client.Inbox.Next(ctx, &omnisocials.InboxNextParams{}) for err == nil && next.Data != nil { if !next.Data.ReplyWindow.Open { // An Instagram/Facebook DM past Meta's 24-hour window: answer it in the app if _, err = client.Inbox.MarkRead(ctx, next.Data.Message.ConversationID); err == nil { next, err = client.Inbox.Next(ctx, &omnisocials.InboxNextParams{}) } continue } var reply *omnisocials.InboxReplyResponse reply, err = client.Inbox.Reply(ctx, next.Data.Message.ConversationID, &omnisocials.InboxReplyParams{ Text: "Thanks! DM sent.", MessageID: next.Data.Message.ID, IncludeNext: true, }) if err == nil { next = &omnisocials.InboxNextResponse{Data: reply.Next} } }

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.

Go
list, err := client.Pinterest.ListProducts(ctx, nil) if err != nil { log.Fatal(err) } if list.Error != nil { log.Println(list.Error.Code, list.Error.Message) } else { productTags := []string{} for _, product := range list.Products { if len(productTags) < 3 { productTags = append(productTags, product.PinID) } } _, err = client.Posts.Create(ctx, &omnisocials.PostCreateParams{ Content: "Our summer picks", Channels: []string{"pinterest"}, MediaURLs: []string{"https://example.com/summer-look.jpg"}, ScheduledAt: "2026-08-01T09:00:00Z", Pinterest: map[string]any{"board_id": "1234567890", "product_tags": productTags}, }) }

The list answers with HTTP 200 in both cases: Products on success, or an Error with a Code (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.ValidateProduct(ctx, id) checks one Pin id or Pin link before you post. On Posts.Update the Pinterest map 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. client.Posts.Approve(ctx, id) without params still works.

Go
review, err := client.Posts.GetApproval(ctx, id) step := 0 // 0 leaves step_order out if review.Data.CurrentStep != nil { step = *review.Data.CurrentStep } _, err = client.Posts.Approve(ctx, id, &omnisocials.PostApproveParams{StepOrder: step}) // or: client.Posts.Reject(ctx, id, &omnisocials.PostRejectParams{Comment: "Wrong CTA link", StepOrder: step}) var apiErr *omnisocials.APIError if errors.As(err, &apiErr) && apiErr.Code == "step_changed" { // The review moved on; nothing was decided. Read the approval again. }

Verify webhooks

Go
package main import ( "errors" "io" "log" "net/http" "os" "time" omnisocials "github.com/OmniSocials/omnisocials-go" ) func main() { secret := os.Getenv("OMNISOCIALS_WEBHOOK_SECRET") http.HandleFunc("/omnisocials/webhook", func(w http.ResponseWriter, r *http.Request) { payload, err := io.ReadAll(r.Body) // keep the raw body! if err != nil { http.Error(w, "failed to read body", http.StatusBadRequest) return } event, err := omnisocials.VerifyWebhookSignature( payload, r.Header.Get("X-OmniSocials-Signature"), secret, 5*time.Minute, // tolerance; pass 0 for the default (5 minutes) ) if err != nil { var verr *omnisocials.WebhookVerificationError if errors.As(err, &verr) { http.Error(w, "invalid signature", http.StatusBadRequest) return } http.Error(w, "server error", http.StatusInternalServerError) return } data, _ := event["data"].(map[string]any) switch event["type"] { case "post.published": log.Println("Published:", data["post_id"], data["targets"]) case "post.failed": log.Println("Failed:", data["post_id"]) case "post.rejected": approval, _ := data["approval"].(map[string]any) log.Println("Rejected:", data["post_id"], approval["reason"]) } w.WriteHeader(http.StatusOK) }) log.Fatal(http.ListenAndServe(":8080", nil)) }

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 (null on post.approved). To read the full review of a post (steps, approvers, the rejection reason and the comment thread), call client.Posts.GetApproval(ctx, id).

Rotate the secret without missing deliveries

For 24 hours after client.Webhooks.RotateSecret(ctx, 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:

Go
event, err := omnisocials.VerifyWebhookSignature(payload, r.Header.Get("X-OmniSocials-Signature"), newSecret, 0) if err != nil { if previous := r.Header.Get("X-OmniSocials-Signature-Previous"); previous != "" { event, err = omnisocials.VerifyWebhookSignature(payload, previous, oldSecret, 0) } }

Errors

Typed errors matched with errors.As. The *APIError wrapper has Status, Code, Message, and Body. Types: *ValidationError (400/422), *AuthenticationError (401), *PermissionDeniedError (403), *NotFoundError (404), *RateLimitError (429, RetryAfter is a time.Duration), *ServerError (5xx), *ConnectionError, and *WebhookVerificationError.

Go
_, err := client.Posts.Create(ctx, &omnisocials.PostCreateParams{ Content: "Hi", Channels: []string{"instagram"}, }) if err != nil { var rateLimited *omnisocials.RateLimitError var validation *omnisocials.ValidationError var connection *omnisocials.ConnectionError var apiErr *omnisocials.APIError switch { case errors.As(err, &rateLimited): log.Printf("rate limited, retry in %s", rateLimited.RetryAfter) case errors.As(err, &validation): log.Printf("bad request (%s): %s", validation.Code, validation.Message) case errors.As(err, &connection): log.Printf("network problem: %v", connection) case errors.As(err, &apiErr): log.Printf("API error %d (%s): %s", apiErr.Status, apiErr.Code, apiErr.Message) default: log.Fatal(err) } }

Configuration

Go
client, err := omnisocials.NewClient( omnisocials.WithAPIKey("omsk_live_..."), omnisocials.WithBaseURL("https://api.omnisocials.com/v1"), // default omnisocials.WithTimeout(30*time.Second), // per-request timeout (default 30s) omnisocials.WithMaxRetries(2), // retries on 429 / 5xx / network errors (default 2) omnisocials.WithHTTPClient(customHTTPClient), // optional custom *http.Client )

Notes

  • Every method takes a context.Context as its first argument for deadlines and cancellation
  • Generic response envelopes: ItemResponse[T] and ListResponse[T]
  • Nullable helpers: omnisocials.Bool(false), omnisocials.String(...), and the omnisocials.Null sentinel for clearing fields
  • Source: github.com/OmniSocials/omnisocials-go
Last modified on November 24, 2026
PythonRuby
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
Go
Go
Go
Go
Go
Go
Go
Go
Go
Go
Go
Go
Go
Go
Go
Go
Go
Go