APN not delivered - apple-push-notifications

I have 2 APNs, they share the same provider, same device token. First one is delivered, second one not.
payload={"aps":{"badge":0,"alert":{"action-loc-key":"View","body":"Some guy: Hey man"},"sound":"NewMessage.caf"}} <- this one is delivered
payload={"aps":{"badge":0,"alert":{"action-loc-key":"","body":""}}} <- this one not delivered
I could not find any info about empty body in Apple docs.
So, why it's not delivered?

The payload must include an alert dictionary with title, subtitle, or body information.
Empty values are treated as missing.

Related

SWIFT MT Message SEME Uniqueness

As far as I understand, the SEME (sender's message reference) attribute of a SWIFT MT message has to be unique per sender (it is the sender's responsibility to ensure uniqueness). So, let's say there are two sending entities A and B and I am the receiver. Then it would be a valid scenario to have both of them send out a SWIFT MT message with the same SEME, right? How could I differentiate messages coming from sender A and B? What is common practice in such a case?
In the documentation (MT 558 in that case) it says:
Reference assigned by the triparty agent to unambiguously identify the
message.
The MIR in the {2: Application Header Block} seems to be the one according to me.
MIR: message input reference, unique identifiers containing the date, logical terminal (including branch code), session and sequence numbers.
Info source: https://www.prowidesoftware.com/about-SWIFT.jsp

Message formatting of OSC for MIDI messages

I'm using the github.com/hypebeast/go-osc/osc package to send OSC messages to an OSC server. For this I'm using OSCulator so that I can route the data as MIDI to Abelton Live.
The problem I'm having is I can not find any information on message formatting for things like note on, note off, duration etc. I found a guide on the OSCulator website that's a little helpful, but it doesn't go into much detail on messaging: http://s3.amazonaws.com/osculator/doc/OSCulator+2.12+Manual.pdf
For example, the following function works just fine, but I have no idea what the message is really doing:
func note(pitch float32 , velocity float32) {
// TODO: Pass client into function. Find out it's type.
client := osc.NewClient("localhost", 8765)
noteMsg := osc.NewMessage("/4/toggle2")
client.Send(noteMsg)
msg := osc.NewMessage("/4/xy")
msg.Append(pitch)
msg.Append(velocity)
client.Send(msg)
}
I mean, what purpose does the 4 play in this, and what is xy? Also, what other messages are available apart from toggle2? I thought there would be some sort of documentation online that has all the different types of messages available for MIDI type applications.
Your question seems to be more related to OSC itself.
OSC works like this:
You send a message to a server. A message is composed by an adress and some values.
In this case, /4/xy is the address. The 4 and the slashes you define what will be. When you receive it on the other side you will know what you want to receive, which means the address you're sending. So you will configure the server or the receiver to do something when it receives a message from a specific adress.
In the same way, you are appending values to the message. The quantity of values you already know, so you just have to do what you want with them when you receive.
Basically, if you decide to have a keyboard sending notes, you would use something like /keyboard/note as adress and send one value at a time, so you would read this value and do something with it.

How would I design this scenario in Twilio?

I'm working on a YRS 2013 project and would like to use Twilio. I already have a Twilio account set up with over $100 worth of funds on it. I am working on a project which uses an external API and finds events near a location and date. The project is written in Ruby using Sinatra (which is going to be deployed to Heroku).
I am wondering whether you guys could guide me on how to approach this scenario: a user texts to the number of my Twilio account (the message would contain the location and date data), we process the body of that sms, and send back the results to the number that asked for them. I'm not sure where to start; for example if Twilio would handle some of that task or I would just use Twilio's API and do checking for smss and returning the results. I thinking about not using a database.
Could you guide me on how to approach this task?
I need to present the project on Friday; so I'm on a tight deadline! Thanks for our help.
They have some great documentation on how to do most of this.
When you receive a text you should parse it into the format you need
Put it into your existing project and when it returns the event or events in the area you need to check how long the string is due to a constraint that twilio has of restricting messages to 160 characters or less.
Ensure that you split the message elegantly and not in the middle of an event. If you were returned "Boston Celtics Game", "The Nut Cracker Play". you want to make sure that if both events cannot be put in one message that the first message says "Boston Celtics Game, Another text coming in 1 second" Or something similar.
In order to receive a text message from a mobile device, you'll have to expose an endpoint that is reachable by Twilio. Here is an example
class ReceiveTextController < ActionController
def index
# let's pretend that we've mapped this action to
# http://localhost:3000/sms in the routes.rb file
message_body = params["Body"]
from_number = params["From"]
SMSLogger.log_text_message from_number, message_body
end
end
In this example, the index action receives a POST from Twilio. It grabs the message body, and the phone number of the sender and logs it. Retrieving the information from the Twilio POST is as simple as looking at the params hash
{
"AccountSid"=>"asdf876a87f87a6sdf876876asd8f76a8sdf595asdD",
"Body"=> body,
"ToZip"=>"94949",
"FromState"=>"MI",
"ToCity"=>"NOVATO",
"SmsSid"=>"asd8676585a78sd5f548a64sd4f64a467sg4g858",
"ToState"=>"CA",
"To"=>"5555992673",
"ToCountry"=>"US",
"FromCountry"=>"US",
"SmsMessageSid"=>"hjk87h9j8k79hj8k7h97j7k9hj8k7",
"ApiVersion"=>"2008-08-01",
"FromCity"=>"GRAND RAPIDS",
"SmsStatus"=>"received",
"From"=>"5555992673",
"FromZip"=>"49507"
}
Source

How Can I Use xmpp4r To Detect The Online/Offline Status Of A Given Jabber ID?

What is the proper xmpp4r way to know if a given contact is online before sending them a message?
Can you post sample xmpp4r code for doing this?
Here is my use case:
If contact online, send :normal message
Else, email contact
Here are things I have working code for:
Send messages of various types
Get a roster/contact list
Register a call back to detect changes in presence
However, I can't find a place that directly addresses a work flow like this:
Loop through each JID in your roster
If jid.is_online? == true, send IM
Else, send email
I've read that you should send a JID a message of type :headline and if that fails, you know the user is offline. In my tests, if the user is ONLINE, they'll receive a message of type headline. This is suboptimal, as users should only receive messages to read, not noise to determine online status.
I've read that on sign on, all of your contacts will bounce a presence status back at you, and that status is the sole indication that they are online - assuming that there isn't a disconnect or presence change you've yet to receive. So you should register a presence call back, record the initial users who ping you back, and then add or remove from the list based on your running roster presence callback.
If this is truly the way to do it:
Can I get some example code of how to collect all the "I'm here" presence confirmations on sign on via xmpp4r?
Why, oh why, was xmpp designed this way and why is this better than offering an "is_online_and_available" method?
So the answer here is adding a message call back and checking inside the block for the type:
m = Message.new(to, body)
cl.send(m)
cl.add_message_callback do |m|
if m.type == :error
puts "type: #{m.type}"
else
puts "not an error"
end
end
This requires threading as you have to be listening for the response.

Selecting an outgoing mail message programmatically

Here's what I'm attempting to do: Let's assume that you are in mail and create a New blank mail message, then enter some data into it, such as body copy, etc. (in my case, the message was created through scripting bridge using the "Mail Contents of this Page" from safari... the main purpose of this process for my application.)
From my application, I want to select that message and assign it to:
MailOutgoingMessage *myMessage;
so that I can programmatically add recipients. I've tried several ways of doing this which seemed logical, but so far I haven't found the right combination, and the header file doesn't seem to be very clear to me (I'm new to scripting bridge.)
My initial thought was to try this:
mailMessage = [[mail outgoingMessages] lastObject];
Which should grab the last outgoing message created. It seems to work in that I am able to add recipients to mailMessage (though there have been a few times that I received unexpected results when multiple outgoing messages exist, such as adding the recipients to the wrong message) but attempting to log the subject line of the message:
NSLog(#"Subject = %#",[mailMessage subject]);
always returns NULL even though there is a subject clearly viewable in the subject field of the message. NULL is returned for any other parameter as well.
I'm gathering it must be a problem with my assignment to mailMessage above, because the only time I receive a NULL for message properties (or receive unexpected results) is if I try to point mailMessage to an existing outgoing message. If I create the mail message with scripting bridge, then I can retrieve all of the properties correctly.
Does anyone understand the hierarchy of the Mail scripting enough to tell me why I am getting NULLs for the parameters using the above assignment for mailMessage? What would the simplest way be go grab my message so that I can add recipients and later call the:
[myMessage send];
method? Any insight would be helpful. I've spent a week going through the mail.h header file and am quite literally at a loss as to what else to try at this point.
There's no way to (send, get or set the properties of the outgoing message) that the user or Safari has created.
It's a bug (it stopped working since Mac OS X 10.4), or some privacy/security considerations.

Resources