|
| 1 | +# Teams Connector |
| 2 | + |
| 3 | +Welcome to Teams Connector. This gem allows you to easily send messages from your ruby project to Microsoft Teams channels. |
| 4 | +It integrates in your rails project, when you are using bundler or even in plain ruby projects. |
| 5 | + |
| 6 | +The messages can be send synchronous or asynchronous with [Sidekiq](https://github.com/mperham/sidekiq). |
| 7 | + |
| 8 | +## Installation |
| 9 | + |
| 10 | +Add this line to your application's Gemfile: |
| 11 | + |
| 12 | +```ruby |
| 13 | +gem 'teams_connector' |
| 14 | +``` |
| 15 | + |
| 16 | +And then execute: |
| 17 | + |
| 18 | + $ bundle |
| 19 | + |
| 20 | +Or install it yourself as: |
| 21 | + |
| 22 | + $ gem install teams_connector |
| 23 | + |
| 24 | +## Usage |
| 25 | +After setting up the Incoming Webhook Connector four your Microsoft Teams channel, it is as simple as configuring the channel and creating a new `TeamsConnector::Notification`. |
| 26 | + |
| 27 | +```ruby |
| 28 | +# Configuration |
| 29 | +TeamsConnector.configure do |config| |
| 30 | + config.channel :channel_id, "https://<YOUR COMPLETE WEBHOOK URL GOES HERE>" |
| 31 | +end |
| 32 | + |
| 33 | +# Send a test card to your channel |
| 34 | +TeamsConnector::Notification.new(:test_card, :channel_id).deliver_later |
| 35 | + |
| 36 | +# Send a card with a list of facts |
| 37 | +content = { |
| 38 | + title: "Teams Connector Readme", |
| 39 | + subtitle: "A list of facts", |
| 40 | + facts: { |
| 41 | + "Usage": "Testing the facts Card" |
| 42 | + } |
| 43 | +} |
| 44 | +TeamsConnector::Notification::Message.new(:facts_card, "This is a summary", content).deliver_later |
| 45 | +``` |
| 46 | +This gem provides some basic templates in its default template path. You can also define your own templates in your own path. The default templates will be still available so you can mix and match. |
| 47 | + |
| 48 | +### Default templates |
| 49 | + |
| 50 | +Template name | Description |
| 51 | +-----|------- |
| 52 | +:test_card | A simple text message without any configurable content for testing |
| 53 | +:facts_card | A card with title, subtitle and a list of facts |
| 54 | + |
| 55 | +## Development |
| 56 | + |
| 57 | +After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. |
| 58 | + |
| 59 | +To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org). |
| 60 | + |
| 61 | +## Contributing |
| 62 | + |
| 63 | +Bug reports and pull requests are welcome on GitHub at https://github.com/qurasoft/teams_connector. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct. |
| 64 | + |
| 65 | +## License |
| 66 | + |
| 67 | +The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT). |
0 commit comments