Class: Nuntius::TeamsTeamsProvider

Inherits:
BaseProvider show all
Defined in:
app/providers/nuntius/teams_teams_provider.rb

Instance Attribute Summary

Attributes inherited from BaseProvider

#message

Instance Method Summary collapse

Methods inherited from BaseProvider

all_settings, #callback, class_from_name, #initialize, #name, #refresh, setting_reader, states, transport

Constructor Details

This class inherits a constructor from Nuntius::BaseProvider

Instance Method Details

#deliverObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/providers/nuntius/teams_teams_provider.rb', line 7

def deliver
  # NOTE: Attachments are not supported
  # https://adaptivecards.io/designer/
  # https://learn.microsoft.com/en-us/power-automate/overview-adaptive-cards
  # https://learn.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/add-incoming-webhook?tabs=newteams%2Cdotnet

  args = (message.payload || {}).merge(text: message.text)
  response = Faraday.post(message[:to], JSON.dump(args), {"Content-Type": "application/json"})

  message.status = if response.status == 200
    "sent"
  else
    "undelivered"
  end

  message
end