Interface representing a Google Cloud Pub/Sub message.

**Signature:**

    export declare class Message<T> 

## Constructors

| Constructor | Modifiers | Description |
|---|---|---|
| [(constructor)(data)](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.pubsub.message#pubsubmessageconstructor) |   | Constructs a new instance of the `Message` class |

## Properties

| Property | Modifiers | Type | Description |
|---|---|---|---|
| [attributes](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.pubsub.message#pubsubmessageattributes) |   | { \[key: string\]: string; } | User-defined attributes published with the message, if any. |
| [data](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.pubsub.message#pubsubmessagedata) |   | string | The data payload of this message object as a base64-encoded string. |
| [json](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.pubsub.message#pubsubmessagejson) |   | T | The JSON data payload of this message object, if any. |
| [messageId](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.pubsub.message#pubsubmessagemessageid) |   | string | Autogenerated ID that uniquely identifies this message. |
| [orderingKey](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.pubsub.message#pubsubmessageorderingkey) |   | string | User-defined key used to ensure ordering amongst messages with the same key. |
| [publishTime](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.pubsub.message#pubsubmessagepublishtime) |   | string | Time the message was published |

## Methods

| Method | Modifiers | Description |
|---|---|---|
| [toJSON()](https://firebase.google.com/docs/reference/functions/2nd-gen/node/firebase-functions.pubsub.message#pubsubmessagetojson) |   | Returns a JSON-serializable representation of this object. |

## pubsub.Message.(constructor)

Constructs a new instance of the `Message` class

**Signature:**

    constructor(data: any);

### Parameters

| Parameter | Type | Description |
|---|---|---|
| data | any |   |

## pubsub.Message.attributes

User-defined attributes published with the message, if any.

**Signature:**

    readonly attributes: {
            [key: string]: string;
        };

## pubsub.Message.data

The data payload of this message object as a base64-encoded string.

**Signature:**

    readonly data: string;

## pubsub.Message.json

The JSON data payload of this message object, if any.

**Signature:**

    get json(): T;

## pubsub.Message.messageId

Autogenerated ID that uniquely identifies this message.

**Signature:**

    readonly messageId: string;

## pubsub.Message.orderingKey

User-defined key used to ensure ordering amongst messages with the same key.

**Signature:**

    readonly orderingKey: string;

## pubsub.Message.publishTime

Time the message was published

**Signature:**

    readonly publishTime: string;

## pubsub.Message.toJSON()

Returns a JSON-serializable representation of this object.

**Signature:**

    toJSON(): any;

**Returns:**

any

A JSON-serializable representation of this object.