ExMicrosoftTeams (ex_microsoft_teams v0.1.2)

Under the hood, the ExMicrosoftTeams module just uses ExMicrosoftTeams.Base (as described in the documentation for ExMicrosoftTeams.Base) without overriding any default function.

Link to this section Summary

Functions

Dynamically build client from a incoming webhook_url.

Send a message to a specific channel accordingly the client

Send a message to a specific channel accordingly the webhook_url

Link to this section Functions

Link to this function

client(webhook_url)

Dynamically build client from a incoming webhook_url.

examples

Examples

iex> ExMicrosoftTeams.client("https://acme.webhook.office.com/webhookb2/abc/IncomingWebhook/123/456") %Tesla.Client{

 fun: nil,
 pre: [
   {Tesla.Middleware.BaseUrl, :call,
    ["https://acme.webhook.office.com/webhookb2/abc/IncomingWebhook/123/456"]},
   {Tesla.Middleware.Headers, :call, [[{"Content-Type", "application/json"}]]},
   {Tesla.Middleware.JSON, :call,
    [[engine: Jason, engine_opts: [keys: :atoms]]]}
 ],
 post: [],
 adapter: nil

}

Link to this function

notify(client, message)

@spec notify(ExMicrosoftTeams.Base.client(), String.t()) ::
  {:ok, String.t()} | {:error, String.t()}

Send a message to a specific channel accordingly the client

examples

Examples

iex> client = ExMicrosoftTeams.client("https://acme.webhook.office.com/webhookb2/abc/IncomingWebhook/123/456") iex> ExMicrosoftTeams.notify(client, "Hello World!")

Link to this function

send_message(webhook_url, message)

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

Send a message to a specific channel accordingly the webhook_url

examples

Examples

iex> ExMicrosoftTeams.send_message("https://acme.webhook.office.com/webhookb2/abc/IncomingWebhook/123/456", "Hello World!!")
{:ok, "1"}