Class MessageCreator

    • Constructor Detail

      • MessageCreator

        public MessageCreator​(String pathServiceSid,
                              String pathChannelSid)
        Construct a new MessageCreator.
        Parameters:
        pathServiceSid - The SID of the Service to create the resource under
        pathChannelSid - The unique ID of the channel the new resource belongs to
    • Method Detail

      • setFrom

        public MessageCreator setFrom​(String from)
        The [identity](https://www.twilio.com/docs/chat/identity) of the new message's author. The default value is `system`..
        Parameters:
        from - The identity of the new message's author
        Returns:
        this
      • setAttributes

        public MessageCreator setAttributes​(String attributes)
        A valid JSON string that contains application-specific data..
        Parameters:
        attributes - A valid JSON string that contains application-specific data
        Returns:
        this
      • setDateCreated

        public MessageCreator setDateCreated​(org.joda.time.DateTime dateCreated)
        The date, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource as the date it was created. The default is the current time set by the Chat service. This parameter should only be used when a Chat's history is being recreated from a backup/separate source..
        Parameters:
        dateCreated - The ISO 8601 date and time in GMT when the resource was created
        Returns:
        this
      • setDateUpdated

        public MessageCreator setDateUpdated​(org.joda.time.DateTime dateUpdated)
        The date, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource as the date it was last updated. The default value is `null`. Note that this parameter should only be used when a Chat's history is being recreated from a backup/separate source and where a Message was previously updated..
        Parameters:
        dateUpdated - The ISO 8601 date and time in GMT when the resource was updated
        Returns:
        this
      • setLastUpdatedBy

        public MessageCreator setLastUpdatedBy​(String lastUpdatedBy)
        The [identity](https://www.twilio.com/docs/chat/identity) of the User who last updated the Message, if applicable..
        Parameters:
        lastUpdatedBy - The Identity of the User who last updated the Message
        Returns:
        this
      • setBody

        public MessageCreator setBody​(String body)
        The message to send to the channel. Can also be an empty string or `null`, which sets the value as an empty string. You can send structured data in the body by serializing it as a string..
        Parameters:
        body - The message to send to the channel
        Returns:
        this
      • setMediaSid

        public MessageCreator setMediaSid​(String mediaSid)
        The SID of the [Media](https://www.twilio.com/docs/chat/rest/media) to attach to the new Message..
        Parameters:
        mediaSid - The Media Sid to be attached to the new Message
        Returns:
        this
      • create

        public Message create​(TwilioRestClient client)
        Make the request to the Twilio API to perform the create.
        Specified by:
        create in class Creator<Message>
        Parameters:
        client - TwilioRestClient with which to make the request
        Returns:
        Created Message