Bold360 and BoldChat Developer Center

Account

com.boldchat.visitor.api

Class Account

  • java.lang.Object
    • com.boldchat.visitor.api.Account


  • public class Account
    extends java.lang.Object
    This class is the starting point for access the BoldChat API. To begin an instance of this class should be created with Account(long, String) and then a call should be made to createChat(CreateChatListener) or createChat(CreateChatListener, boolean). The CreateChatListener callback passed in on these methods will return an instance of the Chat object if successful. This is the only way to get an instance of the Chat object.
    • Constructor Summary

      Constructors 
      Constructor and Description
      Account(long accountID, java.lang.String apiAccessKey)
      Creates an chat account object for creating chats.
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      void createChat(CreateChatListener createChatListener)
      Initiates the chat creation process.
      void createChat(CreateChatListener createChatListener, boolean includeBrandingValues)
      Returns relevant info about chat.
      long getAccountID()
      Gets the account ID set in Account(long, String)
      java.lang.String getApiAccessKey()
      Gets the chat api key set in Account(long, String)
      void getChatAvailability(ChatAvailabilityListener availabilityListener)
      Retrieves the availability of the chat service.
      int getTimeout()
      Returns the timeout value set in setTimeout(int)
      void setChatWindowID(long chatWindowID)
      An optional chat window id configurable in the BoldChat setup interface.
      void setDepartmentID(long departmentID)
      Optional department any chats created should be assigned to by default.
      void setExtraData(java.util.Map<java.lang.String,java.lang.Object> values)
      Allows setting fields just like submitPreChat to either pre-populate fields or if you are skipping the pre-chat form and would like to populate the data yourself before creating the chat.
      void setLanguage(java.lang.String language)
      Any human readable strings returned by the servers should be in this language if it is supported by the server.
      void setServerSet(java.lang.String serverSet)
      Deprecated. 
      For BoldChat internal testing only
      void setSkipPreChat(boolean skipPreChat)
      If a pre-chat form is configured on the window and you would like to ignore this and go straight to chat, pass in a true value for this.
      void setTimeout(int timeout)
      This sets the network timeout for any communications that occur for any chats.
      void setVisitorID(long visitorID)
      Optional method to set the visitor ID.
      void setWebsiteDefinitionID(long websiteDefinitionID)
      An optional website definition id configurable in the BoldChat setup interface.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Account

        public Account(long accountID,
               java.lang.String apiAccessKey)
        Creates an chat account object for creating chats.
        Parameters:
        accountID - This should be the account ID assigned by BoldChat.
        apiAccessKey - The access key assigned by BoldChat.
    • Method Detail

      • setVisitorID

        public void setVisitorID(long visitorID)
        Optional method to set the visitor ID. If the application has previously called createChat and a visitorID was returned re-use that id for all subsequent calls for each unique user. If this is the first time the application has used createChat this parameter should be left empty and a new visitorID will be generated and returned by the server.
        Parameters:
        visitorID - The previously assigned visitor ID that should be re-used for each chat created.
      • setDepartmentID

        public void setDepartmentID(long departmentID)
        Optional department any chats created should be assigned to by default. This could be overriden by the pre-chat survey if the department selector is enabled.
        Parameters:
        departmentID - The department ID to assign to any chats created.
      • setChatWindowID

        public void setChatWindowID(long chatWindowID)
        An optional chat window id configurable in the BoldChat setup interface. This value can control which set of PreChat information will be returned.
        Parameters:
        chatWindowID - The chat window ID to assign to any chats created.
      • setWebsiteDefinitionID

        public void setWebsiteDefinitionID(long websiteDefinitionID)
        An optional website definition id configurable in the BoldChat setup interface. This value can control the operating hours for chat.
        Parameters:
        websiteDefinitionID - The website definition ID to assign to any chats created.
      • setLanguage

        public void setLanguage(java.lang.String language)
        Any human readable strings returned by the servers should be in this language if it is supported by the server. Strings returned by the API will be in U.S. English unless. The language parameter must be an ISO 639-1 language code optionally followed by a dash then an ISO 3166-1 country code (en-US). If a language code is passed that is not recognized or supported en-US strings will be returned instead.
        Parameters:
        language - The language code.
      • setTimeout

        public void setTimeout(int timeout)
        This sets the network timeout for any communications that occur for any chats. By default timeout is set to 30 seconds.
        Parameters:
        timeout - The network timeout in milliseconds
      • createChat

        public void createChat(CreateChatListener createChatListener)
        Initiates the chat creation process. If pre-chat form is enabled it will return pre-chat information, if pre-chat is not enabled it will return information about connecting the chat. If chat is unavailable then unavailable information will be returned instead. Calling this method is required for all chat sessions.
        Parameters:
        createChatListener - The event listener that will be called to receive the data after the API call is completed.
      • createChat

        public void createChat(CreateChatListener createChatListener,
                      boolean includeBrandingValues)
        Returns relevant info about chat. If pre-chat form is enabled it will return pre-chat information, if pre-chat is not enabled it will return information about connecting the chat. If chat is unavailable then unavailable information will be returned instead.
        Parameters:
        createChatListener - The event listener that will be called to receive the data after the API call is completed.
        includeBrandingValues - BoldChat allows the customization of text through the use of brandings configurable from setup. If you wish to wish to have all of the customized brandings values returned with the request to createChat then pass true for this parameter, otherwise these values will not be returned.
      • getChatAvailability

        public void getChatAvailability(ChatAvailabilityListener availabilityListener)
        Retrieves the availability of the chat service. This can be used to check if chat will be available before showing the option for live chat. This can be called at any time without an existing chat session. Results will be cached for 5 minutes.
        Parameters:
        availabilityListener - The event listener that will be called with the chat availability.
      • setServerSet

        public void setServerSet(java.lang.String serverSet)
        Deprecated. For BoldChat internal testing only
        Used for internal BoldChat testing. This should not be used in production environments.
      • getAccountID

        public long getAccountID()
        Gets the account ID set in Account(long, String)
        Returns:
        The account ID
      • getApiAccessKey

        public java.lang.String getApiAccessKey()
        Gets the chat api key set in Account(long, String)
        Returns:
        The chat API Access key
      • getTimeout

        public int getTimeout()
        Returns the timeout value set in setTimeout(int)
        Returns:
        the timeout
      • setExtraData

        public void setExtraData(java.util.Map<java.lang.String,java.lang.Object> values)
        Allows setting fields just like submitPreChat to either pre-populate fields or if you are skipping the pre-chat form and would like to populate the data yourself before creating the chat.
        Parameters:
        values - The extra values to be set on the chat.
      • setSkipPreChat

        public void setSkipPreChat(boolean skipPreChat)
        If a pre-chat form is configured on the window and you would like to ignore this and go straight to chat, pass in a true value for this.
        Parameters:
        skipPreChat - If true the pre-chat form will be skipped, getting it's information from the setExtraData(java.util.Map) values.