alexalok / dotAPNS

dotAPNS is a library used to send push notifications to Apple devices using Apple Push Notification service via HTTP/2 API.
Apache License 2.0
114 stars 34 forks source link

How to set a custom aps object #130

Closed Ghousepasha-ios closed 2 months ago

Ghousepasha-ios commented 2 months ago

Hello

I would like to set a custom aps object like below.

{ 'aps': { 'event': 'update', 'content-state': { 'payload': { 'aliasName': 'Location House', 'AccountNumber': '(123445566)', 'status': 2, 'statusText': 'Completed', 'title': 'ticket status' } }, 'timestamp': 1723119300 } }

alexalok commented 2 months ago

Hey there!

I believe this method is what you are looking for: ApplePush.AddCustomProperty(string key, object value, bool addToApsDict = false). You can use it like so:

ApplePush push = new ApplePush(ApplePushType.Alert)
    .AddCustomProperty("customPropertyKey", new { value1 = "123", value2 = 456 }, addToApsDict: true);
Ghousepasha-ios commented 2 months ago

@alexalok Yes, I found it here https://github.com/alexalok/dotAPNS?tab=readme-ov-file#or-to-the-aps-section.

Thank you