Skip to content

Latest commit

 

History

History
71 lines (53 loc) · 4.25 KB

06-Develop-Send-Message.mdx

File metadata and controls

71 lines (53 loc) · 4.25 KB
id title hide_title slug displayed_sidebar sidebar_position image
docs-chat-develop-send-message
Send Message
true
./send-message
pushChatSidebar
5
/assets/docs/previews/docs_chat_develop--send_message.png

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).

<title>{`Send message | Push Chat | Push Documentation`}</title>

import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import Details from '@theme/Details'; import { ModalContainer, ModalSmall, ModalWrapper, AImp, } from '@site/src/css/SharedStyling';

Send message API

// 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.

200 OK

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.