I understand that you are looking to add Hasura claims with Actions.
First, I’d like to emphasize that Rules are triggered after a user authenticates to your application.
In other words, this would be equivalent to a Post-Login Action. In the Hasura documentation, they are adding custom claims to the accessToken like this example.
To accomplish this with Actions, you’ll need to use a Post-Login Action script to add the Hasura claims to tokens and pass the event.user.user_id as the user’s ID.
For example:
exports.onExecutePostLogin = async (event, api) => {
const namespace = "https://hasura.io/jwt/claims";
api.accessToken.setCustomClaim(namespace,
{
'x-hasura-default-role': 'user',
// do some custom logic to decide allowed roles
'x-hasura-allowed-roles': ['user'],
'x-hasura-user-id': event.user.user_id
});
};