Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Mention directly from jira to slack

Oana Barbulescu August 4, 2021

Hi, I am trying to automate Jira to mention users directly in Slack.

I used my Jira account for creating the API token (I am an admin).I'm using Python 3.9.6 and when running the sync.py script I found  here: https://community.atlassian.com/t5/Automation-articles/Mention-someone-directly-in-Slack-via-Jira-Automation/ba-p/1528605 

I get the following errors: 

INFO:root:Looking up 18 users in Jira server: https://chronosit.atlassian.net
Traceback (most recent call last):
File "C:\Users\Oana\slack_jira_sync\sync.py", line 225, in <module>
account_id = jira.get_user(email)
File "C:\Users\Oana\slack_jira_sync\sync.py", line 44, in wrapper
return func(*args, **kwargs)
File "C:\Users\Oana\slack_jira_sync\sync.py", line 137, in get_user
self._wrap_error("Failed to call search API.", response)
File "C:\Users\Oana\slack_jira_sync\sync.py", line 94, in _wrap_error
log.error("{} [{}] {}".format(error_message, response.status_code, response.json()))
File "C:\Users\Oana\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\models.py", line 910, in json
return complexjson.loads(self.text, **kwargs)
File "C:\Users\Oana\AppData\Local\Programs\Python\Python39\lib\json\__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "C:\Users\Oana\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\Oana\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

 

 

There must be somethig wrong I'm doing here .For the $APIKEY  I used the label from the token I have created.Is  this correct?

 

 Update : the value of the $APIKEY must be the value of the token created in Jira.Issue solved

1 answer

0 votes
Erin Quick-Laughlin August 4, 2021

I think I understand what you're asking?  If by label, you mean what you called the key, that shouldn't work.  You'll have to use the value that was generated and shown once. 

Also, I don't know if it applies to your situation, but sometimes I can use that API key as-is, other times I have to Base64 encode it.  I believe calling the REST API requires encoding it.

Oana Barbulescu August 6, 2021

Thanks, problem solved :)

Like Erin Quick-Laughlin likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events