How to convert Rule to Action

I’ve read that Rules will be soon deprecated and should be replaced with Actions.

I’ve a very simple rule that I don’t know how to convert.

This is the rule:

function (user, context, callback) {
  context.accessToken['http://localhost:3000/whatsapp'] =;
  callback(null, user, context);

Is this the correct equivalent Action?

exports.onExecutePostLogin = async (event, api) => {
  event.context.accessToken['http://localhost:3000/whatsapp'] =;

Hello @giovannilaperna welcome back!

Your Action should look like the following:

exports.onExecutePostLogin = async (event, api) => {

Hope this helps!

For some reason that didn’t work.
I had to set a public claim on my domain and use it also on localhost.

exports.onExecutePostLogin = async (event, api) => {

  api.accessToken.setCustomClaim('https://MY-DOMAIN/loginsCount', event.stats.logins_count);
1 Like

Thanks for following up!

That’s interesting :thinking: Regardless, goo to know you got it working :smile: