{"id":677,"date":"2026-06-25T21:09:00","date_gmt":"2026-06-25T19:09:00","guid":{"rendered":"https:\/\/dufajn.pl\/?p=677"},"modified":"2026-06-25T11:53:48","modified_gmt":"2026-06-25T09:53:48","slug":"why-maintenance-testing-is-so-important-4-2-2-2-2-2-2-2-2-2","status":"publish","type":"post","link":"https:\/\/dufajn.pl\/?p=677","title":{"rendered":"How to add sound for the Postman app for macOS users"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">First of all, maybe the reason I&#8217;m doing this is because the company refused to implement such a feature inside Postman while spending their time on doing bizarre functions. What I need is a chime every time the tests are passing (status code is from group 2XX) after the request is sent. So first of all, create a Python file, name it sound.py, and paste the text below. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import os\nimport subprocess\nfrom http.server import BaseHTTPRequestHandler, HTTPServer\n\nclass SoundServer(BaseHTTPRequestHandler):\n    def do_GET(self):\n        # Odpowied\u017a dla Postmana, \u017ceby nie wisia\u0142 w niesko\u0144czono\u015b\u0107\n        self.send_response(200)\n        self.end_headers()\n        self.wfile.write(b\"OK\")\n\n        # \u015acie\u017cki do wbudowanych d\u017awi\u0119k\u00f3w systemowych macOS\n        if \"error\" in self.path:\n            # Niski buzzer (Basso)\n            sound_path = \"\/System\/Library\/Sounds\/Basso.aiff\"\n        else:\n            # Przyjemny chime (Glass)\n            sound_path = \"\/System\/Library\/Sounds\/Glass.aiff\"\n\n        # Popen odpala d\u017awi\u0119k w tle, dzi\u0119ki czemu serwer nie blokuje si\u0119 na czas jego trwania\n        subprocess.Popen(&#91;\"afplay\", sound_path])\n\nif __name__ == \"__main__\":\n    print(\"\ud83d\ude80 Serwer d\u017awi\u0119kowy Postmana dzia\u0142a na http:\/\/localhost:2137\")\n    print(\"Naci\u015bnij Ctrl+C w Terminalu, aby go wy\u0142\u0105czy\u0107.\")\n    try:\n        HTTPServer((\"localhost\", 2137), SoundServer).serve_forever()\n    except KeyboardInterrupt:\n        print(\"\\nZamykanie serwera.\")<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Run the file python3 sound.py this will set a server for sound notifications.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Then in Postman create a global variable <code>postman_odtworz_dzwiek<\/code> and set this value to true. Do not share the value with people that don&#8217;t have a script and the rest of the code! Then add the below code to your folder in the post-scripts section.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>if (pm.globals.get(\"postman_odtworz_dzwiek\") === \"true\") {<br>    const is2xxSuccess = pm.response.code >= 200 &amp;&amp; pm.response.code &lt; 300;<br><br>    const endpoint = is2xxSuccess ? \"success\" : \"error\";<br><br>    try {<br>        pm.sendRequest(`http:\/\/localhost:2137\/${endpoint}`);<br>    } catch (e) {<br>        console.log(\"Serwer d\u017awi\u0119kowy nie odpowiada. Upewnij si\u0119, \u017ce skrypt jest uruchomiony.\");<br>    }<br>}<br><br><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Send a couple of requests. Of course you can change which folders sound will be present in by moving the code.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>First of all, maybe the reason I&#8217;m doing this is because the company refused to implement such a feature inside<\/p>\n","protected":false},"author":3,"featured_media":680,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[39],"tags":[],"class_list":["post-677","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-testing"],"_links":{"self":[{"href":"https:\/\/dufajn.pl\/index.php?rest_route=\/wp\/v2\/posts\/677","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dufajn.pl\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dufajn.pl\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dufajn.pl\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/dufajn.pl\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=677"}],"version-history":[{"count":1,"href":"https:\/\/dufajn.pl\/index.php?rest_route=\/wp\/v2\/posts\/677\/revisions"}],"predecessor-version":[{"id":681,"href":"https:\/\/dufajn.pl\/index.php?rest_route=\/wp\/v2\/posts\/677\/revisions\/681"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dufajn.pl\/index.php?rest_route=\/wp\/v2\/media\/680"}],"wp:attachment":[{"href":"https:\/\/dufajn.pl\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=677"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dufajn.pl\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=677"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dufajn.pl\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=677"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}