Public/Add-WebexMessage.ps1
<#
.SYNOPSIS Add-WebexMessage .DESCRIPTION This will send a Webex message to a user or room .EXAMPLE Add-WebexMessage PS :> Add-WebexMessage -token 'bottoken' -rooturl 'https://webexapis.com/v1/' -recipient_type 'Room' -recipient_value 'IdOfTheRoom' -message_type 'Text' - message_value 'Hello World' .PARAMETER token Add the api token to authenticate with the api .PARAMETER rooturl Add the root url of the api. https://webexapis.com/v1/ .PARAMETER recipient_type Add the recipient_type. "Room", "ParentMessage", "PersonId", "PersonEmail" are possible .PARAMETER recipient_value Add the id of recipient_type .PARAMETER message_type Add the message_type. "Text", "Markdown" are possible .PARAMETER message_value Add the text of the message. .NOTES Name: Add-WebexMessage Author: Clemens Richter DateCreated: 06.02.2021 .FUNCTIONALITY This will send a Webex message to a user or room #> function Add-WebexMessage { param ( [parameter(position = 0, mandatory = $true)] [ValidateNotNullOrEmpty()] [string]$token, [parameter(position = 1, mandatory = $true)] [ValidateNotNullOrEmpty()] [string]$rooturl, [parameter(position = 2, mandatory = $true)] [ValidateSet( "Room", "ParentMessage", "PersonId", "PersonEmail")] [string]$recipient_type, [parameter(position = 3, mandatory = $true)] [ValidateNotNullOrEmpty()] [string]$recipient_value, [parameter(position = 4, mandatory = $true)] [ValidateSet( "Text", "Markdown")] [string]$message_type, [parameter(position = 5, mandatory = $true)] [ValidateNotNullOrEmpty()] [string]$message_value ) [WebexApiHelperClass] $webexapicaller = [WebexApiHelperClass]::new($token, $rooturl) $output = $webexapicaller.CreateMessage([string]$recipient_type, [string]$recipient_value, [string]$message_type, [string]$message_value) return $output } |