What is the Robin User Token (RUT)?

Just like in your company’s database, every employee has a unique identifier; in many cases, this identifier is referred to as an ID — the same logic is applied to Robin but with a different name. The Robin User Token (RUT) is used to identify every user that dispatches or receives messages and events in your Robin App.

When to use a RUT

The Robin User Token must be used for any messaging operation on Robin, as it is a means of identification for any user. Sending messages with an invalid token or without a token would result in a “No Identity” record of your Robin Dashboard. The RUT also helps with the visibility of individual and group messaging activities.

The RUT is a necessary prerequisite to building any Robin use case; any application of Robin might not function to its full potential without a valid RUT.

Creating a valid RUT

Recall that a RUT is synonymous with an ID field in a database; hence, the RUT is mapped to metadata for a unique user; this metadata is used to create the RUT. The metadata is a key-value pair (an object) that can contain as much information about a user.

Creating a valid RUT is easy; it can be done on the server (back-end) or on the client side (front-end).

We advise that RUTs are created for each user on the server upon successful registration.

Javascript

const robin = new Robin('YOUR_API_KEY', true)

const response = await robin.**createUserToken**({
  meta_data: {
    username: 'USER_NAME',
  },
});

Go

robin := Robin{ Secret: "YOUR_API_KEY", Tls: true,}

token, err := robin.**CreateUserToken**(
	UserToken{
		MetaData: map[string]interface{}{
			"name": "USER_NAME",
		}
	}
)

Dart

Map<String, dynamic> metadata = {
	"name": "USER_NAME"
};

final String robinToken = await RobinCore.**createUserToken**("YOUR_API_KEY", metaData);

Python

robin = Robin("YOUR_API_KEY", True)

response = robin.**create_user_token**(data={
    "meta_data":{
        "name": "USER_NAME",
    }
})

To install Robin packages and libraries referenced in the code snippets above, check out Samples and Resources

Last updated