(Outgoing) Send message from server

Usage

When a player send a message from his in-game phone, your server need to inform iPear that a new message has been sent. You can send a message from the server with the websocket.

WebSocket event

You need to emit an event with the following name and data:

Event name: messages@new

Object

KeyTypeExtraDescription
sender_idstring
required
Unique identifier (custom_id) of the sender (1-64 characters)
sender_numberstring
required
Phone number of the sender (1-32 characters)
recipient_idstring
required
Unique identifier (custom_id) of the recipient (1-64 characters)
recipient_numberstring
required
Phone number of the recipient (1-32 characters)
recipient_onlineboolean
required
Tell us if the recipient is online. If he's not, we send a notification to the recipient
contentstring
required
Content of the message (1-1024 characters)

Important

Response object must respect every type rule. If any structure isn't respected, your request will be rejected for "bad-request".

Example

{
  "sender_id": "1234",
  "sender_number": "555-9876",
  "recipient_id": "8524",
  "recipient_number": "555-4567",
  "recipient_online": true,
  "content": "Hey! Can we meet in 2 hours?"
}

Response

Unfortunately, there is no response in this version.

What's next?

Incoming events

Powered by Doctave