Class RbmApiHelper
- java.lang.Object
-
- com.google.api.services.rcsbusinessmessaging.v1.RbmApiHelper
-
public class RbmApiHelper extends java.lang.ObjectHelper class for using the RBM API.
-
-
Constructor Summary
Constructors Constructor Description RbmApiHelper()RbmApiHelper(java.io.File serviceAccountKeyFile)Initializes credentials and the RBM API object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CardContentcreateCardContent(java.lang.String title, java.lang.String description, java.lang.String imageUrl, MediaHeight height, java.util.List<Suggestion> suggestions)Creates a card content object based on the parameters.StandaloneCardcreateStandaloneCard(java.lang.String title, java.lang.String description, java.lang.String imageUrl, MediaHeight height, CardOrientation orientation, java.util.List<Suggestion> suggestions)Creates a standalone card object based on the passed in parameters.java.lang.StringgetCapability(java.lang.String msisdn)Checks whether the device associated with the phone number is RCS enabled.BatchGetUsersResponsegetUsers(java.util.List<java.lang.String> phoneNumbers)Performs a batch user capability check.voidperformCapabilityCheck(java.lang.String msisdn)Checks whether the device associated with the phone number is RCS enabled.voidregisterTester(java.lang.String msisdn)Registers the device as a tester for this agent.voidsendAgentMessage(AgentMessage agentMessage, java.lang.String msisdn)Generic method to execute the sending of an agent message to a client.voidsendCarouselCards(java.util.List<CardContent> cardContents, CardWidth cardWidth, java.lang.String msisdn)Generic method to execute the sending of a carousel rich card to a client.voidsendIsTypingMessage(java.lang.String msisdn)Sends the IS_TYPING event to the user.voidsendReadMessage(java.lang.String messageId, java.lang.String msisdn)Sends a READ request to a user's phone.voidsendStandaloneCard(StandaloneCard standaloneCard, java.lang.String msisdn)Generic method to execute the sending a standalone card to a client.voidsendTextMessage(java.lang.String messageText, java.lang.String msisdn)Generic method to send a text message using the RBM api to the user with the phone number msisdn.voidsendTextMessage(java.lang.String messageText, java.lang.String msisdn, java.util.List<Suggestion> suggestions)Generic method to send a text message using the RBM api to the user with the phone number msisdn.java.lang.StringuploadFile(java.lang.String fileUrl)Uploads the file located at the publicly available URL to the RBM platform.java.lang.StringuploadFile(java.lang.String fileUrl, java.lang.String thumbnailFileUrl)Uploads the file located at the publicly available URL to the RBM platform.
-
-
-
Method Detail
-
registerTester
public void registerTester(java.lang.String msisdn) throws java.lang.ExceptionRegisters the device as a tester for this agent.- Parameters:
msisdn- The phone number in E.164 format.- Throws:
java.lang.Exception
-
getUsers
public BatchGetUsersResponse getUsers(java.util.List<java.lang.String> phoneNumbers) throws java.lang.Exception
Performs a batch user capability check. The API supports a maximum of 10,000 users per request.- Parameters:
phoneNumbers- List of user phone numbers to check.- Returns:
- A BatchGetUsersResponse object.
- Throws:
java.lang.Exception
-
performCapabilityCheck
public void performCapabilityCheck(java.lang.String msisdn) throws java.lang.ExceptionChecks whether the device associated with the phone number is RCS enabled. This uses the asynchronous capability check API.- Parameters:
msisdn- The phone number in E.164 format.- Throws:
java.lang.Exception
-
getCapability
public java.lang.String getCapability(java.lang.String msisdn) throws java.lang.ExceptionChecks whether the device associated with the phone number is RCS enabled. This uses the alpha synchronous capability check API.- Parameters:
msisdn- The phone number in E.164 format.- Returns:
- The raw response from the capability check.
- Throws:
java.lang.Exception
-
uploadFile
public java.lang.String uploadFile(java.lang.String fileUrl)
Uploads the file located at the publicly available URL to the RBM platform.- Parameters:
fileUrl- A publicly available URL.- Returns:
- A unique file resource id.
-
uploadFile
public java.lang.String uploadFile(java.lang.String fileUrl, java.lang.String thumbnailFileUrl)Uploads the file located at the publicly available URL to the RBM platform.- Parameters:
fileUrl- A publicly available URL.thumbnailFileUrl- Includes the thumbnail if there is one.- Returns:
- A unique file resource id.
-
createCardContent
public CardContent createCardContent(java.lang.String title, java.lang.String description, java.lang.String imageUrl, MediaHeight height, java.util.List<Suggestion> suggestions)
Creates a card content object based on the parameters.- Parameters:
title- The title for the card.description- The description for the card.imageUrl- The image URL for the card's media.height- The height to display the media.suggestions- List of suggestions to attach to the card.- Returns:
- The standalone card object.
-
createStandaloneCard
public StandaloneCard createStandaloneCard(java.lang.String title, java.lang.String description, java.lang.String imageUrl, MediaHeight height, CardOrientation orientation, java.util.List<Suggestion> suggestions)
Creates a standalone card object based on the passed in parameters.- Parameters:
title- The title for the card.description- The description for the card.imageUrl- The image URL for the card's media.height- The height to display the media.orientation- The orientation of the card.suggestions- List of suggestions to attach to the card.- Returns:
- The standalone card object.
-
sendTextMessage
public void sendTextMessage(java.lang.String messageText, java.lang.String msisdn) throws java.io.IOExceptionGeneric method to send a text message using the RBM api to the user with the phone number msisdn.- Parameters:
messageText- The text to send the user.msisdn- The phone number in E.164 format.- Throws:
java.io.IOException
-
sendTextMessage
public void sendTextMessage(java.lang.String messageText, java.lang.String msisdn, java.util.List<Suggestion> suggestions) throws java.io.IOExceptionGeneric method to send a text message using the RBM api to the user with the phone number msisdn.- Parameters:
messageText- The text to send the user.msisdn- The phone number in E.164 format.suggestions- The chip list suggestions.- Throws:
java.io.IOException
-
sendStandaloneCard
public void sendStandaloneCard(StandaloneCard standaloneCard, java.lang.String msisdn) throws java.io.IOException
Generic method to execute the sending a standalone card to a client.- Parameters:
standaloneCard- The card object to send.msisdn- The phone number in E.164 format.- Throws:
java.io.IOException
-
sendCarouselCards
public void sendCarouselCards(java.util.List<CardContent> cardContents, CardWidth cardWidth, java.lang.String msisdn) throws java.io.IOException
Generic method to execute the sending of a carousel rich card to a client.- Parameters:
cardContents- List of CardContent items to be attached to the CarourselCard.cardWidth- Width of the cards for the carousel.msisdn- The phone number in E.164 format.- Throws:
java.io.IOException
-
sendAgentMessage
public void sendAgentMessage(AgentMessage agentMessage, java.lang.String msisdn) throws java.io.IOException
Generic method to execute the sending of an agent message to a client.- Parameters:
agentMessage- The message payload to send.msisdn- The phone number in E.164 format.- Throws:
java.io.IOException
-
sendReadMessage
public void sendReadMessage(java.lang.String messageId, java.lang.String msisdn)Sends a READ request to a user's phone.- Parameters:
messageId- The message id for the message that was read.msisdn- The phone number in E.164 format to send the event to.
-
sendIsTypingMessage
public void sendIsTypingMessage(java.lang.String msisdn)
Sends the IS_TYPING event to the user.- Parameters:
msisdn- The phone number in E.164 format to send the event to.
-
-