omnisocials 0.15.0 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,7 +10,7 @@ module OmniSocials
10
10
 
11
11
  # GET /analytics/posts/{id} - latest per-platform metrics for one post.
12
12
  def post(post_id)
13
- @client.request("GET", "/analytics/posts/#{post_id}")
13
+ @client.request("GET", "/analytics/posts/#{Internal.path_segment(post_id)}")
14
14
  end
15
15
 
16
16
  # GET /analytics/posts?ids=a,b,c - bulk metrics for up to 100 posts in
@@ -35,7 +35,7 @@ module OmniSocials
35
35
  # GET /automations/{id} - fetch a single automation. Requires the
36
36
  # automations:read scope (opt-in on the API key).
37
37
  def get(automation_id)
38
- @client.request("GET", "/automations/#{automation_id}")
38
+ @client.request("GET", "/automations/#{Internal.path_segment(automation_id)}")
39
39
  end
40
40
 
41
41
  # POST /automations - create a comment-to-DM automation.
@@ -131,13 +131,13 @@ module OmniSocials
131
131
  trigger: trigger, actions: actions, limits: limits, status: status,
132
132
  platform: platform, facebook_post_id: facebook_post_id
133
133
  )
134
- @client.request("PATCH", "/automations/#{automation_id}", json: body)
134
+ @client.request("PATCH", "/automations/#{Internal.path_segment(automation_id)}", json: body)
135
135
  end
136
136
 
137
137
  # DELETE /automations/{id} - delete an automation. Returns nil (204).
138
138
  # Requires the automations:write scope.
139
139
  def delete(automation_id)
140
- @client.request("DELETE", "/automations/#{automation_id}")
140
+ @client.request("DELETE", "/automations/#{Internal.path_segment(automation_id)}")
141
141
  end
142
142
 
143
143
  # GET /automations/{id}/events - the automation's activity: one event
@@ -154,7 +154,9 @@ module OmniSocials
154
154
  # events is left out). Each event carries kind ("comment", "dm",
155
155
  # "story_reply"), outcome, reason / reason_label (X adds the skip
156
156
  # reasons "dms_closed", "no_credits", "opted_out" and
157
- # "automation_off"; Follow first adds "already_waiting"), person (id,
157
+ # "automation_off"; Follow first adds "already_waiting";
158
+ # "plan_inactive" = the organisation had no active plan or trial, so
159
+ # nothing was sent), person (id,
158
160
  # username; on Facebook the person's name, since Facebook has no
159
161
  # @handle), trigger_id, trigger_text, message (the DM sent),
160
162
  # public_reply, platform_message_id, follow_gate (Follow first:
@@ -162,7 +164,7 @@ module OmniSocials
162
164
  # "checked", "after_ask" }, else nil), created_at and sent_at.
163
165
  def list_events(automation_id, outcome: nil, limit: nil, offset: nil)
164
166
  @client.request(
165
- "GET", "/automations/#{automation_id}/events",
167
+ "GET", "/automations/#{Internal.path_segment(automation_id)}/events",
166
168
  query: { "outcome" => outcome, "limit" => limit, "offset" => offset }
167
169
  )
168
170
  end
@@ -54,7 +54,7 @@ module OmniSocials
54
54
  # GET /feature-requests/{id} - one request with its status and the
55
55
  # team's replies. Errors: 400 invalid_id, 404 not_found.
56
56
  def get(request_id)
57
- @client.request("GET", "/feature-requests/#{request_id}")
57
+ @client.request("GET", "/feature-requests/#{Internal.path_segment(request_id)}")
58
58
  end
59
59
  end
60
60
  end
@@ -26,7 +26,7 @@ module OmniSocials
26
26
  def update(folder_id, name: nil, parent_id: OmniSocials::NOT_GIVEN)
27
27
  body = Internal.drop_nil({ "name" => name })
28
28
  body["parent_id"] = parent_id unless parent_id.is_a?(NotGiven)
29
- @client.request("PATCH", "/folders/#{folder_id}", json: body)
29
+ @client.request("PATCH", "/folders/#{Internal.path_segment(folder_id)}", json: body)
30
30
  end
31
31
 
32
32
  # DELETE /folders/{id} - delete a folder. Returns nil (204).
@@ -34,7 +34,7 @@ module OmniSocials
34
34
  # The folder's media is NOT deleted: files move to the root and
35
35
  # subfolders move up to the deleted folder's parent.
36
36
  def delete(folder_id)
37
- @client.request("DELETE", "/folders/#{folder_id}")
37
+ @client.request("DELETE", "/folders/#{Internal.path_segment(folder_id)}")
38
38
  end
39
39
  end
40
40
  end
@@ -16,7 +16,7 @@ module OmniSocials
16
16
 
17
17
  # GET /hashtag-sets/{id} - fetch a single hashtag set.
18
18
  def get(hashtag_set_id)
19
- @client.request("GET", "/hashtag-sets/#{hashtag_set_id}")
19
+ @client.request("GET", "/hashtag-sets/#{Internal.path_segment(hashtag_set_id)}")
20
20
  end
21
21
 
22
22
  # POST /hashtag-sets - create a hashtag set.
@@ -36,12 +36,12 @@ module OmniSocials
36
36
  # `hashtags` replaces the FULL list.
37
37
  def update(hashtag_set_id, name: nil, hashtags: nil)
38
38
  body = Internal.drop_nil({ "name" => name, "hashtags" => hashtags })
39
- @client.request("PATCH", "/hashtag-sets/#{hashtag_set_id}", json: body)
39
+ @client.request("PATCH", "/hashtag-sets/#{Internal.path_segment(hashtag_set_id)}", json: body)
40
40
  end
41
41
 
42
42
  # DELETE /hashtag-sets/{id} - delete a hashtag set. Returns nil (204).
43
43
  def delete(hashtag_set_id)
44
- @client.request("DELETE", "/hashtag-sets/#{hashtag_set_id}")
44
+ @client.request("DELETE", "/hashtag-sets/#{Internal.path_segment(hashtag_set_id)}")
45
45
  end
46
46
  end
47
47
  end
@@ -279,7 +279,7 @@ module OmniSocials
279
279
  # escaped; spaces become %20 (a path segment treats "+" literally,
280
280
  # unlike a query string).
281
281
  def encode_id(conversation_id)
282
- CGI.escape(conversation_id.to_s).gsub("+", "%20")
282
+ Internal.path_segment(conversation_id)
283
283
  end
284
284
  end
285
285
  end
@@ -24,7 +24,7 @@ module OmniSocials
24
24
 
25
25
  # GET /media/{id} - fetch a single library file.
26
26
  def get(media_id)
27
- @client.request("GET", "/media/#{media_id}")
27
+ @client.request("GET", "/media/#{Internal.path_segment(media_id)}")
28
28
  end
29
29
 
30
30
  # POST /media/upload - multipart upload (max 100MB inline).
@@ -52,7 +52,9 @@ module OmniSocials
52
52
  # POST /media/upload-from-url - server-side fetch, up to 1GB.
53
53
  #
54
54
  # Files over 100MB are streamed in the background: the response has
55
- # data["status"] == "processing"; poll get() until it is "ready".
55
+ # data["status"] == "processing"; poll get() until it is "ready". When
56
+ # such a file cannot be queued for processing, the answer is 503
57
+ # "processing_unavailable": send the same request again in a minute.
56
58
  def upload_from_url(url:, filename: nil, name: nil, folder: nil, folder_id: nil, pdf_mode: nil)
57
59
  body = Internal.drop_nil(
58
60
  {
@@ -128,7 +130,7 @@ module OmniSocials
128
130
  def update(media_id, name: nil, folder_id: OmniSocials::NOT_GIVEN)
129
131
  body = Internal.drop_nil({ "name" => name })
130
132
  body["folder_id"] = folder_id unless folder_id.is_a?(NotGiven)
131
- @client.request("PATCH", "/media/#{media_id}", json: body)
133
+ @client.request("PATCH", "/media/#{Internal.path_segment(media_id)}", json: body)
132
134
  end
133
135
 
134
136
  # DELETE /media/{id} - delete a file. Returns nil (204).
@@ -136,7 +138,7 @@ module OmniSocials
136
138
  # Fails with 409 media_in_use if the file is attached to a scheduled or
137
139
  # publishing post.
138
140
  def delete(media_id)
139
- @client.request("DELETE", "/media/#{media_id}")
141
+ @client.request("DELETE", "/media/#{Internal.path_segment(media_id)}")
140
142
  end
141
143
  end
142
144
  end
@@ -43,7 +43,7 @@ module OmniSocials
43
43
 
44
44
  # GET /posts/{id} - fetch a single post.
45
45
  def get(post_id)
46
- @client.request("GET", "/posts/#{post_id}")
46
+ @client.request("GET", "/posts/#{Internal.path_segment(post_id)}")
47
47
  end
48
48
 
49
49
  # GET /posts/recent-platform - recent posts fetched live from the
@@ -189,6 +189,12 @@ module OmniSocials
189
189
  # most 20; a name that does not exist yet becomes a new tag) to filter
190
190
  # and compare posts in Analytics. Tags never go to a platform. Errors:
191
191
  # 404 tag_not_found (an unknown id), 400 invalid_tags / too_many_tags.
192
+ #
193
+ # A media id that is still processing (a large video is checked and
194
+ # converted after upload) answers 409 "media_processing" and nothing is
195
+ # created: wait until media.get(id) says "ready", then send the same
196
+ # request again. A file whose processing failed answers 400
197
+ # "invalid_media": upload it again.
192
198
  def create(content:, channels: nil, scheduled_at: nil, media_ids: nil,
193
199
  media_urls: nil, type: nil, source: nil, link_url: nil,
194
200
  link_title: nil, link_description: nil, link_thumbnail_url: nil,
@@ -226,7 +232,8 @@ module OmniSocials
226
232
  # See #create for the "warnings" array (X link posts, and the
227
233
  # "image_fit" entries steered by media_fit), the 402
228
234
  # "x_credits_insufficient" credit gate on X link posts,
229
- # comment_dm_automation and tags.
235
+ # comment_dm_automation, tags and the 409 "media_processing" / 400
236
+ # "invalid_media" answers.
230
237
  def create_and_publish(content:, channels: nil, media_ids: nil,
231
238
  media_urls: nil, type: nil, source: nil,
232
239
  link_url: nil, link_title: nil, link_description: nil,
@@ -302,6 +309,15 @@ module OmniSocials
302
309
  # tags; tags: nil or tags: [] removes them all, and leaving it out
303
310
  # keeps them. An update with only tags works on every post, published
304
311
  # and failed ones included.
312
+ #
313
+ # 409 answers, where nothing is changed: "post_publishing" while the
314
+ # post is publishing (status "posting") or a retry publishes one of its
315
+ # channels (poll #get until "published", "warning" or "failed"; an
316
+ # update with only tags still works); "review_required" when changes
317
+ # were requested on the post (approval_status "rejected") and the
318
+ # update would schedule it (it needs a new review: create it again
319
+ # with approval_workflow_id; saving it as a draft works);
320
+ # "media_processing" as on #create.
305
321
  def update(post_id, content: nil, scheduled_at: nil, channels: nil,
306
322
  media_ids: nil, media_urls: nil, type: nil, location_id: nil,
307
323
  collaborators: nil, user_tags: nil, pinterest: nil,
@@ -348,19 +364,26 @@ module OmniSocials
348
364
  body["discord"] = discord unless discord.is_a?(NotGiven)
349
365
  # And for tags: an explicit nil (or []) removes every tag of the post.
350
366
  body["tags"] = tags unless tags.is_a?(NotGiven)
351
- @client.request("PATCH", "/posts/#{post_id}", json: body)
367
+ @client.request("PATCH", "/posts/#{Internal.path_segment(post_id)}", json: body)
352
368
  end
353
369
 
354
- # DELETE /posts/{id} - remove a post from OmniSocials (the live post stays on the platform). Returns nil (204).
370
+ # DELETE /posts/{id} - remove a post from OmniSocials (the live post
371
+ # stays on the platform). Returns nil (204). While the post is
372
+ # publishing (status "posting") or a retry publishes one of its
373
+ # channels, the answer is 409 "post_publishing" and nothing is deleted:
374
+ # poll #get until "published", "warning" or "failed", then delete it.
355
375
  def delete(post_id)
356
- @client.request("DELETE", "/posts/#{post_id}")
376
+ @client.request("DELETE", "/posts/#{Internal.path_segment(post_id)}")
357
377
  end
358
378
 
359
379
  # POST /posts/{id}/publish - publish a draft or scheduled post now.
360
380
  # See #create for the 402 "x_credits_insufficient" credit gate that
361
- # can also refuse publishing a scheduled X link post.
381
+ # can also refuse publishing a scheduled X link post. A post on which
382
+ # changes were requested in its approval workflow (approval_status
383
+ # "rejected") answers 409 "review_required": it publishes only after a
384
+ # new review (create it again with approval_workflow_id).
362
385
  def publish(post_id)
363
- @client.request("POST", "/posts/#{post_id}/publish")
386
+ @client.request("POST", "/posts/#{Internal.path_segment(post_id)}/publish")
364
387
  end
365
388
 
366
389
  # POST /posts/{id}/retry - retry the failed platforms of a "failed" or
@@ -369,32 +392,50 @@ module OmniSocials
369
392
  # Only the platforms that failed are re-published; platforms that
370
393
  # already succeeded are never posted again. Asynchronous: a 200 means
371
394
  # the retry is queued - poll `get` for the outcome. Max 3 retries per
372
- # platform.
395
+ # platform. While another retry runs (a second request, the dashboard,
396
+ # the automatic retry) the answer is 409 "retry_in_progress" and
397
+ # nothing is queued: poll `get` and retry once the post is "failed" or
398
+ # "warning" again.
373
399
  def retry(post_id)
374
- @client.request("POST", "/posts/#{post_id}/retry")
400
+ @client.request("POST", "/posts/#{Internal.path_segment(post_id)}/retry")
375
401
  end
376
402
 
377
403
  # POST /posts/{id}/approve - approve the current step of a post's
378
404
  # approval workflow, on behalf of the user who owns this API key. That
379
- # user must be a listed approver for the workflow's CURRENT step -
405
+ # user must be a listed approver for the workflow's CURRENT step:
380
406
  # steps approve in order, so an approver on a later step gets a 403
381
407
  # "forbidden" error until earlier steps clear. Only works on a post
382
408
  # with approval_status "pending". If this is the last step, the post
383
409
  # finalizes immediately ("scheduled" or "posting"); otherwise it stays
384
410
  # "in_approval" and the next step's approvers are notified.
385
- def approve(post_id)
386
- @client.request("POST", "/posts/#{post_id}/approve")
411
+ #
412
+ # Pass step_order: the "current_step" of #get_approval, the step you
413
+ # reviewed. When the review is on another step now (somebody decided
414
+ # since you read it, or a retried call already went through), nothing
415
+ # is approved and the call raises a 409 OmniSocials::APIError with
416
+ # code "step_changed"; err.body["error"]["current_step_order"] is the
417
+ # step the review is on now. Read the approval again before you
418
+ # decide. Without step_order the call approves whatever step is
419
+ # current, so a retry after a timeout can approve the next step too.
420
+ def approve(post_id, step_order: nil)
421
+ body = step_order.nil? ? nil : { "step_order" => step_order }
422
+ @client.request("POST", "/posts/#{Internal.path_segment(post_id)}/approve", json: body)
387
423
  end
388
424
 
389
425
  # POST /posts/{id}/reject - reject a post's approval workflow, on
390
426
  # behalf of the user who owns this API key. Same approver requirement
391
427
  # as #approve. Unlike approval, a rejection stops the WHOLE workflow
392
- # immediately (not just the current step) - the post's status becomes
393
- # "rejected". `comment` is optional and, when given, is shown to the
394
- # requester and other approvers in the post's review thread.
395
- def reject(post_id, comment: nil)
396
- body = comment ? { comment: comment } : nil
397
- @client.request("POST", "/posts/#{post_id}/reject", json: body)
428
+ # immediately (not just the current step): the post's status becomes
429
+ # "rejected". `comment` is optional (max 2000 characters) and, when
430
+ # given, is shown to the requester and other approvers in the post's
431
+ # review thread. `step_order` works as on #approve: when the review
432
+ # moved on, nothing is rejected and the call raises a 409
433
+ # "step_changed" error with "current_step_order" in its body.
434
+ def reject(post_id, comment: nil, step_order: nil)
435
+ body = {}
436
+ body["comment"] = comment if comment
437
+ body["step_order"] = step_order unless step_order.nil?
438
+ @client.request("POST", "/posts/#{Internal.path_segment(post_id)}/reject", json: body.empty? ? nil : body)
398
439
  end
399
440
 
400
441
  # GET /posts/{id}/approval - the approval review of a post: every step
@@ -410,7 +451,7 @@ module OmniSocials
410
451
  # and empty steps and comments. Read-only; requires the posts:read
411
452
  # scope.
412
453
  def get_approval(post_id)
413
- @client.request("GET", "/posts/#{post_id}/approval")
454
+ @client.request("GET", "/posts/#{Internal.path_segment(post_id)}/approval")
414
455
  end
415
456
 
416
457
  private
@@ -51,13 +51,13 @@ module OmniSocials
51
51
  # 409 tag_exists.
52
52
  def update(tag_id, name: nil, color: nil)
53
53
  body = Internal.drop_nil({ "name" => name, "color" => color })
54
- @client.request("PATCH", "/tags/#{tag_id}", json: body)
54
+ @client.request("PATCH", "/tags/#{Internal.path_segment(tag_id)}", json: body)
55
55
  end
56
56
 
57
57
  # DELETE /tags/{id} - delete a tag and take it off every post (the
58
58
  # posts stay). Returns { "data" => { "tag", "posts_untagged" } }.
59
59
  def delete(tag_id)
60
- @client.request("DELETE", "/tags/#{tag_id}")
60
+ @client.request("DELETE", "/tags/#{Internal.path_segment(tag_id)}")
61
61
  end
62
62
 
63
63
  # POST /tags/apply - add, remove or replace the tags of up to 500 posts
@@ -3,8 +3,11 @@
3
3
  module OmniSocials
4
4
  module Resources
5
5
  # Webhooks resource: manage event subscriptions (post.scheduled,
6
- # post.published, post.failed, post.approved, post.rejected, and
7
- # ad.status_changed for ad campaigns).
6
+ # post.published, post.failed, post.approved, post.rejected, and for ads
7
+ # ad.status_changed, ad.created, ad.updated, ad.review,
8
+ # ad.delivery_issue, campaign.created, campaign.updated,
9
+ # campaign.budget, lead.received, ads.sync_failed, ads.sync_recovered,
10
+ # ads.initial_sync_completed and ad_rule.triggered).
8
11
  #
9
12
  # For verifying incoming deliveries, see OmniSocials::Webhooks.verify.
10
13
  class Webhooks
@@ -12,25 +15,42 @@ module OmniSocials
12
15
  @client = client
13
16
  end
14
17
 
15
- # GET /webhooks - list webhook subscriptions.
18
+ # GET /webhooks - list the webhooks of the key's workspace and the
19
+ # organisation-wide webhooks of its organisation.
20
+ #
21
+ # Every webhook carries "workspace_id": nil for an organisation-wide
22
+ # webhook (made in the OmniSocials dashboard), which receives the
23
+ # events of every workspace of the organisation. A webhook whose
24
+ # creator lost access to the organisation or workspace is switched off
25
+ # automatically: "is_active" is false and "last_failure"["error"] says
26
+ # why.
16
27
  def list
17
28
  @client.request("GET", "/webhooks")
18
29
  end
19
30
 
20
- # GET /webhooks/{id} - fetch a single webhook subscription.
31
+ # GET /webhooks/{id} - fetch a webhook of the key's workspace, or an
32
+ # organisation-wide webhook of its organisation ("workspace_id" nil).
21
33
  def get(webhook_id)
22
- @client.request("GET", "/webhooks/#{webhook_id}")
34
+ @client.request("GET", "/webhooks/#{Internal.path_segment(webhook_id)}")
23
35
  end
24
36
 
25
37
  # POST /webhooks - create a webhook subscription.
26
38
  #
27
39
  # `url` must be HTTPS. `events` is a non-empty subset of
28
40
  # post.scheduled, post.published, post.failed, post.approved,
29
- # post.rejected and ad.status_changed. The `data` of an
30
- # ad.status_changed delivery is the campaign, not a post: campaign_id,
31
- # workspace_id, name, platform, campaign_type, status, previous_status,
32
- # external_campaign_id and budget. The signing `secret` is only
33
- # returned once, in this response - store it.
41
+ # post.rejected and the ads events ad.status_changed, ad.created,
42
+ # ad.updated, ad.review, ad.delivery_issue, campaign.created,
43
+ # campaign.updated, campaign.budget, lead.received, ads.sync_failed,
44
+ # ads.sync_recovered, ads.initial_sync_completed and
45
+ # ad_rule.triggered. The `data` of an ad.status_changed delivery is
46
+ # the campaign, not a post: campaign_id, workspace_id, name, platform,
47
+ # campaign_type, status, previous_status, external_campaign_id and
48
+ # budget; the other ads events carry the campaign (plus "details") or
49
+ # their own data (a lead, a rule run, an ad account). Any Ads event
50
+ # (ad.*, campaign.*, lead.*, ads.*, ad_rule.*) needs the ads:read scope
51
+ # on the key and access_ads for its person (403 insufficient_scope /
52
+ # 403 insufficient_permission). The signing
53
+ # `secret` is only returned once, in this response - store it.
34
54
  def create(url:, events:)
35
55
  @client.request(
36
56
  "POST", "/webhooks",
@@ -38,7 +58,17 @@ module OmniSocials
38
58
  )
39
59
  end
40
60
 
41
- # PATCH /webhooks/{id} - update url, events, or active state.
61
+ # PATCH /webhooks/{id} - update url, events, or active state. Ads
62
+ # events need the same ads:read scope and access_ads as on create.
63
+ # Works on organisation-wide webhooks too. is_active: true switches on
64
+ # a webhook that was switched off (also an automatic switch-off);
65
+ # setting url, events or switching it on makes the key's creator the
66
+ # person behind the webhook. Setting url on an organisation-wide
67
+ # webhook (even its current one) moves it to the key's workspace: from
68
+ # then on it gets only that workspace's events, and the answer shows
69
+ # the new workspace_id. When the webhook has Ads events after the
70
+ # change, setting url or events or switching it on needs ads:read and
71
+ # access_ads (403 otherwise, nothing changed).
42
72
  def update(webhook_id, url: nil, events: nil, is_active: nil)
43
73
  body = Internal.drop_nil(
44
74
  {
@@ -47,19 +77,28 @@ module OmniSocials
47
77
  "is_active" => is_active
48
78
  }
49
79
  )
50
- @client.request("PATCH", "/webhooks/#{webhook_id}", json: body)
80
+ @client.request("PATCH", "/webhooks/#{Internal.path_segment(webhook_id)}", json: body)
51
81
  end
52
82
 
53
- # DELETE /webhooks/{id} - delete a webhook. Returns nil (204).
83
+ # DELETE /webhooks/{id} - delete a webhook of the key's workspace or
84
+ # an organisation-wide webhook of its organisation. Returns nil (204).
54
85
  def delete(webhook_id)
55
- @client.request("DELETE", "/webhooks/#{webhook_id}")
86
+ @client.request("DELETE", "/webhooks/#{Internal.path_segment(webhook_id)}")
56
87
  end
57
88
 
58
89
  # POST /webhooks/{id}/rotate-secret - rotate the signing secret.
59
90
  #
60
- # The new secret is only returned once, in this response.
91
+ # The new secret is only returned once, in this response. The old
92
+ # secret keeps signing for 24 hours: every delivery then carries
93
+ # X-OmniSocials-Signature (new secret) and
94
+ # X-OmniSocials-Signature-Previous (old secret, same format, same
95
+ # timestamp and body). Verify the first with the new secret and, when
96
+ # that fails, the second with the old one (see
97
+ # OmniSocials::Webhooks.verify). Rotating again within the 24 hours
98
+ # replaces the previous secret with the one just rotated out. Works on
99
+ # organisation-wide webhooks too.
61
100
  def rotate_secret(webhook_id)
62
- @client.request("POST", "/webhooks/#{webhook_id}/rotate-secret")
101
+ @client.request("POST", "/webhooks/#{Internal.path_segment(webhook_id)}/rotate-secret")
63
102
  end
64
103
  end
65
104
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OmniSocials
4
- VERSION = "0.15.0"
4
+ VERSION = "0.17.0"
5
5
  end
@@ -11,6 +11,12 @@ module OmniSocials
11
11
  # - Header: X-OmniSocials-Signature: t=<unix>,v1=<hex>
12
12
  # - Signed value: "{timestamp}.{raw_body}" (UTF-8), keyed with the
13
13
  # webhook's secret, hex digest.
14
+ # - For 24 hours after a secret rotation, deliveries also carry
15
+ # X-OmniSocials-Signature-Previous: the same format, timestamp and body,
16
+ # signed with the old secret. To keep accepting deliveries while you
17
+ # switch secrets, verify X-OmniSocials-Signature with the new secret
18
+ # and, when that raises, X-OmniSocials-Signature-Previous with the old
19
+ # secret.
14
20
  module Webhooks
15
21
  class << self
16
22
  # Verify an OmniSocials webhook delivery and return the parsed event.
@@ -19,7 +25,9 @@ module OmniSocials
19
25
  # parse and re-serialize it first; the signature is over the
20
26
  # raw bytes.
21
27
  # signature - the X-OmniSocials-Signature header value, of the form
22
- # t=<unix>,v1=<hex>.
28
+ # t=<unix>,v1=<hex>. For 24 hours after a secret rotation,
29
+ # pass the X-OmniSocials-Signature-Previous value here
30
+ # with the old secret when the new secret does not match.
23
31
  # secret - the webhook's signing secret (returned once when the
24
32
  # webhook is created, or via rotate_secret).
25
33
  # tolerance - maximum allowed age (and future skew) of the signed
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omnisocials
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.0
4
+ version: 0.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - OmniSocials
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-11-05 00:00:00.000000000 Z
11
+ date: 2026-11-08 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Schedule and publish social media posts, upload media, and read analytics
14
14
  across Instagram, Facebook, LinkedIn, YouTube, TikTok, X, Pinterest, Bluesky, Threads,