i see in examples how to pass message string amazon sns sdk's publish method. however, there exmaple of how pass custom object message? tried setting "messagestructure" "json" invalidparameter: invalid parameter: message structure - no default entry in json message body error. should passing object values in params?
any examples?
var params = { message: json.stringify(item), messagestructure: 'json', topicarn: topic //messageattributes: item }; return sns.publishasync(params);
there no sdk-supported way pass custom object message-- messages strings. can, of course, make string serialized version of object.
messagestructure: 'json' different purpose-- when want pass different strings different subscription types. in case, make message serialized json object aws-defined structure, each element defines message send particular type of subscription (email, sqs, etc). in case, messages strings.
messageattributes parameters add message support specific subscription types. if using sns talk apple's ios notification service, example, might have supply additional message parameters or authentication keys-- messageattributes provide mechanism this. described in this aws documentation.
Comments
Post a Comment