FoPost.Inbox (FoPost v0.2.0)

Copy Markdown View Source

Comments, mentions, and direct messages on connected accounts.

Every function needs the inbox scope. Lists answer a FoPost.Page whose meta.current_page, meta.per_page, and meta.total are set.

{:ok, page} = FoPost.Inbox.list(client, workspace_id: id, state: "unread")
{:ok, result} = FoPost.Inbox.reply(client, item.id, text: "Thanks!")

Summary

Functions

Every active account, flagged with whether comments and DMs can be read for it.

Replies an automation or the agent drafted that a person still has to send.

Sends a drafted reply, or :text in its place. id is the approval's integer id.

One page of direct-message threads, latest first.

Deletes a comment on the platform.

Hides a comment on the platform.

Same as hide/2, but raises FoPost.Error.

One page of items, newest first.

Marks a whole comment thread or DM thread read; answers how many items changed.

Inbox support per platform.

Polls every inbox-capable account in the workspace now. Required: :workspace_id.

Discards a drafted reply. id is the approval's integer id.

Sends a reply on the platform as the connected account. Required: :text.

One page of threads: one row per post with comments, or with mentions when :kind is "mentions".

Shows a hidden comment again.

How many items are unread, optionally narrowed with :workspace_id.

Sets an item's state. Required: :state (unread, read, resolved, snoozed); :snoozed_until goes with "snoozed" and accepts a DateTime or an ISO 8601 string.

Functions

accounts(client, opts \\ [])

@spec accounts(
  FoPost.Client.t(),
  keyword()
) :: {:ok, [FoPost.InboxAccount.t()]} | {:error, FoPost.Error.t()}

Every active account, flagged with whether comments and DMs can be read for it.

accounts!(client, opts \\ [])

Same as accounts/2, but raises FoPost.Error.

approvals(client, opts \\ [])

@spec approvals(
  FoPost.Client.t(),
  keyword()
) :: {:ok, [FoPost.InboxApproval.t()]} | {:error, FoPost.Error.t()}

Replies an automation or the agent drafted that a person still has to send.

approvals!(client, opts \\ [])

Same as approvals/2, but raises FoPost.Error.

approve_reply(client, id, opts \\ [])

@spec approve_reply(FoPost.Client.t(), integer(), keyword()) ::
  {:ok, FoPost.InboxDecision.t()} | {:error, FoPost.Error.t()}

Sends a drafted reply, or :text in its place. id is the approval's integer id.

approve_reply!(client, id, opts \\ [])

Same as approve_reply/3, but raises FoPost.Error.

conversations(client, opts \\ [])

@spec conversations(
  FoPost.Client.t(),
  keyword()
) :: {:ok, FoPost.Page.t()} | {:error, FoPost.Error.t()}

One page of direct-message threads, latest first.

Filters: :workspace_id, :platform, :account_id, :state, :q, :sort. Paging: :page, :per_page.

conversations!(client, opts \\ [])

Same as conversations/2, but raises FoPost.Error.

delete(client, id)

@spec delete(FoPost.Client.t(), String.t()) ::
  {:ok, FoPost.Message.t()} | {:error, FoPost.Error.t()}

Deletes a comment on the platform.

delete!(client, id)

Same as delete/2, but raises FoPost.Error.

hide(client, id)

@spec hide(FoPost.Client.t(), String.t()) ::
  {:ok, FoPost.InboxItem.t()} | {:error, FoPost.Error.t()}

Hides a comment on the platform.

hide!(client, id)

Same as hide/2, but raises FoPost.Error.

list(client, opts \\ [])

@spec list(
  FoPost.Client.t(),
  keyword()
) :: {:ok, FoPost.Page.t()} | {:error, FoPost.Error.t()}

One page of items, newest first.

Filters: :workspace_id, :type (comment, mention, dm), :state (unread, read, resolved, snoozed), :platform, :account_id, :post_id, :post_external_id, :conversation_id, :direction (inbound, outbound), :q, :sort (newest, oldest, unanswered). Paging: :page, :per_page.

list!(client, opts \\ [])

Same as list/2, but raises FoPost.Error.

mark_thread_read(client, opts)

@spec mark_thread_read(
  FoPost.Client.t(),
  keyword()
) :: {:ok, integer()} | {:error, FoPost.Error.t()}

Marks a whole comment thread or DM thread read; answers how many items changed.

Required: :workspace_id, :account_id, plus :post_external_id for a comment thread or :conversation_id for a DM thread.

mark_thread_read!(client, opts)

Same as mark_thread_read/2, but raises FoPost.Error.

platforms(client)

@spec platforms(FoPost.Client.t()) ::
  {:ok, [FoPost.InboxPlatform.t()]} | {:error, FoPost.Error.t()}

Inbox support per platform.

platforms!(client)

Same as platforms/1, but raises FoPost.Error.

refresh(client, opts)

@spec refresh(
  FoPost.Client.t(),
  keyword()
) :: {:ok, FoPost.InboxRefreshResult.t()} | {:error, FoPost.Error.t()}

Polls every inbox-capable account in the workspace now. Required: :workspace_id.

refresh!(client, opts)

Same as refresh/2, but raises FoPost.Error.

reject_reply(client, id)

@spec reject_reply(FoPost.Client.t(), integer()) ::
  {:ok, FoPost.InboxDecision.t()} | {:error, FoPost.Error.t()}

Discards a drafted reply. id is the approval's integer id.

reject_reply!(client, id)

Same as reject_reply/2, but raises FoPost.Error.

reply(client, id, opts)

@spec reply(FoPost.Client.t(), String.t(), keyword()) ::
  {:ok, FoPost.InboxReplyResult.t()} | {:error, FoPost.Error.t()}

Sends a reply on the platform as the connected account. Required: :text.

reply!(client, id, opts)

Same as reply/3, but raises FoPost.Error.

threads(client, opts \\ [])

@spec threads(
  FoPost.Client.t(),
  keyword()
) :: {:ok, FoPost.Page.t()} | {:error, FoPost.Error.t()}

One page of threads: one row per post with comments, or with mentions when :kind is "mentions".

Filters: :workspace_id, :kind (comments, mentions), :platform, :account_id, :state, :q, :sort. Paging: :page, :per_page.

threads!(client, opts \\ [])

Same as threads/2, but raises FoPost.Error.

unhide(client, id)

@spec unhide(FoPost.Client.t(), String.t()) ::
  {:ok, FoPost.InboxItem.t()} | {:error, FoPost.Error.t()}

Shows a hidden comment again.

unhide!(client, id)

Same as unhide/2, but raises FoPost.Error.

unread_count(client, opts \\ [])

@spec unread_count(
  FoPost.Client.t(),
  keyword()
) :: {:ok, integer()} | {:error, FoPost.Error.t()}

How many items are unread, optionally narrowed with :workspace_id.

unread_count!(client, opts \\ [])

Same as unread_count/2, but raises FoPost.Error.

update(client, id, opts)

@spec update(FoPost.Client.t(), String.t(), keyword()) ::
  {:ok, FoPost.InboxItem.t()} | {:error, FoPost.Error.t()}

Sets an item's state. Required: :state (unread, read, resolved, snoozed); :snoozed_until goes with "snoozed" and accepts a DateTime or an ISO 8601 string.

update!(client, id, opts)

Same as update/3, but raises FoPost.Error.