customerio / customerio-ruby

A ruby client for the Customer.io event API.
https://customer.io/docs/api/
MIT License
65 stars 75 forks source link

content-available: 1 is not attached to a transactional message #113

Open miguelespinoza opened 7 months ago

miguelespinoza commented 7 months ago

I'm working with an Expo mobile project, in which I'm trying to listen to background notifications. I managed to get it working through the customer.io transactional dashboard, using this custom payload:

{
  "aps": {
    "alert": {
      "title": "Customer.io push from dashboard",
      "body": "with content-available: 1"
    },
    "mutable-content": 1,
    "content-available": 1,
    "sound": "default"
  }
}

When I try with the ruby gem using custom_payload on the request body, I get none of the background listeners to execute, but I get the push notification. I suspect "content-available": 1 is not getting carried over to the transactional message payload

request = Customerio::SendPushRequest.new(
   ....
   custom_payload: {
      ios: {
          aps: {
             "content-available": 1
          },
      },
   },
)

Any pointers would be greatly appreciated!

miguelespinoza commented 7 months ago

I'll also add, this affects our ability to set badge count remotely. This does not work, I would expect this to relay directly to the device

request = Customerio::SendPushRequest.new(
   custom_payload: {
      ios: {
          aps: {
             "badge": 2,
          },
      },
   },
)
miguelespinoza commented 7 months ago

here's something interesting. I started to work directly with the REST API and found out this payload works, but link (for deep linking) no longer works.

{
  "transactional_message_id": "30",
  "link": "https://example.com/posts/:post_id",
  "identifiers": {
    "id": "user_id"
  },
  "custom_payload": {
    "ios": {
      "aps": {
        "alert": "Custom push title",
        "badge": 24,
        "content-available": 1
      }
    }
  }
}

The moment I remove custom_payload, I'm able to deep link into the post. I expect for the link property to work in conjunction with the aps properties. I'd imagine this would require a REST API adjustment. Anyone I can speak to about this?

miguelespinoza commented 7 months ago

update: figured out that link needs to be in CIO.push