Skip to content

Add CustomData parameter to New-PoshBotCardResponse #88

@scrthq

Description

@scrthq

Having a [Object]CustomData parameter available on New-PoshBotCardResponse would enable backend developers to receive fully formatted response data specific to their use case. Having it in a custom stream would allow two different backends to leverage the same plugin library as well, as built-in backends would skip the CustomData while the custom backend can only look at that CustomData.

Expected Behavior

  1. Plugin command returns something along the following:
$Fields = @{
    ProcName = $proc.Name
    PID = $proc.Id
    StartTime = $proc.StartTime.ToString("yyyy-MM-dd HH:mm:ss")
}
$customData = $Fields.Keys | ForEach-Object {
    $title = $_
    Add-GSChatKeyValue -TopLabel $title -Content $Fields[$title] -Icon CONFIRMATION_NUMBER_ICON
} | Add-GSChatCardSection -SectionHeader "Process Details" | Add-GSChatCard | Send-GSChatMessage -Text "Plex is running!" -BodyPassThru

New-PoshBotCardResponse -Text "Plex is running!" -Fields $fields -CustomData $customData
  1. Message received on each backend resolves to a Slack card via the Fields parameter and a Google Chat card. The Slack backend doesn't care about the extra formatted data, while the GChat backend I'm working on sees the CustomData property has content and parses that out, ignoring the Fields data.

Current Behavior

Custom data is only passable as serialized objects in the Text stream of SendMessage

Possible Solution

Pull request incoming soon, but it's really just adding that extra parameter to that function + docs

Context

Trying to build out the Google Chat backend, but the card formatting is a bit different than Slack or Teams.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions