crazymanish / fastlane-plugin-slack_bot

A Fastlane plugin to customize your automation workflow(s) with a Slack Bot πŸ€–πŸš€

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`file_upload_to_slack` returns `stream timeout`

ihnatmoisieiev opened this issue Β· comments

Hello,

I'm trying to post a message inside a thread to a previously uploaded file to the channel via file_upload_to_slack . Unfortunately, the result of file_upload_to_slack looks like this:

{:status=>nil, :body=>"stream timeout", :json=>{}}

and it's impossible to get a thread_ts to use it in post_to_slack.

Could you please suggest how to post a message inside the thread to a previously uploaded file via file_upload_to_slack ?

Thanks in advance.

hello,

Could you please suggest how to post a message inside the thread to a previously uploaded file via file_upload_to_slack ?

It seems, Slack does not allow it. For more details, please see the files.upload API


This is what i will suggest:

  • First, use the post_to_slack to send a message
  • Save the slack-thread-timestamp for further slack messages
  • Later, use the file_upload_to_slack to upload files inside the same slack-thread
  • or use the post_to_slack to send more message inside the same slack-thread
  lane :slack_thread_example_lane do
    channel_name = "#ios-team"

    # Start the release with slack release thread
    release_thread = post_to_slack(
      message: "Good morning team, CI has started the AppStore release. You can find more information inside this thread 🧡",
      channel: channel_name
    )
  
    # Important: Save this slack thread timestamp for futher slack messages
    release_thread_ts = release_thread[:json]["ts"]
  
   # gym # Build the app and create .ipa file
  
    # Post an update in release thread
    post_to_slack(
      message: "App has been build successfully! πŸ’ͺ",
      channel: channel_name,
      thread_ts: release_thread_ts
    )
  
   # deliver # Upload build to AppStore
  
    # Post an update in release thread
    post_to_slack(
      message: "App has been uploaded to the AppStore and submitted for Apple's review! πŸš€",
      channel: channel_name,
      thread_ts: release_thread_ts
    )
  
    # Spaceship logs file upload on Slack
    file_upload_to_slack(
      initial_comment: "Deliver:: Spaceship logs",
      file_path: "/Users/m.rathi/Desktop/demo_image.jpg",
      channels: channel_name,
      thread_ts: release_thread_ts
    )

    # Post an update in release thread
    post_to_slack(
      message: "Logs are shared in the slack thread!",
      channel: channel_name,
      thread_ts: release_thread_ts
    )
  end
  

Hello @crazymanish,
first of all thanks for your quick response and support!

What if I don't need first to post a message but I just looking to upload a file and leave a comment to this file inside a thread?
So what I would like to achieve:

  • use the file_upload_to_slack for uploading a file to the channel
  • save the slack-thread-timestamp
  • use the post_to_slack to send a message inside the slack-thread

Step 2 is impossible at the moment due to file_upload_to_slack returns:

{:status=>nil, :body=>"stream timeout", :json=>{}}

although the file is uploaded successfully to my channel.

Indeed, true!
As i mentioned above, Step2 is not possible because Slack does not return the timestamp when uploading a file.
For more details, please see the files.upload API