Posted at

Send notifications iPhone/iPad using Amazon SNS and Rails

More than 5 years have passed since last update.

Short hand

sns = AWS::SNS.new(

access_key_id: "key",
secret_access_key: "key",
region: "region")
client = sns.client
apns_payload = {aps: {alert: "hey it worked!", sound: "default"}}.to_json
message = {default: "this is the default", APNS: apns_payload }.to_json
client.publish message: message, topic_arn: "topic_arn", message_structure: "json"

References:

https://github.com/aws/aws-sdk-ruby/issues/336

http://www.jamesransom.net/?p=27