Discourse itself doesn’t include any spam filtering (beyond checking for the auto-generated header), so even if SPF/DKIM records don’t match it should work. If you have spam checks upstream of discourse then you may run into problems.
A “better” solution would definitely be to use the API.