添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Create
cancel
Showing results for
Search instead for
Sign up Log in

@Daniel Eads Thank you for sharing this workaround, i am trying to apply it on my side and i think i am missing something that would be great if i can get your help with if possible.

when running the below command, i am getting this error...any idea what went wrong here or probably what have i missed?

File "sync.py", line 12, in <module>

import requests

ModuleNotFoundError: No module named 'requests'

python3 sync.py --slack_token $SLACK_TOKEN --jira_url $JIRA_URL --username $USERNAME --apikey $APIKEY

Thank you!

@armcaelria Just for future reference for you or anyone else, you can iterate through a list of users and print them all using the join smart value function.  For instance, making a list of all of the approvers for a card:

<@{{issue.Approvers.properties.metadata.slack_id.join(">, <@")}}>


Everything inside of the quotes of join("") will be used between each entry.  Since each mention must be formatted as @<userid> you have to end each with > and <@ .  Between those you can add any delimiter you want, in this case I used a comma.  See here for more list manipulations available in smart values: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-lists/

Hi @Daniel Eads

I'm getting the following error running the script. Can someone help?


ERROR:slack.web.base_client:Failed to send a request to Slack API server: IncompleteRead(42224 bytes read)

Traceback (most recent call last):

  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/http/client.py", line 552, in _get_chunk_left

    chunk_left = self._read_next_chunk_size()

  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/http/client.py", line 519, in _read_next_chunk_size

    return int(line, 16)

ValueError: invalid literal for int() with base 16: b''

 

During handling of the above exception, another exception occurred:

 

Traceback (most recent call last):

  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/http/client.py", line 569, in _readall_chunked

    chunk_left = self._get_chunk_left()

  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/http/client.py", line 554, in _get_chunk_left

    raise IncompleteRead(b'')

http.client.IncompleteRead: IncompleteRead(0 bytes read)

 

During handling of the above exception, another exception occurred:

 

Traceback (most recent call last):

  File "sync.py", line 209, in <module>

    slack_users = gather_slack_details(slack_client)

  File "sync.py", line 78, in gather_slack_details

    next_active_users, next_cursor = _get_active_users(client, next_cursor)

  File "sync.py", line 44, in wrapper

    return func(*args, **kwargs)

  File "sync.py", line 66, in _get_active_users

    response = client.users_list(limit=SLACK_PAGINATION_LIMIT, cursor=next_cursor)

  File "/Users/clariar/Library/Python/3.8/lib/python/site-packages/slack/web/client.py", line 2210, in users_list

    return self.api_call("users.list", http_verb="GET", params=kwargs)

  File "/Users/clariar/Library/Python/3.8/lib/python/site-packages/slack/web/base_client.py", line 150, in api_call

    return self._sync_send(api_url=api_url, req_args=req_args)

  File "/Users/clariar/Library/Python/3.8/lib/python/site-packages/slack/web/base_client.py", line 241, in _sync_send

    return self._urllib_api_call(

  File "/Users/clariar/Library/Python/3.8/lib/python/site-packages/slack/web/base_client.py", line 352, in _urllib_api_call

    response = self._perform_urllib_http_request(url=url, args=request_args)

  File "/Users/clariar/Library/Python/3.8/lib/python/site-packages/slack/web/base_client.py", line 495, in _perform_urllib_http_request

    raise err

  File "/Users/clariar/Library/Python/3.8/lib/python/site-packages/slack/web/base_client.py", line 479, in _perform_urllib_http_request

    body: str = resp.read().decode(charset)  # read the response body here

  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/http/client.py", line 462, in read

    return self._readall_chunked()

  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/http/client.py", line 576, in _readall_chunked

    raise IncompleteRead(b''.join(value))

http.client.IncompleteRead: IncompleteRead(42224 bytes re 

Hey, @Daniel Eads ... I have an odd scenario.  I have followed the above instructions and everything seems to be working for nearly everyone... but not everyone.  I have 1-2 people who apparently do not have Slack IDs; when automation attempts to send them messages, I get a 404 channel not found error.  When I attempt to display their IDs, it's blank.  This is what I have in the channel or user field:

@{{issue.assignee.properties.metadata.slack_id}}

Is there some way to inspect the Slack IDs via JQL or some other method?  Alternatively, is there some way to inspect and update the Slack IDs?

Please advise... and thanks in advance!

Hello, @Daniel Eads I ran this using our Jira Sandbox as the Jira URL. The automation located all 589 Slack Members but returned the "No User Found for Email" error for every one of our users. I can visually verify that the emails addresses being located in Slack are identical to the email addresses in JIRA.

Would the fact that I ran this to the Sandbox cause any issue?

Thank you,

Richard Hausen

Hi @Daniel Eads , thank you for developing a great tool.
I have a very sad report to make. This tool has stopped working in my environment since November. This tool worked great for a little over a year.

error message -------
slack.errors.SlackApiError: The request to the Slack API failed.
The server responded with: {'ok': False, 'error': 'ratelimited'}
------------------------

I am happy, if this tool support Slack's rate limit.

@Daniel Eads Tony Sammak

I am getting the following error on running this script "sync.py" with Python 3.8.2



Traceback (most recent call last):

File "sync.py", line 12, in <module>

import sync

File "/Users/ashish/Downloads/atlassian_slack/sync.py", line 13, in <module>

import requests

ModuleNotFoundError: No module named 'requests'



Please help me!

Hi. I have this working for the most part, but 2 questions.

1. This is working for mentioning the Assignee on the ticket in the Slack channel "issue.assignee.properties.metadata.slack_id", but what is the format of mentioning the person or people in the "Requested Participants" field on the ticket? "issue.requested.participants.properties.metadata.slack_id"??

2. All my users from slack have sync'd with Jira users from the script. How do I mention a specific user in an automation? Not a user pulled from a certain field. For example @JaneDoe for every new ticket created.

Thanks!

Hey @Darla Sheehan , How's going?

  1. As the field 'Requested Participants' is a list, you need to specify which member of this list you want to mention. If you intend to mention everyone who is listed in this field, you can iterate through the list using the code below, it will print out one mention per line.
    {{#issue.Request participants.properties.metadata.slack_id}} <@{{.}}>{{^last}},{{/}} {{/}}


    Or use the same code provided by @Caleb Eno in the previous comments, but changing Approvers to 'Request participants' like this
    <@{{issue.Request participants.properties.metadata.slack_id.join(">, <@")}}>

    image.png
  2. You can't modify a user's properties unless you have the user as the assignee or in any field of the issue. However, if you want to go the extra mile and retrieve data from the user, you can overengineer it by making an HTTP request to pull the required information, but it is dull. Its easier the user configs his slack account to notify him everytime some keyword appears, like project key or something.

    image.png

Hi @Daniel Eads

Appreciate you putting this together. I have completed all the steps and run the python script which seemed run without issue (~1590 users were updated)

Unfortunately I am still having issues with the ability to mention specific users.

Here is my automation:

Auto.jpg

And this the the output

Any chance you could have a look?

Result.jpg

@Jeremy Jones Have you tried to check if the propertie is really in this user? It seems like it's empty.

You can try send a Get request using this code bellow,

curl --request GET \ 
--url 'https://your-domain.atlassian.net/rest/api/3/user/properties/metadata?accountId=5b10ac8d82e05b22cc7d4ef5' \
--user 'email@example.com:<api_token>' \
--header 'Accept: application/json'

You need to have access to Eric Yang's account ID in order to substitute it in the code

Hi @Jeremy Jones ,

I actually had this exact same issue for just a few users. Atlassian support was very helpful and was able to see that the user(s) in question all had something in common.

In my case, it was because the user(s) (with the issue) had duplicated accounts, both portal-only and atlassian accounts, and since there are 2 accounts with the same email it can confuse Jira and get the information from one of the accounts.
The fix for that would be migrating the portal-only account and merging it to the user Atlassian account, you can do that by going to the https://admin.atlassian.com/ , Jira Service Management - Portal Only Custimers - and searching for that user. C lick on the three-dot icon had then on migrate it to Atlassian account.

After that, I believe that you will have to run the script again to resync the slack users with the Jira users.

Worth a shot... portal customers.png