Coder Social home page Coder Social logo

msftteams's Introduction

MSTeams Module

This module allows you to pass simple one-liner messages or hashtables of information to an Incoming Webhook configured in a channel within Microsoft Teams.

Known Quirks

  • Passing Hashtables doesn't like values which are an array Think this is due to having to convert to string for the JSON conversion

New-TeamsMessage

For posting messages to an Incoming Webhook within a Microsoft Teams channel.

Simple Message Use

New-TeamsMessage -Message 'test message for teams' -Color Red

Detailed Message Use

Passing Details information requires a hashtable of key / value pairs and can be created with the following

$info = [ordered]@{
    Enabled = $true
    givenname = 'Brett'
    emailaddress = '[email protected]'
    surname = 'Miller'
}
New-TeamsMessage -Title 'This A Test Post To Teams' -Text 'This is the Text on the card' -ActivityTitle 'This works pretty well' -ActivitySubtitle 'Formatting is pretty good too' -Information $info -Color Green

Splatting Parameters

$params = @{
    Title               = 'Title of the Connector Card'
    Text                = 'Text of the Connector Card'
    ActivityTitle       = 'Activity title of the card'
    ActivitySubtitle    = 'Activity Subtitle of the card'
    Facts               = $info
    color               = 'green'
    webhookuri          = $uri
}
New-TeamsMessage @params

Adding Buttons

As above but specify the Button Parameter using a ScriptBlock

New-TeamsMessage @params -Button {
    Button -ButtonType TextInput -ButtonName 'Leave a Comment' -TargetURI 'https://millerb.co.uk'
    Button -ButtonType DateInput -ButtonName 'Choose a Date' -TargetURI 'https://millerb.co.uk'
    Button -ButtonType HttpPost -ButtonName 'POST Stuff' -TargetURI 'https://millerb.co.uk'
    Button -ButtonType OpenURI -ButtonName 'Open Me :)' -TargetURI 'https://millerb.co.uk'
}

Adding images

Images can be added as an array of URI's

$params = @{
    Title               = 'Title of the Connector Card'
    Text                = 'Text of the Connector Card'
    ActivityTitle       = 'Activity title of the card'
    ActivitySubtitle    = 'Activity Subtitle of the card'
    Facts               = $info
    Image               = 'https://imagesource.co.uk/image.png','https://imagesource.co.uk/image2.png'
    color               = 'green'
    webhookuri          = $uri
}

New-TeamsMessage @params -Button {
    Button -ButtonType TextInput -ButtonName 'Leave a Comment' -TargetURI 'https://millerb.co.uk'
    Button -ButtonType DateInput -ButtonName 'Choose a Date' -TargetURI 'https://millerb.co.uk'
    Button -ButtonType HttpPost -ButtonName 'POST Stuff' -TargetURI 'https://millerb.co.uk'
    Button -ButtonType OpenURI -ButtonName 'Open Me :)' -TargetURI 'https://millerb.co.uk'
}

Card Sample

msftteams's People

Contributors

brettmillerb avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.