I tried using the various inviter solutions, but t...
# maintainers
m
I tried using the various inviter solutions, but they all rely on legacy API tokens which we no longer have. Admin APIs are only available to enterprise customers. So we’re stuck with this for now
j
Can we configure a quarterly cron job over on GitHub to renew this automatically?
m
So, https://slack.pact.io/ is actually an HTML page in our OSS amazon account
It’s a nice shortcut and is littered everywhere, so ideally we can keep that. It currently simply redirects to an invite URL.
But in general, automating it makes sense. Unfortunately, the invite API is an API only available to enterprise users. You need to manually create an invite link like this:
…which creates a link like this: https://join.slack.com/t/pact-foundation/shared_invite/zt-2h7ovnj5x-VD82RSfK68jseNXTQ_KTdA If you curl slack.pact.io, it’s the same URL. Once it expires, it creates a new one.
There’s probably a way to reverse engineer that URL and detect once it changes, which is when you could apply the update
Any thoughts?
j
If Slack implemented that share functionality nicely, there might be a nice overlap period, so we may never need to detect when it changes, and instead just have a weekly (or so) cron job that updates that redirect page
assuming there can be two concurrent share links that are valid
m
yes, but not from the same user it seems (so we could alternate). I managed to get the network (via enabling developer settings and usinsg the chrome dev tools):
Copy code
curl '<https://pact-foundation.slack.com/api/users.sharedInvites.list?_x_id=5c288879-1713761600.107&_x_csid=GsiLVTc50vo&slack_route=T5F60FXSQ&_x_version_ts=1713740845&_x_frontend_build_type=current&_x_desktop_ia=4&_x_gantry=true&fp=0c>' \
  -H 'authority: pact-foundation.slack.com' \
  -H 'accept: */*' \
  -H 'accept-language: en-GB' \
  -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundarycJNsxcGAVeyxgwjH' \
  -H 'cookie: b=.f545c729a8a9b2e3b0faf295182ddd53; ssb_instance_id=3798c14f-b087-434e-b267-14574690f95a; tz=600; web_cache_last_updated343081cc5653590830c3818f6821f2c2=1713396725114; web_cache_last_updated2c46ce20eb394510ce2a5c7beb691b8b=1713402759113; web_cache_last_updatedac29e4dd4cb4a029722e4ffc39224b31=1713751646611; web_cache_last_updated08de5c8e01d4e938aa21c2b2ad354a22=1713755599586; d=xoxd-dlXpa2t6nps%2FouorucQSLH8WhMVCEuFnCCiFjuph7To%2BqWk9vZbkkDouvjgE%2BjcLG%2F%2B%2BMp6lUccmEJPBYq1DDn0J7V0W3uS90W1RN7KXMXu9X5fk6FsqPIR9SQr2d57nilCVen097Pumdb1Xrz5Oam1oSWH6Df5R6PVYQ7oedLWCyS%2FweMA1HC7fBjTBLLpAgV89k3lztA%3D%3D; d-s=1713761501; x=f545c729a8a9b2e3b0faf295182ddd53.1713761502' \
  -H 'origin: <https://app.slack.com>' \
  -H 'sec-ch-ua: "Not(A:Brand";v="24", "Chromium";v="122"' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'sec-ch-ua-platform: "macOS"' \
  -H 'sec-fetch-dest: empty' \
  -H 'sec-fetch-mode: cors' \
  -H 'sec-fetch-site: same-site' \
  -H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 14_4_1) AppleWebKit/537.36 (KHTML, like Gecko) Slack/4.37.94 Chrome/122.0.6261.129 Electron/29.1.4 Safari/537.36 AppleSilicon Sonic Slack_SSB/4.37.94' \
  --data-raw $'------WebKitFormBoundarycJNsxcGAVeyxgwjH\r\nContent-Disposition: form-data; name="token"\r\n\r\nREDACTED\r\n------WebKitFormBoundarycJNsxcGAVeyxgwjH\r\nContent-Disposition: form-data; name="mode"\r\n\r\nlast_active_for_user\r\n------WebKitFormBoundarycJNsxcGAVeyxgwjH\r\nContent-Disposition: form-data; name="team_id"\r\n\r\nT5F60FXSQ\r\n------WebKitFormBoundarycJNsxcGAVeyxgwjH\r\nContent-Disposition: form-data; name="_x_reason"\r\n\r\nlist_shared_invites\r\n------WebKitFormBoundarycJNsxcGAVeyxgwjH\r\nContent-Disposition: form-data; name="_x_mode"\r\n\r\nonline\r\n------WebKitFormBoundarycJNsxcGAVeyxgwjH\r\nContent-Disposition: form-data; name="_x_sonic"\r\n\r\ntrue\r\n------WebKitFormBoundarycJNsxcGAVeyxgwjH\r\nContent-Disposition: form-data; name="_x_app_name"\r\n\r\nclient\r\n------WebKitFormBoundarycJNsxcGAVeyxgwjH--\r\n'
The output is:
Copy code
{
  "ok": true,
  "invites": [
    {
      "inviter_id": "U9UUY3CU9",
      "date_create": 1713564109,
      "date_delete": 0,
      "date_expire": 33249761012,
      "code": "zt-2h7ovnj5x-VD82RSfK68jseNXTQ_KTdA",
      "url": "<https://join.slack.com/t/pact-foundation/shared_invite/zt-2h7ovnj5x-VD82RSfK68jseNXTQ_KTdA>",
      "max_signups": 400,
      "num_signups": 0,
      "notifications_enabled": false
    }
  ]
}
So what’s nice about that, is you get the
num_signups
and
max_signups
. So I think that could be taken advantage of to get a new URL.
I can’t find
users.sharedInvites.list
as an API on the slack docs, so I wonder if it’s an internal-only API