Send message overview
Push Chat doesn't require a user to be on the network for you to send message 😀. Instead, it gives you the freedom to send a nudge to an account or a message (or a meme).
Every chat message sent from Push is completely E2EE. The only exception to this is when a message is sent to the user that is not yet on the Push network. Push leaves it up to the developers to decide on how they want this to be: Send non-encrypted message, empty nudge or only send message to onboarded user (which will always be E2EE).
Send message API​
- js
// userAlice.chat.send(recipient, {message})
// recipient - Can be wallet address, nft address or chatid | See Types of Recipient for more info
// message - Can be modified to send various types of messages like Images, Reactions, etc
const aliceMessagesBob = await userAlice.chat.send(bobAccount, {
type: 'Text',
content: 'Hello Bob!',
});
See Message Types to understand how message
object can be customized to send variety of messages.
Send message parameters​
When sending a message, you can customize the following params
Param | Type | Subtype | Default | Remarks |
---|---|---|---|---|
recipient | string | - | - | Recipient supports a number of address format including wallet addresses, chain agnostic wallet addresses, NFT addresses or even chatid which is useful for groups |
message | object | - | - | Configuration for message to be sent |
- | message.type | Text , Image , File , MediaEmbed , etc | Text | Type of message, see Message Types for passing specific parameters based on message type |
- | message.content | string | - | Message Content |
Note: Parameters
in this style
are mandatory.
Expected response
Sending images, payments, reactions, etc​
The second parameter of chat.send
contains the message
object that can be customized to send an evergrowing types of supported formats from the protocol.
See Message Types to understand how message
object can be customized to send variety of messages.