{"id":21564615,"url":"https://github.com/gabrielpedepera/ex_microsoft_teams","last_synced_at":"2025-03-18T05:16:27.362Z","repository":{"id":63690665,"uuid":"569922662","full_name":"gabrielpedepera/ex_microsoft_teams","owner":"gabrielpedepera","description":"Elixir library for integration with Microsoft Teams Incoming Webhook.","archived":false,"fork":false,"pushed_at":"2022-12-18T21:09:39.000Z","size":27,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-24T11:44:34.573Z","etag":null,"topics":["elixir","elixir-library"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gabrielpedepera.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-11-23T23:38:25.000Z","updated_at":"2024-02-04T22:09:26.000Z","dependencies_parsed_at":"2023-01-29T20:00:59.452Z","dependency_job_id":null,"html_url":"https://github.com/gabrielpedepera/ex_microsoft_teams","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabrielpedepera%2Fex_microsoft_teams","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabrielpedepera%2Fex_microsoft_teams/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabrielpedepera%2Fex_microsoft_teams/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabrielpedepera%2Fex_microsoft_teams/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gabrielpedepera","download_url":"https://codeload.github.com/gabrielpedepera/ex_microsoft_teams/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244160053,"owners_count":20408021,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["elixir","elixir-library"],"created_at":"2024-11-24T10:16:34.730Z","updated_at":"2025-03-18T05:16:27.333Z","avatar_url":"https://github.com/gabrielpedepera.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ex_microsoft_teams\n\nElixir library for integration with Microsoft Teams Incoming Webhook.\n\n\u003e We hope that the use of this library could be enjoyable despite the fact of dealing with Microsoft Teams.\n  \n## Installation\n\nIf [available in Hex](https://hex.pm/docs/publish), the package can be installed\nby adding `ex_microsoft_teams` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:ex_microsoft_teams, \"~\u003e 0.1.0\"}\n  ]\nend\n```\n\n## Usage\n\n### Create a webhook in Microsoft Teams\n\n    1. Navigate to the channel where you want to add the webhook and select (•••) Connectors from the top navigation bar.\n    2. Search for Incoming Webhook, and add it.\n    3. Click Configure and provide a name for your webhook.\n    4. Copy the URL which appears and click \"OK\".\n\n### Sending a message\n\n```elixir\nwebhook_url = \"https://acme.webhook.office.com/webhookb2/abc/IncomingWebhook/123/456\" \nmessage = \"Hello World!!\"\nExMicrosoftTeams.send_message(webhook_url, message)\n=\u003e {:ok, \"Message sent!\"}\n```\nor\n\n```elixir\n\"https://acme.webhook.office.com/webhookb2/abc/IncomingWebhook/123/456\" \n|\u003e ExMicrosoftTeams.client()\n|\u003e ExMicrosoftTeams.notify(\"Hello World!!\")\n=\u003e {:ok, \"Message sent!\"}\n```\n\n## Testing\n\n### Using [Mox](https://github.com/dashbitco/mox)\n\n```elixir\n# config/config.exs \nconfig :my_app, :microsoft_teams_client, ExMicrosoftTeams\n```\n\n```elixir\n# microsoft_teams_client.ex, the main context we chose to call this function from\ndefmodule MicrosoftTeamsClient do\n  def send_message(message) do\n    microsoft_teams_client().send_message(webhook_url(), message)\n  end\n\n  defp webhook_url, do: \"https://acme.webhook.office.com/webhookb2/abc/IncomingWebhook/123/456\"\n\n  defp microsoft_teams_client do\n    Application.compile_env(:my_app, :microsoft_teams_client)\n  end\nend\n```\n\n```elixir\n# In your test/test_helper.exs\nMox.defmock(ExMicrosoftTeamsMock, for: ExMicrosoftTeams.Base) # \u003c- Add this\nApplication.put_env(:my_app, :microsoft_teams_client, ExMicrosoftTeamsMock) # \u003c- Add this\n\nExUnit.start()\n```\n\n```elixir\n# test/microsoft_teams_client_test.exs\ndefmodule MicrosoftTeamsClientTest do\n  use ExUnit.Case\n\n  import Mox\n\n  setup :verify_on_exit!\n\n  describe \"send_message/1\" do\n    test \"send message with the correct webhook_url and message\" do\n      expect(ExMicrosoftTeamsMock, :send_message, fn webhook_url, message -\u003e\n        # here we can assert on the arguments that get passed to the function\n        assert webhook_url == \"https://acme.webhook.office.com/webhookb2/abc/IncomingWebhook/123/456\"\n        assert message == \"Hello World!\"\n\n        # here we decide what the mock returns\n        {:ok, \"Message sent!\"}\n      end)\n\n      assert {:ok, _} = ExMicrosoftTeams.send_message(\"Hello World!\")\n    end\n  end\nend\n```\n\nDocumentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)\nand published on [HexDocs](https://hexdocs.pm). Once published, the docs can\nbe found at \u003chttps://hexdocs.pm/ex_microsoft_teams\u003e.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgabrielpedepera%2Fex_microsoft_teams","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgabrielpedepera%2Fex_microsoft_teams","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgabrielpedepera%2Fex_microsoft_teams/lists"}