Skip to main content
A message represents an action taken by a user (e.g. alice says “hello world”) There are many types of messages, and this tutorial will walk you through the most common ones. Other tutorials will cover the more advanced message types.

Setup

You will need:
  • Write access to a Snapchain node
  • Private key of a signer registered to an fid
  • hub-nodejs and helper functions imported and shown below

Casts

Casts are public messages created by a user. A cast is created by issuing a CastAdd message with the text of the cast and optional embeds, mentions, and emoji. The example below shows the creation of a simple cast.
A cast can be removed by issuing a CastRemove message with the hash of the CastAdd message and a later timestamp.
To create casts with embeds, mentions, channels emoji, see the casts tutorial.

Reactions

Reactions are strongly typed relationships between a user and a cast (e.g. a like). A user “likes” a cast by producing a ReactionAdd message with type set to like and the target set to the hash of the cast and the fid of its author.
The like can be negated by broadcasting a ReactionRemove message with the information and a later timestamp.
A user can “recast” with a very similar process.

User Data

UserData is a strongly typed set of messages that represent metadata about a user (e.g. bio, profile picture). A UserData message has a type and a string value which can be set. The example below shows a user updating their bio.
Links are loosely typed relationships between users (e.g. alice follows bob). A user creates a Link by issuing a LinkAdd message with a string type and the target user’s fid. The most commonly supported link on all clients is ‘follow’.