Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ All notable changes to this project are documented here. The format follows
- `ads().uploadConversions` returns `ConversionUploadResult` (`id`, `accepted`, `eventCount`,
`replayed`) instead of the accepted count, and takes an optional `idempotencyKey`.

### Removed

- `blog()` (`BlogResource`) and the retired `/v1/blog/*` endpoints it wrapped (settings,
website secret and test, destinations, keywords, articles), with `BlogParams`, every `Blog*`
model and constant class, and `WebhookEvents.ARTICLE_PUBLISHED`. Articles are ordinary posts
now; `blogs()` (remote articles on a connected site) is unchanged.

## [0.4.0] - 2026-10-18

### Added
Expand Down
4 changes: 2 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ src/main/java/com/fopost/sdk/
LabelsResource, WebhooksResource, AnalyticsResource,
AutomationsResource, MediaResource, AiResource, CommunitiesResource,
InboxResource, AdsResource, GoogleAdsResource, ValidateResource,
BroadcastsResource, SequencesResource, BlogResource
BroadcastsResource, SequencesResource
WebhookVerifier.java signature check over the raw bytes; WebhookEnvelope is what it returns
```

Expand All @@ -82,7 +82,7 @@ calls `ApiClient.unwrap(...)` and `convert(...)`/`convertList(...)` into a recor
- `FoPost` instances are immutable and safe to share across threads.

**Resources wired today:** `posts`, `accounts` (with `accounts().communities()`), `workspaces`,
`labels`, `webhooks`, `analytics`, `automations`, `media`, `ai`, `inbox`, `contacts`, `broadcasts`, `sequences`, `ads`, `googleAds`, `blog`, `validate`. This is
`labels`, `webhooks`, `analytics`, `automations`, `media`, `ai`, `inbox`, `contacts`, `broadcasts`, `sequences`, `ads`, `googleAds`, `validate`. This is
the most complete of the FoPost SDKs — do not narrow it. `FoPost.request(...)` is the escape hatch for
anything unwrapped.

Expand Down
56 changes: 3 additions & 53 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ long failed = client.posts().stream(PostListParams.create().workspaceId(workspac
| `accountGroups()` | `list`, `get`, `create`, `update`, `delete`, `setMembers` |
| `labels()` | `list`, `get`, `create`, `update`, `delete` |
| `webhooks()` | `list`, `create`, `update`, `delete`, `test`, `deliveries`, `delivery`, `redeliver`, `verify` |
| `blog()` | `getSettings`, `updateSettings`, `rotateWebsiteSecret`, `testWebsite`, `listKeywords`, `suggestSeeds`, `planKeywords`, `addKeyword`, `updateKeyword`, `deleteKeyword`, `listArticles`, `requestArticle`, `getArticle`, `updateArticle`, `regenerateArticle`, `submitArticle`, `publishArticle`, `rejectArticle`, `deleteArticle` |
| `analytics()` | `overview`, `timeSeries`, `topPosts`, `labels`, `postsTable`, `postingStreak`, `demographics`, `collect`, `decay`, `frequency`, `timeline`, `changes`, `collectPost`, `nativePosts`, `inbox` |
| `automations()` | `list`, `get`, `create`, `update`, `delete`, `toggle`, `runs`, `run`, `trigger`, `stats`, `versions`, `version`, `restoreVersion` |
| `media()` | `list`, `limits`, `upload`, `presign`, `complete`, `uploadDirect`, `delete` |
Expand Down Expand Up @@ -263,53 +262,6 @@ System.out.println(hook.secret());
client.webhooks().test(hook.id());
```

## Blog

A post goes to a social network; an article goes to a website. `blog()` holds the keyword plan,
the articles the writer produces, and the settings that say where they are published:
`BlogTargetKind.PRODUCT_BLOG`, a connected `ACCOUNT`, or your own `WEBSITE`, which receives each
published article as a signed webhook.

Planning starts from the blog's goal. Suggest search terms, research them, then pick the keywords
worth writing; a picked keyword takes the next free date on the calendar.

```java
client.blog().updateSettings(
workspace.id(),
BlogParams.Settings.create().goal(BlogGoal.LEADS).focusTopics("Scheduling for small teams"));

List<String> seeds = client.blog().suggestSeeds(workspace.id(), List.of(), "Beginners, not agencies");
client.blog().planKeywords(workspace.id(), seeds);

for (BlogKeyword keyword : client.blog().listKeywords(
workspace.id(), BlogParams.Filter.create().status(BlogKeywordStatus.SUGGESTED).limit(3))) {
client.blog().updateKeyword(
workspace.id(), keyword.id(), BlogParams.KeywordUpdate.create().status(BlogKeywordStatus.PLANNED));
}
```

Every article is approved before it publishes: submit a draft for review, then publish it or give
it a `publishAt`.

```java
BlogArticle article = client.blog().requestArticle(
workspace.id(),
BlogParams.Article.create()
.keyword("how to schedule posts")
.instructions("Lead with the calendar view."));

// Poll until the status leaves queued and writing, then read the body.
BlogArticleFull draft = client.blog().getArticle(workspace.id(), article.id());
client.blog().submitArticle(workspace.id(), article.id());
client.blog().publishArticle(workspace.id(), article.id());
```

Reads, settings, keyword edits and `submitArticle` need `posts`; `suggestSeeds`, `planKeywords`,
`requestArticle` and `regenerateArticle` spend AI credits and need `ai` (an empty balance is a
`PaymentRequiredException`); `publishArticle` needs `publish`, answers 409 for a draft that was
never submitted, and 409 `no_target` until a target is set. Setting `websiteUrl` issues the site's signing secret once, on
`BlogSettingsUpdate.websiteSecret()`; `rotateWebsiteSecret` issues a new one.

To verify a delivery, hand `WebhookVerifier` the raw request bytes, the headers and the secret.
It prefers the timestamped signature, refuses one more than 300 seconds old, and falls back to
the body-only signature when no timestamp header is present. The same call is on
Expand All @@ -319,15 +271,13 @@ the body-only signature when no timestamp header is present. The same call is on
byte[] rawBody = request.getInputStream().readAllBytes();
WebhookEnvelope envelope = WebhookVerifier.verify(rawBody, headers, System.getenv("FOPOST_WEBHOOK_SECRET"));

if (WebhookEvents.ARTICLE_PUBLISHED.equals(envelope.event())) {
BlogArticlePublished published = envelope.data(BlogArticlePublished.class);
store(published.slug(), published.bodyHtml());
if (WebhookEvents.POST_PUBLISHED.equals(envelope.event())) {
String postId = envelope.data().path("id").asText();
}
```

A failed check is a `FoPostException` with code `missing_signature`, `invalid_signature`,
`stale_timestamp` or `invalid_payload`. Image URLs in the payload are fetchable for six hours;
download and store your own copy.
`stale_timestamp` or `invalid_payload`.

## AI features

Expand Down
11 changes: 0 additions & 11 deletions src/main/java/com/fopost/sdk/FoPost.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import com.fopost.sdk.resource.AiResource;
import com.fopost.sdk.resource.AnalyticsResource;
import com.fopost.sdk.resource.AutomationsResource;
import com.fopost.sdk.resource.BlogResource;
import com.fopost.sdk.resource.BroadcastsResource;
import com.fopost.sdk.resource.ConnectSessionsResource;
import com.fopost.sdk.resource.ContactsResource;
Expand Down Expand Up @@ -92,7 +91,6 @@ public final class FoPost {
private final InboxResource inbox;
private final AdsResource ads;
private final GoogleAdsResource googleAds;
private final BlogResource blog;
private final BlogsResource blogs;
private final ValidateResource validate;

Expand Down Expand Up @@ -121,7 +119,6 @@ private FoPost(ApiClient http) {
this.sequences = new SequencesResource(http);
this.ads = new AdsResource(http);
this.googleAds = new GoogleAdsResource(http);
this.blog = new BlogResource(http);
this.blogs = new BlogsResource(http);
this.validate = new ValidateResource(http);
}
Expand Down Expand Up @@ -252,14 +249,6 @@ public GoogleAdsResource googleAds() {
return googleAds;
}

/**
* Articles for a website: the keyword plan, the drafts the writer produces, and where they
* are published. A post goes to a social network; an article goes to a website.
*/
public BlogResource blog() {
return blog;
}

public ValidateResource validate() {
return validate;
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/fopost/sdk/WebhookEnvelope.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
*
* <pre>{@code
* WebhookEnvelope envelope = WebhookVerifier.verify(rawBody, headers, secret);
* if (WebhookEvents.ARTICLE_PUBLISHED.equals(envelope.event())) {
* BlogArticlePublished article = envelope.data(BlogArticlePublished.class);
* if (WebhookEvents.POST_PUBLISHED.equals(envelope.event())) {
* String postId = envelope.data().path("id").asText();
* }
* }</pre>
*/
public record WebhookEnvelope(String event, JsonNode data, String timestamp) {

/** The body as a typed record, such as {@link com.fopost.sdk.model.BlogArticlePublished}. */
/** The body as a typed record. */
public <T> T data(Class<T> type) {
if (data == null || data.isNull() || data.isMissingNode()) {
return null;
Expand Down
32 changes: 0 additions & 32 deletions src/main/java/com/fopost/sdk/model/BlogArticle.java

This file was deleted.

37 changes: 0 additions & 37 deletions src/main/java/com/fopost/sdk/model/BlogArticleFull.java

This file was deleted.

8 changes: 0 additions & 8 deletions src/main/java/com/fopost/sdk/model/BlogArticleImage.java

This file was deleted.

25 changes: 0 additions & 25 deletions src/main/java/com/fopost/sdk/model/BlogArticlePublished.java

This file was deleted.

22 changes: 0 additions & 22 deletions src/main/java/com/fopost/sdk/model/BlogArticleStatus.java

This file was deleted.

17 changes: 0 additions & 17 deletions src/main/java/com/fopost/sdk/model/BlogGoal.java

This file was deleted.

22 changes: 0 additions & 22 deletions src/main/java/com/fopost/sdk/model/BlogKeyword.java

This file was deleted.

16 changes: 0 additions & 16 deletions src/main/java/com/fopost/sdk/model/BlogKeywordStatus.java

This file was deleted.

9 changes: 0 additions & 9 deletions src/main/java/com/fopost/sdk/model/BlogPlanRun.java

This file was deleted.

Loading
Loading