Class SendingUtils
- java.lang.Object
-
- org.pahappa.systems.whatsapphelper.SendingUtils
-
public class SendingUtils extends java.lang.ObjectClass provides helper methods for sending Whatsapp messages- Author:
- katusiimeconrad
-
-
Constructor Summary
Constructors Constructor Description SendingUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static voidhandleSend(java.lang.String accessToken, org.apache.http.client.fluent.Request request, java.lang.String body)Intermediate Method to set required Headersstatic voidsend(java.lang.String to, java.lang.String fromNumberID, java.lang.String accessToken)Sends a test message to a given recipientstatic voidsend(java.lang.String to, java.lang.String message, java.lang.String fromNumberID, java.lang.String accessToken)Sends a message to a given numberprivate static voidsendRequest(org.apache.http.client.fluent.Request request)Sends the request
-
-
-
Method Detail
-
send
public static void send(java.lang.String to, java.lang.String message, java.lang.String fromNumberID, java.lang.String accessToken) throws java.io.IOExceptionSends a message to a given number- Parameters:
to- the recipient of the message - in the format 2567xxxxxxxxmessage- the message to be sentfromNumberID- the numberID of the sender - obtained from FacebookaccessToken- the Bearer access token for authentication - obtained from Facebook- Throws:
java.io.IOException- due to HTTP errors
-
send
public static void send(java.lang.String to, java.lang.String fromNumberID, java.lang.String accessToken) throws java.io.IOExceptionSends a test message to a given recipient- Parameters:
to- the phone number (format: 2567xxxxxxxxx) receiving the messagefromNumberID- the numberId for the sender - obtained from FacebookaccessToken- the authorization token - obtained from Facebook- Throws:
java.io.IOException
-
handleSend
private static void handleSend(java.lang.String accessToken, org.apache.http.client.fluent.Request request, java.lang.String body) throws java.io.IOExceptionIntermediate Method to set required Headers- Parameters:
accessToken-request-body-- Throws:
java.io.IOException- HTTP exceptions
-
sendRequest
private static void sendRequest(org.apache.http.client.fluent.Request request) throws java.io.IOExceptionSends the request- Parameters:
request-- Throws:
java.io.IOException- HTTP exceptions
-
-