Message Format - ahamlinman/peribot GitHub Wiki
As a message processing framework, it is important that Peribot defines a standard format for the messages it processes in order to ensure interoperability of various components. The following fields are defined for messages processed by Peribot as of version 0.8.0. Additional fields are considered nonstandard and should be ignored.
Messages are Ruby Hashes with Symbols as keys (or should be able to be accessed and used in a compatible fashion). Data types for each field are specified.
-
service (required): The service the message came from or is going to
(e.g.
:groupme
) [Symbol] -
group (required): A unique ID for the group that the message came from
or is going to, unique across all messaging services [String]. The
recommended format is the name of the messaging service, followed by a
forward slash, followed by a service-specific group ID (e.g.
'groupme/12345678'
). - text (required for messages being processed, optional for replies): The text of the message [String]
- user_name (optional): The name of the user that sent the message being processed [String]
- id (optional): A unique ID representing this message. The format of this ID may be specific to the service. [String]
- attachments (optional): An array of attachments (see below) [Array]
- original (optional): The original message from the messaging service, containing all fields [may vary; likely a Hash]
Like messages, Attachments are Ruby Hashes with Symbols as keys.
-
kind (required): The type of attachment (e.g.
:image
) [Symbol]
-
image (required): A URL for the image to be sent [String], or a Ruby
IO object (responding to
#read
) containing image data for the image to be sent
-
message_id (required): The
id
of the message to like [may vary by service; likely a String]