mrkaye97 / slackr

An R package for sending messages from R to Slack
https://matthewrkaye.com/slackr/
Other
307 stars 83 forks source link

Precision on thread_ts for `slack::slackr()` #180

Closed davidski closed 1 year ago

davidski commented 1 year ago

Trying to use thread_ts to post a response to a slack-generated parent message, it looks like the response from slackr() contains a .$file$timestamp as an integer, while the (postMessage API)[https://api.slack.com/methods/chat.postMessage] has timestamp_ts with 4 decimals of precision. Supplying an integer as my thread_ts value doesn't seem to be sufficient to get replies to thread properly.

Double checking that I'm not misinterpreting how the thread_ts value should be retrieved/set before digging into the code on this.

mrkaye97 commented 1 year ago

Hey @davidski, thanks for putting this in. What version of slackr are you running? I think I might've fixed this in https://github.com/mrkaye97/slackr/pull/174/files#diff-541ec58513b76ed3c75296b18862b5ade6fbac59cec714bef1d80e6abecf5de6R120 but let me know if you're on that version - if you are, I'll poke around and try to repro

davidski commented 1 year ago

Hiya! I pulled from HEAD via pak, so v3.2.1 is what I'm running right now. If you get stumped (or stumped for time), let me know and I'll try to figure out as well -- I kind of want to hack in multiple file attachment support anyways... :smile:

mrkaye97 commented 1 year ago

alright @davidski, sorry for just getting back to this! I have it working on my end, and I think I can repro. Here's how I did it, which worked:

response <- slackr("foo")

slackr(
  "bar",
  thread_ts = response$ts
)

## example TS:
> response$ts
[1] "1671583856.880759"

however this does not work:

slackr(
    "foobar",
    thread_ts = as.integer(response$ts)
)

## Integerized TS
> as.integer(response$ts)
[1] 1671583856

On that second one, the message seemingly just disappears into the void.

Does that help you at all? Sorry again for taking so long to get back to you -- been a busy couple weeks

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

davidski commented 1 year ago

Sorry this has dropped off my radar for so long. Testing this out today -- Yes, using the character version of the ts from a slackr() response works for threading! 🎉 Thanks for the help!