Here is the magic incantation I've found creates the best animated gifs for use as emojis in Slack. Powered by @kornel 's gifski:
ffmpeg -i INPUT.gif -vf "format=yuv420p" -f yuv4mpegpipe - | gifski -W 128 -H 128 -Q 55 -o OUTPUT-compressed.gif -
Make quality -Q
vary until size is just below ~128k. For some reason, Slack's limit is not exactly 217, but not 128000 either.