Hi everyone,
We managed to implement an automated system of a Slack bot creating a Slack thread and adding comments to the thread based on updates, using API REST: https://community.atlassian.com/t5/Jira-Software-questions/Connecting-Jira-and-Slack-in-a-way-that-Jira-ticket-updates-can/qaq-p/2572883?utm_source=atlcomm&utm_medium=email&utm_campaign=kudos_comment&utm_content=topic&emcs_t=S2h8ZW1haWx8a3Vkb3N8TFI5WFJCNjg5QkhJR0d8MjU3NzE2OHxLVURPU3xoSw
While the solution above works fantastic, our internal requirement has slightly changed in a way that we want to implement the following workflow:
I am currently stuck at implementing step 3; I would be grateful if someone could shine some light on how to make a Jira automation which takes a Slack thread link as an input, then returns {{webResponse.body.ts}} as an output. :)
Thanks in advance,
Bryan
@Bryan Kim , @Kalyan Sattaluri
Glad to see you guys :D
Let me see if I understand what you need:
What you want to do is the following:
- First of all, you will need another automation rule and for this new rule you need to ensure that you field slack thread record is filled before you're creating the issue. It means that the user who is creating the issue before click create he needs to fill the jira field with the thread :)
You'll be able to get your slack thread ID just access your thread and copy the link of any message inside the thread. You will see this value (image below)
Only these numbers inside thread_ts (including dot .) and before &cid are your thread number and you'll need to fill this value in your field before you create your Jira issue. You can use the same field earlier.
Assuming you're using the same field, you can just copy the automation who send the updates for the thread and then change your trigger in this copy to Issue created instead issue commented.
If the field to record your thread is already filled, then your message for the new issue will be published automatically in your created thread.
I'm not sure if the idea is to maintain the first automation of creating a thread when the issue is created, but if that's the case, I would say to put a condition on it of 'Slack App thread record' field IS EMPTY. This is because for issues that it identifies that the Slack Thread field is filled in, it will not create a new thread. If the field is not filled in, then it will create a new thread for the issue automatically.
Hope this helps. Let me know if you have questions.
Hi @Fernando Eugênio da Silva , great to see you again!
-> Yes, that is exactly what I am looking for. :)
That is amazing - I never thought of actually looking at the Slack thread link on its own. The idea is that the automation should never create a new/separate thread, instead, it should continue to write out progress update as thread comments in a given thread based on an input thread_ts. The purpose is to reduce the number of created Slack threads in a given channel, by making the automation continuously write comments in existing threads without creating new threads.
I will give this a try and let you know. Thank you so much for sharing your insights!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Fernando Eugênio da Silva I immediately have some questions:
A link for a Slack thread looks like this on our end, for example: https://___.slack.com/archives/___________/p1708992713265039. I noticed that the numbers after '/p' correspond to thread_ts, however, is missing a period somewhere in between.
It seems like I can only get the accurate thread_ts when I copy a link of a comment in the thread (and it looks exactly like the link in your screenshot).
For now I have created a Jira ticket field that contains the thread link shared above, and made an automation block to create a variable:
By doing the split operation, I am able to get the entire thread_ts digits without the period somewhere between the digits. Using smart value operations here, would it be possible to insert a period in the obtained smart value above to turn it into a proper thread_ts value? I noticed that thread_ts seems to contain a single period in front of the 6th digit from the last; in this case, the correct thread_ts would be 1708992713.265039. Do you know if this is a consistent behavior?
Thank you in advance!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey @Bryan Kim
This happens because https://___.slack.com/archives/___________/p1708992713265039
It's not exactly the thread ID, it's the ID of the published message. It's as if it were p for "Post" and the message ID. I also noticed that there is a dot . just before the final sixth digit, but I can't confirm if this is a pattern. In Slack's API documentation it appears to be a standard, but there is nothing explicit.
Therefore, I suggest that the link be copied from a message within the thread and not from the first message in the thread itself.
So you would have something like this: https://-_______.slack.com/archives/________/p1708992713265039?thread_ts=1708992713.265039&cid=_________
The value of 'p1708992713265039' will change the ID according to the published message, but if it is within the thread, the value of thread_ts= will always have the thread number with the dot
And finally, you can copy all the content to fill in your field: https://_________.slack.com/archives/________/p1708992713265039?thread_ts=1708992713.265039&cid=_________
In your automation use the following smartvalue to access only the thread_ts: {{issue.customfield_XXXX.substringBetween("=","&")}}
It works well and you will only have the value: 1708992713.265039
Hope this helps you :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Forgot to accept your comment as an answer, my apology for that.
It all worked out nicely, and our team members have been giving us positive feedback on the newly implemented automation. Once again, thank you so much.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Bryan Kim Never used slack and am using google to propose you below, so take everything I am saying with lump of salt.
But,
I think you need to set up an incoming webhook in your slack app which will post to your channel.
And then, after step 3, your Jira trigger is your new comment with "slack thread" and you call the webhook you set up earlier.
Please investigate this workflow.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kalyan,
Basically I need to retrieve the message ts value, based on a Slack thread link (https://____.slack.com/....), in order to use creation of a Jira ticket as a trigger to satisfy the workflow I mentioned. I will investigate the documentation for incoming webhooks regardless, but I am still all ears if anyone knows how to exactly achieve the workflow I mentioned.
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Bryan Kim
I am still missing how is step 1 being done. Is it being manually or is it automated?
Also, lets page @Fernando Eugênio da Silva to see if he can check this thread when he is online. Seems like its something he can shed some light on.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The conversation with Fernando gave me a good idea about how to implement what I was looking for. Thank you for bringing his attention to this post. :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.