Send Template Push Notification on 'local_scheduled_time'

I'm trying to configure sending a push notification to a template (via the API) such that the subscribers will receive the push notifications at the specified local_scheduled _time. As a first step, I've successfully set up sending push notifications (immeadiate send) via api/templates/push with such a payload (I've stubbed in dummy data):

{

"device_types":["ios","android"],
"audience":{"tag":"test_audience","group":"test"},
"merge_data":{
"template_id":"3d6ecd76-45b9-4de1-b3ac-686cd470a0f3",
"substitutions":{"publication":"Test Publication","article_id":"test.v74.n3.7"}}

}

When I tried to extend this to send such a push notification by a specified time (local_scheduled_time) by adding the schedule object I've encountered problems with the compatibility of payloads. Take the following request payload sent to api/schedules endpoint:

{
"schedule": {
"local_scheduled_time": "2018-10-05T11:25:00"
},
"push": {
"device_types":["ios","android"],
"audience":{"tag":"test_audience","group":"test"},
"merge_data":{
"template_id":"3d6ecd76-45b9-4de1-b3ac-686cd470a0f3",
"substitutions":{"publication":"Test Publication","article_id":"test.v74.n3.7"}}
}
}

This resulted in an error message: "The key 'merge_data' is not allowed in this context"

Then, when I attempted the same push to api/templates/push, I received the error message "The key 'schedule' is not allowed in this context"

Considering the errors I've encountered: Is it possible to do this - to send templated push notifications but on a specified time? If so, how can I accomplish this?

Didn't find what you were looking for?

New post

Comments

2 comments

  • Hi Justin, have you reviewed our documentation on the Schedule Template Push API?

     

    There is a specific endpoint for scheduled template pushes:

    https://docs.urbanairship.com/api/ua/#operation/api/templates/push/schedules/post

    Comment actions Permalink
  • Brian G, Thank you for your response and pointing me to the location of the sample payload for 'scheduled' template push notifications. I simply must have overlooked the section of the documentation pertaining to exactly that. I've implemented the requets payolad as indicated in the documentation and it works perfectly. Thank you for your time!

    Justin

    Comment actions Permalink
    0

Please sign in to leave a comment.