Wardrik.Channels (wardrik v0.1.0-rc.1)

Copy Markdown

Installs Wardrik's chat apps into people's workspaces, from your app's own pages.

# 1. Send the person to the chat app
{:ok, url} = Wardrik.Channels.install_url(MyApp.AgentRuntime, "slack", "acme", return_to: "/settings")

# 2. When the chat app sends them back
{:ok, installation, next} = Wardrik.Channels.installed(MyApp.AgentRuntime, "slack", "acme", params)

# 3. To remove it
:ok = Wardrik.Channels.uninstall(MyApp.AgentRuntime, "slack", installation.workspace)

The channel's adapter, such as WardrikSlack, does the work. Returns an error if the adapter doesn't support it.

Summary

Functions

Returns the URL where someone acting for owner installs the channel name's chat app.

Completes an install from the chat app's callback query.

Uninstalls the channel name's chat app from workspace, and forgets the workspace.

Functions

install_url(instance, name, owner, opts \\ [])

@spec install_url(atom(), String.t(), String.t(), keyword()) ::
  {:ok, String.t()} | {:error, String.t()}

Returns the URL where someone acting for owner installs the channel name's chat app.

Options

  • :return_to - where they're sent once it's installed.

installed(instance, name, owner, query)

@spec installed(atom(), String.t(), String.t(), map()) ::
  {:ok, Wardrik.Channel.Installation.t(), String.t() | nil}
  | {:error, String.t()}

Completes an install from the chat app's callback query.

Returns the installation and where to send the person next.

uninstall(instance, name, workspace)

@spec uninstall(atom(), String.t(), String.t()) :: :ok | {:error, String.t()}

Uninstalls the channel name's chat app from workspace, and forgets the workspace.