expo-slack-webhook

command module
v0.0.0-...-420d421 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 8, 2025 License: MIT Imports: 14 Imported by: 0

README

expo-slack-webhook

Serverless webhook to bridge Expo notifications to Slack. For builds, we subscribe to eas webhooks natively, as per the docs.

For OTA updates, as eas does not support any notifications, we implemented a quick facsimile with a step using curl in the GitHub Action used to build the updates.

We use Slack's blocks abstraction to build messages.

Setup

HMAC tokens can be generated with OpenSSL:

$ openssl rand -base64 128 | tr -d '\n' 
FgqMm/Bi2rIlvuaGQBEKMUDxUquxFn+T3I6m+o1ocOX4IPMZjzXOZt48wRpQoQ53TzDmmBI6lw81UnNfX84VtHwTU3BaP+h2gOEYg5Iv4Lh2QLS9/1SPhLsqQ8aHr5X7PUFRSpG1p0snhnNVXkKLhhrCblcaGf0/p/BERdG8pAo=

Expo robot tokens are set up per the docs.

Slack integration uses an app with minimal permissions; an OAuth token is generated to use in the serverless function.

Running

After getting the requisite secrets, start the server:

$ ALLOW_PREVIEWS=1 DEBUG=1 go run main.go --slack-token $SLACK_TOKEN --slack-channel $SLACK_CHANNEL --hmac-secret $EXPO_HMAC_TOKEN --expo-token $EXPO_ACCESS_TOKEN

Testing

Locally

Use the test program to send payloads to your webhook server:

$ go run test/main.go --endpoint http://localhost:8080/build --payload ./test/build.sample.json --hmac-secret $EXPO_HMAC_TOKEN
$ go run test/main.go --endpoint http://localhost:8080/submit --payload ./test/submit.sample.json --hmac-secret $EXPO_HMAC_TOKEN
$ go run test/main.go --endpoint http://localhost:8080/update --payload ./test/update.sample.json --hmac-secret $EXPO_HMAC_TOKEN
On the web

Using ngrok, forward the address that the server is listening for locally to the web, then send requests through ngrok's servers.

Developing

None of the GrapqhQL endpoints we use to talk to the Expo servers are documented anywhere, so mitmproxy was used to intercept traffic from the eas CLI. After adding the mitmproxy CA to the developer machine's root trust bundle, run the EAS CLI like so:

$ NODE_TLS_REJECT_UNAUTHORIZED=0 https_proxy=https://localhost:9090 eas update:list --branch=preview --limit=2 --non-interactive

Deploying

We use Vercel's serverless offering for Golang for no reason other than NWAC already has a business relationship with Vercel which makes this an easy on-ramp.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
api

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL