@classmethod
def from_json(cls, user_id, timestamp, json):
    """Builds an OptIn object from JSON provided by the API.

        Args:
            user_id: An integer Messenger ID of the user who triggered the
                    event.
            timestamp: An integer timestamp (in milliseconds since epoch) of
                    the event.
            json: A dict containing the JSON representation that is converted
                  into the OptIn object.

        Returns:
            An OptIn object.

        """
    return cls(user_id, timestamp, json['ref'])
