Send push from my site

Hi guys, can I send push from my site without using the dashboard ionic? reading the documentation there are no external API for send it out of dashboard or ionic app

Thank you all

1 Like

https://devdactic.com/ionic-push-notifications-guide/

search this keyword ‘The Body section of our push:’…

1 Like

thanks for reply… now study how to transform curl request in ajax :wink:

Hi harith5757,
do you know how to schedule ionic push in curl?

im using .net web service. but i think it will be the same concept. you
just need to make a http post call with the given condition.

yes, but I can’t find documentation anywhere… I understand how to set tag for scheduling

here it is.

public string PostIonicNotificationRequest(IonicPushNotification notification, string ionicToken)
        {
            try
            {
                string url = "https://api.ionic.io/push/notifications";
                System.Net.WebRequest request = System.Net.WebRequest.Create(url);
                request.Method = "POST";
                request.ContentType = "application/json";
                request.Headers.Add("Authorization", string.Format("Bearer {0}", ionicToken));

                var parameters = new StringBuilder();
                parameters.Append(Newtonsoft.Json.JsonConvert.SerializeObject(notification));
                System.IO.Stream dataStream1 = request.GetRequestStream();
                System.IO.StreamWriter writer = new System.IO.StreamWriter(dataStream1);

                writer.Write(parameters.ToString());
                writer.Close();

                return GetReponse(request, url);
            }
            catch (Exception ex)
            {
                logger.Error(ex);
                return null;
            }
        }

where your notification is the json data. p/s this one is asp.net. but the language does not matter. XD

Yes I wrote similar code for my call …but problem is how to set deferred push

$.ajax({
                            url: "https://api.ionic.io/push/notifications",
                            beforeSend: function(xhr) { 
                                xhr.setRequestHeader("Authorization", "Bearer key"); 
                            },
                            type: 'POST',
                            dataType: 'json',
                            contentType: 'application/json',
                            data: '{"tokens": "+token"],  "profile": "profiletest", "notification": { "message": "'+message+'": {"payload": "'+payload+'"}}}',
                            success: function (data) {
                              
                            },
                            error: function(){
                            }
                        });

any case thanks for help I owe you a beer XD

lol didnt read that “deferred” u want to send the push notification at the specific time? if so, i believe its the scheduled that you need. refer to this link a

1 Like