Worklight: Push Notification message length & formatting - limitations - ios

I am facing below issues when sending Push notifications through Worklight.
Push Message length is very much limited - around 65 characters
payload message when received on device has removed all spacing
like i sent "This is a test message" but on device it received as "Thisisatestmessage"
Now , what is the limited size of Push message in worklight specially , i know Apple says for 256 Bytes. But what Worklight allows?
and why payload is removing spaces. Even i am sending message from a back-end java service
My Push Adapter:
function generalNotification(userId, msgTitle, MsgContents, org, logo){
var userSubscription = WL.Server.getUserNotificationSubscription('aahadPushAdapter.GeneralPushSource', userId);
if (userSubscription==null){
return { result: "No subscription found for user :: " + userId };
}
WL.Logger.debug("Sending Push >> userId:: " + userId + ", Message:: " + MsgContents);
WL.Server.notifyAllDevices(userSubscription, {
badge: 1,
sound: "sound.mp3",
activateButtonLabel: "Read",
alert: msgTitle,
payload: {
msg : MsgContents,o:org,l:logo
}
});
return { result: "Notification sent to user :: " + userId };
}
my back-end Java code:
DataAccessService service = WorklightBundles.getInstance().getDataAccessService();
String parm = "['" + userID + "','"+ msgTitle + "','"+ msgContents+ "','"+org + "','"+logo +"']";
ProcedureQName pushMethod = new ProcedureQName("aahadPushAdapter","transNotification");
InvocationResult results = service.invokeProcedure(pushMethod, parm);
jsonObj = results.toJSON();
msg = "Push Sent successfully to " + userID + " " + (String)jsonObj.get("");
Please check this code and suggest , if something is missing here?
thanks

Does the stripping of spaces also happen in the Push Notifications sample application provided in the IBM Worklight Getting Started training material? Because for me, it doesn't.
If it happens only in your application, need to understand how you're processing the message.
As I have mentioned to you in a comment elsewhere, Worklight does not place any restrictions - each PNS (APNS, MSPN, GCM) has its own limitation.
The 256 bytes are not only for the message part of the payload, but for the entirety of the payload, so it could be that for the message part what is left is only 65 characters, but again, this is not in Worklight's control.
I haven't done this yet myself, but you can start stripping the payload and see when it fails, that would be your minimum payload from Worklight's perspective.
The message is not meant to be long in principle.
Another way to maybe increase what you can pass in the message (in the remaining size of the payload) is to use an alias so that less information is passed, thus more space remains for the message.

The stripping of spaces in APNS payload appears to be a defect. I seen the same behavior in my application and was able to reproduce it in the getting started materials. As a workaround I put "_" in the payload as a placeholder for spaces and then removed them in the worklight client.

Related

While adding Alphanumeric Sender ID I always got error in php

I had purchased a USA number and I am trying to send a programable message to Hong Kong. While I send with a simple Twilio number it works fine and message recieved.
But when I try to add alphanumeric Sender ID it always show error message. The error message is: Message: [HTTP 400] Unable to create record: The 'From' number infoSMS is not a valid phone number, shortcode, or alphanumeric sender ID.
What I had tried is
public function send_sms(){
$msg_to = $_REQUEST['msg_to'];
$msg_body = $_REQUEST['msg_body'];
$twilio = new Client("ACba7f3a6866a23aed021056d3ceaexxxx", "4d7e47e92a8351b7365ed1e3e83dxxxx");
$message = $twilio->messages->create(
$msg_to, // to
[
"body" => $msg_body,
"from" => "infoSMS";
]
);
if($message->sid) {
$this->session->set_flashdata('ok_message', '- SMS successfully sent!');
redirect(AURL . 'Sms/sent_sms_list');
}else {
$this->session->set_flashdata('err_message', '- Error in sending sms please try again!');
redirect(SURL . 'Sms/create_sms');
}
}
I had read the documentation: https://www.twilio.com/docs/sms/send-messages#use-an-alphanumeric-sender-id
What I am doing wrong? Thanks in advance.
Twilio developer evangelist here.
This was a bit hard to track down, but it turns out that there are a few generic alphanumeric sender IDs that may cause delivery failures. I tried to send an SMS using "infoSMS" as the sender ID and was unable to do so as well.
On some of our SMS guideline pages, there is this note about alphanumeric sender IDs:
Generic Alpha Sender IDs like InfoSMS, INFO, Verify, Notify etc should be avoided as they will result in SMS failures
I recommend you try using a different alphanumeric sender ID that more closely represents your business or service.

Twilio not dialing always

we are using Twilio agent-dialing to initiate the call between two users.
User A request a call to user B
We get the number from the WS, then create a call with Twilio
Twilio dials user A SOMETIMES fails here
When user A answers, then Twilio dials user B
This works fine most of the time, but some times the call is not even initiated. We get the call.getSid() as if the call was launched, but the phone never rings.
if (!from.equals(to)) {
Twilio.init(TWILIO_ACCOUNT_SID, TWILIO_ACCOUNT_TOKEN);
try {
final String encodedNumber = URLEncoder.encode(to, "UTF-8");
final String url = URL + "/connect/" + encodedNumber;
final Call call = Call.creator(new PhoneNumber(from), new PhoneNumber(TWILIO_PHONE_NUMBER), new URI(url)).setTimeout(20).create();
response.setMessage("Calling " + response.getItem().getDisplayName() + "'s " + params.getNumberType() + "...");
LoggerUtil.out("Call done through Twilio: " + call.getSid() + " from: " + from + " to: " + to);
} catch (UnsupportedEncodingException | URISyntaxException ex) {
ex.printStackTrace();
response.setMessage("I cannot dial " + response.getItem().getDisplayName() + "'s " + params.getNumberType() + " now, please try again later.");
}
} else {
response.setMessage("You cannot call yourself.");
}
OUTPUT: Call done through Twilio: CAabf9ba78b3b94921b000cda2ae6d2b91 from: +521234567890 to: +520987654321
And, on Twilio console there are no errors on either. Also, we noticed that the $ decreases, which means we got charged (non-trial account), as the "call was made", but it was not.
Does anybody faced same issue? The same happens SOMETIMES, for the Agent side (bullet #4 on above steps): User A answers, but user B is never called (no dialing sound or anything at all on the user A phone, just void):
final Dial dial = new Dial.Builder().number(number).build();
final VoiceResponse voiceResponse = new VoiceResponse.Builder().dial(dial).build();
As said, this is happening sometimes, and most of the times for non-US phones (it also happens for US ones, but in small rates).
Thanks in advance.
Check the Twilio Call Logs to validate that we have successfully received and processed the incoming call(s). You can view the logs and search for your call record via either Console, or the REST API.
A record doesn't exist for the call: If you don't see a record for the call in question, then there is likely an issue elsewhere. Continue reading for additional troubleshooting.
A record does exist for the call: If you do see a record for the call in question, this indicates Twilio has successfully received the call, and the issue lies elsewhere. Continue troubleshooting with the following checklist:
Are you https://support.twilio.com/hc/en-us/articles/360025446533-Troubleshooting-Twilio-Elastic-SIP-Trunking-and-SIP-Domain-Calls
Are you (or a caller) hearing the "An application error has occurred” error on your call?
Is an outbound call not connecting?
Does the call log show any Debug Events?
Is your TwiML URL or Application SID responding as intended?
Are you (or a caller) experiencing any audio quality issues?

FCM Cannot recieve notification when app in background react native ios when custom data sent

i have succesfully integrating react-native-fcm and
i am getting notification when i am sending from firebase console (in foreground,background,and killed state of app)
but when i am sending it from our server with custom data i cannot recieved when app is in (killed,background) state
i have also tried content-availble:true in data object
below is the notification data which i am sending
{
aps = {
"content-available" = 1;
};
body = "Get a free T-Shirt #WROGN on every purchase via Shopholix. T&C apply.";
"gcm.message_id" = "0:1475746605785619%9a4a567a9a4a567a";
"gcm.notification.data" = "{\"image\":\"http:\\/\\/res.cloudinary.com\\/saurabh\\/image\\/upload\\/v1469791885\\/media\\/yljgxgmfg1qbulxzwakm.png\",\"user_type\":\"all\",\"screen\":\"store\",\"id\":\"56d7e33ce69f7c8f06550002\",\"title\":\"Shopholix\",\"message\":\"Get a free T-Shirt #WROGN on every purchase via Shopholix. T&C apply.\",\"body\":\"Get a free T-Shirt #WROGN on every purchase via Shopholix. T&C apply.\"}";
"gcm.notification.priority" = high;
id = 56d7e33ce69f7c8f06550002;
image = "http://res.cloudinary.com/saurabh/image/upload/v1469791885/media/yljgxgmfg1qbulxzwakm.png";
message = "Get a free T-Shirt #WROGN on every purchase via Shopholix. T&C apply.";
screen = store;
title = Shopholix;
"user_type" = all;
}
Any help would be appreciated
Thanks,
Your content_available is set to 1. I'm pretty sure when using FCM, you should use true or false. Correct me if I'm reading your payload structure in a wrong way, but are you specifying the content_available separate from the GCM payload?
Also, the priority parameter should be outside the notification payload parameter.
See here for more details.
Were you able to resolve your issue?
Looking at the JSON, if it is exactly how you're sending it, then it is not well formed. All of the keys need to be strings surrounded by quotes. And each key-value pair needs to be comma-separated, not semi-colon.

rpush notification, saves notification but not sending. Ionic receive message Notification received

Are there any documentations regarding the data field of the Push Notification message i mean n.data { }. what does it mean?
I seem to be having the same issue as well
This is my code
n = Rpush::Apns::Notification.new
n.app = Rpush::Apns::App.find_by_name("Loanstreet Partners")
n.device_token = #user_auth_token.device_token # 64-character hex string
n.alert = "New Case Submission: " + la.case_code
n.data = { foo: :bar }
n.badge = 1
n.save!
Rpush.push
Rpush.apns_feedback
In my rpush_notifications table, i see the notification created but in my rpush_feedback it is empty. not sure why it doesn't get sent. Anyone has a clue?
I don't get any error or anything as well. So I'm sort of confused.
I do however get a Notification received from Ionic log but i dont see any notification.

Azure Notification Hub: notifications not showing up if sent to group

I have a trouble making notification hub to work.
If I send notification to tag that has only one registration associated with it, then everything's fine. Here's source:
var alert = "{\"aps\":{\"alert\":\"some message(targeted)\"},\"inAppMessage\": \"text\"}";
hub.SendAppleNativeNotificationAsync(alert,"mytag").ContinueWith(t => {
var outcome = t.Result;
Console.WriteLine(outcome);
});
But if I try to sent my notification to all users, like so:
var alert = "{\"aps\":{\"alert\":\"some message(all users)\"},\"inAppMessage\": \"text\"}";
hub.SendAppleNativeNotificationAsync(alert).ContinueWith(t => {
var outcome = t.Result;
Console.WriteLine(outcome);
});
then no one gets the notification. I checked monitor in Azure portal but there were no errors present.
Do you guys have some ideas?
Behavior you described is incorrect. There is one known issue which can potentially cause such kind of errors for Apple only:
If some registrations in the Notification Hub have invalid device token (it typically happens when application switches from test APNS to production or if some fake tokens were used during testing in emulator) then APNS terminates connection during the send and all notifications being sent after that using same connection are just ignored. Right now Notification Hub does not handle this situation correctly.
Way to fix - clean up "bad" registrations. If you are about developing/testing and it is not critical to lose the data - just remove all the registrations. If you have a lot of existing users then email me and we will try to find solution for your particular case.
I had same issue and I tried to set true EnableTestSend property, but no luck. Then I just removed the tags while send notifications. It worked like charm.
NotificationOutcome outcome = null;
var alert = "{\"aps\":{\"alert\":\"" + "From " + user + ": " + message + "\",\"sound\":\"default\"}}";
outcome = await Notifications.Instance.Hub.SendAppleNativeNotificationAsync(alert);

Resources