amazon sns - How to set TTL attribute in SNS with publish method (PHP-SDK) -
i using aws-sdk-php sending notification,i have search through documentation couldn't find example.
i have tried following code still not able set ttl notification(had tried data type number well):
refer:http://docs.aws.amazon.com/sns/latest/dg/sns-ttl.html#sns-ttl-console
$response = $client->publish(array( 'targetarn' => 'my arn', 'subject' => 'test notification', 'messageattributes'=>array( 'aws.sns.mobile.gcm.ttl' =>array( 'datatype' => 'string', 'stringvalue' => '10', ) ), 'message' =>json_encode(array( 'message'=>'new message !', )), ));
any light on path helpful
harshal
you can try :
$result = $this->client->publish( array( 'topicarn' => $this->topics[$topic], 'messagestructure' => 'json', 'message' => json_encode(array( 'default' => $message, 'apns' => json_encode(array( 'aps' => array( 'alert' => $message, 'sound' => 'ding.caf', 'badge' => '0' ), // custom payload parameters can go here 'type' => $type, 'source' => $source, )), 'gcm' => json_encode(array( 'data' => array( 'message' => $message, 'id' => $source, 'title' => 'yourapp', 'section' => $type, ), )), )), 'messageattributes' => array( 'aws.sns.mobile.gcm.ttl' => array( 'datatype' => 'number', 'stringvalue' => '43200', ), ), ) );
Comments
Post a Comment