Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

What to write an automation to add sender to blocklist for emailed spam.

awere
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 15, 2025

Essentially, spammers are everywhere, and I don't want to have to give all our guys Admin to the project in order to add a sender to the blocklist, has anyone figured out how to run a manual automation that adds the sender to the blocklist for the project?

 

I'm thinking the Send web request and 

https://developer.atlassian.com/cloud/jira/service-desk/basic-auth-for-rest-apis/ with ?? Something, there should be an api call we can make to add a domain or email to the blocklist, right?

1 answer

2 votes
Darryl Lee
Community Champion
January 15, 2025

Hey, that's a cool idea. Unfortunately the API for adding domains/emails to the blocklist is not public, but hey, that's what Chrome's Developer Tools is for!


DISCLAIMER

Use of Unofficial and Undocumented APIs is NOT RECOMMENDED for any production tasks or Automations. This information is strictly for informational, and possible one-time uses/runs/migrations etc. because they are inherently fragile and may break if Atlassian changes the API.

(On the other hand, it’ll probably be fine.)


So yeah, sniffing around while trying to add an address to my project's blocklist, I found this endpoint:

https://YOURSITE.atlassian.net/rest/jira-email-processor-plugin/1.0/mail/blocklist/create

And the payload is thankfully short and sweet:

{
  "projects": [
    {
      "projectId": "10012",
      "creates": [
        {
          "blockString": "spammer@ihatespammers.ugh",
          "isDomain": false
        }
      ]
    }
  ]
}

You'll want to refer to this documentation on how to set up Authorization headers and you definitely will need a content-type header of application/json:

Since the API Token will need to be for a user who has Administrative privileges, once you're sure things are working, you'll want to make sure you make the Authorization header hidden, and for good measure also make sure the editors for the rule is restricted.

Darryl Lee
Community Champion
January 15, 2025

To get your project's ID, you can load this up in a web browser:

https://YOURSITE.atlassian.net/rest/api/latest/project/YOURPROJECTKEY

(Where YOURPROJECTKEY = HELP/TECH/BUGS whatever prefixes your issue IDs like HELP-123, TECH-234, or BUGS-345.)

ID will be up at the top after "id": 

Like Dave Liao likes this
Darryl Lee
Community Champion
January 15, 2025

One last note about the unnofficial nature of this API endpoint.

The same path is "unofficially" documented by Atlassian here for Server/DC: 

And here for Cloud with Automation:

Like Dave Liao likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events