Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support tor thread_ts in send-slackfile and send-slackmessage #100

Open
atartareanu opened this issue Dec 6, 2019 · 3 comments
Open

support tor thread_ts in send-slackfile and send-slackmessage #100

atartareanu opened this issue Dec 6, 2019 · 3 comments

Comments

@atartareanu
Copy link

send-slackfile and send-slackmessage should support threads

send-slackfile should be modified as follows:

...

    [parameter(ParameterSetName = 'Content')]
    [string]$FileType,

    [string[]]$Channel,
    [string]$thread_ts,
    [string]$FileName,
    [String]$Title,
    [String]$Comment,

...
process
{
if ($Content) {
$body = @{}
switch ($psboundparameters.keys) {
'Content' {$body.content = $content}
'Channel' {$body.channels = $Channel -join ", " }
'thread_ts' {$body.thread_ts = $thread_ts}
'FileName' {$body.filename = $FileName}
'Title' {$body.Title = $Title}
'Comment' {$body.initial_comment = $Comment}
'FileType' {$body.filetype = $FileType}
}
...
switch ($psboundparameters.keys) {
'Channel' {$bodyLines +=
("--$boundary$LF" +
"Content-Disposition: form-data; name="channels"$LF" +
"Content-Type: multipart/form-data$LF$LF" +
($Channel -join ", ") + $LF)}

            'thread_ts'    {$bodyLines +=
                            ("--$boundary$LF" +
                            "Content-Disposition: form-data; name=`"thread_ts`"$LF" +
                            "Content-Type: multipart/form-data$LF$LF" +
                            "$thread_ts$LF")}
            
            'FileName'    {$bodyLines +=
                            ("--$boundary$LF" +
                            "Content-Disposition: form-data; name=`"filename`"$LF" +
                            "Content-Type: multipart/form-data$LF$LF" +
                            "$FileName$LF")}

send-slackmessage
...
$Username,

    [parameter(ParameterSetName = 'Param',
               ValueFromPipelineByPropertyName = $True)]
    $thread_ts,

    [parameter(ParameterSetName = 'Param',
               ValueFromPipelineByPropertyName = $True)]
    $IconUrl,

    [parameter(ParameterSetName = 'Param',
               ValueFromPipelineByPropertyName = $True)]
    $IconEmoji,

...
if($PSCmdlet.ParameterSetName -eq 'Param')
{
$body = @{ }

        switch ($psboundparameters.keys)
        {
            'channel'     {$body.channel = $channel }
            'text'        {$body.text     = $text}
            'username'    {$body.username = $username}
            'thread_ts'   {$body.thread_ts = $thread_ts}
            'asuser'      {$body.as_user = $AsUser}
            'iconurl'     {$body.icon_url = $iconurl}
            'iconemoji'   {$body.icon_emoji   = $iconemoji}
            'linknames'   {$body.link_names = 1}
            'parse'       {$body.parse = $Parse}
            'UnfurlLinks' {$body.unfurl_links = $UnfurlLinks}
            'UnfurlMedia' {$body.unfurl_media = $UnfurlMedia}
            'attachments' {$body.attachments = $Attachments}
        }
        $Messages += $Body

....

@rvigliotti-sf
Copy link

@atartareanu I was looking for this as well. Would you be able to submit a PR request since you have the code already figured out? CC @RamblingCookieMonster

@joshcorr
Copy link
Contributor

joshcorr commented Jun 5, 2021

As of 2/21 it looks like the thread_ts has been removed from channels.replies, but has been replaced in the conversations.replies with just ts.

@joshcorr
Copy link
Contributor

joshcorr commented Jul 1, 2021

@rvigliotti-sf and @atartareanu this should know be in version 1.0.6 of the module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants