I need to be able to impersonate another user from my Trigger, and thinking that I could create a class that logins as another user using the REST API and then post messages from that class.
How would I go about doing that?
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It only takes a minute to sign up.Sign up to join this community
You can do this using the JWT Bearer Token flow. Basically you register an OAuth app and authorize that app for the users you wish to impersonate. Now your future method will create a JWT Bearer Token containing the target user's username and exchange that for an access token with which you can call the REST API.
There is code to do this linked from this answer.