Community

Community Forums

Where our customers, developers, and more can come together to help each other with both general and technical questions about our products and services.

Schedule API for Push Message

Jane Drury

Hi, 

I need help in scheduling the Push via API but I am struggling with 

1- Send push notification at UTC+4 (not local time)

2- Send the push to all selected audience despite the timezones they are in (below is the code that I am using)

 

# -*- coding: utf-8 -*-
import datetime
import urbanairship as ua
 
airship = ua.Airship('XXXXXXX', XXXXXXXXXX') 


sched = airship.create_scheduled_push()
sched.schedule = ua.local_scheduled_time(datetime.datetime(2019, 06, 24, 12, 20, 00))

sched.push = airship.create_push()
sched.push.audience = ua.push.audience.segment('d05af748-07cd-450f-a106-893715325d58') #northern-ar

 
sched.push.notification = ua.notification(alert= 'سفاري صحراوي في درهم ', ios=ua.ios(extra={'dealid': '000000'}),android=ua.android(extra={'dealid': '000000'}))
 
sched.push.device_types = ua.device_types('ios', 'android')

response = sched.send()
print ('Created schedule. url:', response.schedule_url)
 
 
Waiting to hear from you soon!
 

Please sign in to leave a comment.

0
Avatar

Hi Jane,

This looks like python (correct me if i'm wrong). May I ask if you have taken a look at the following link regarding the Python libraries that are on offer?

https://docs.airship.com/api/libraries/python/

There should be an example in there that you can use to test. With your script, have you tried to execute it and if so, what is the response you are receiving?

Kind regards,

Chilun Liu

Senior Technical Support Engineer Airship

The Embassy Tea House, 195-205 Union Street, London, SE1 0LN

Portland | San Francisco | London | Paris | New York | New Delhi

chilun liu 0 votes