Facebook.publish

You're seeing just the function publish, go back to Facebook module for more information.
Link to this function

publish(edge, parent_id, params, access_token)

View Source

Specs

publish(edge :: atom(), parent_id :: String.t(), params(), access_token()) ::
  resp()

Publish to a graph edge using the supplied token. Publish to a feed. Author (user or page) is determined from the supplied token.

The page_id/0 is the id for the user or page feed to publish to. Apps need both manage_pages and publish_pages permissions to be able to publish as a Page. The publish_actions permission is required to publish as an individual.

See Facebook's publishing documentation for more info:

Examples

iex> # publish a message
iex> Facebook.publish(:feed, "<Feed Id>", [message: "<Message Body"], "<Access Token>")
{:ok, %{"id" => "{page_id}_{post_id}"}}

iex> # publish a link and message
iex> Facebook.publish(:feed, "<Feed Id>", [message: "<Message Body", link: "www.example.com"], "<Access Token>")
{:ok, %{"id" => "{page_id}_{post_id}"}}

iex> # create a Facebook Campaign
iex> Facebook.publish(:campaigns, "act_1234546", [objective: "LINK_CLICKS", name: "a campaign"], "<Access Token>")
{:ok, %{"id" => "{campaign_id}"}}
Link to this function

publish(atom, page_id, file_path, params, access_token)

View Source

Specs

publish(:photo, page_id(), file_path(), params(), access_token()) :: resp()

Publish media to a feed. Author (user or page) is determined from the supplied token.

The page_id/0 is the id for the user or page feed to publish to. Same :feed publishing permissions apply.

Example

iex> Facebook.publish(:photo, "<Feed Id>", "<Image Path>", [], "<Access Token>")
{:ok, %{"id" => photo_id, "post_id" => "{page_id}_{post_id}"}

iex> Facebook.publish(:video, "<Feed Id>", "<Video Path>", [], "<Access Token>")
{:ok, %{"id" => video_id}

See: https://developers.facebook.com/docs/pages/publishing#fotos_videos

Link to this function

publish(atom, page_id, file_path, params, access_token, options \\ [])

View Source

Specs

publish(
  :video,
  page_id(),
  file_path(),
  params(),
  access_token(),
  options :: list()
) :: resp()