OneSignal sending notification to all users in segment

Overview on what I’m looking to achieve:

A website which users can login (with different permissions defined by a database) and be sent notifications via OneSignal when a status of an order changes.

Currently I have the login system finished and users are placed into the correct segments on OneSignal (e.g. Suppliers). What I’m looking to do is trigger a notification to appear for all ‘Suppliers’ when an order’s status is updated.

Any ideas on how I can go about this? I’ve looked through all the documentation multiple times so please no comments just saying to do that.

Thanks in advance.

\<?php function sendMessage(){ $content = array( "en" =\> 'Test Message' ); $fields = array( 'app\_id' =\> "1a95c98a-9349-4876-b9ce-981893b7bf42", 'included\_segments' =\> array('Suppliers'), 'data' =\> array("userType" =\> "suppliers"), 'contents' =\> $content ); $fields = json\_encode($fields); print("\nJSON sent:\n"); print($fields); $ch = curl\_init(); curl\_setopt($ch, CURLOPT\_URL, "https://onesignal.com/api/v1/notifications"); curl\_setopt($ch, CURLOPT\_HTTPHEADER, array('Content-Type: application/json; charset=utf-8', 'Authorization: Basic NGEwMGZmMjItY2NkNy0xMWUzLTk5ZDUtMDAwYzI5NDBlNjJj')); curl\_setopt($ch, CURLOPT\_RETURNTRANSFER, TRUE); curl\_setopt($ch, CURLOPT\_HEADER, FALSE); curl\_setopt($ch, CURLOPT\_POST, TRUE); curl\_setopt($ch, CURLOPT\_POSTFIELDS, $fields); curl\_setopt($ch, CURLOPT\_SSL\_VERIFYPEER, FALSE); $response = curl\_exec($ch); curl\_close($ch); return $response; } $response = sendMessage(); $return["allresponses"] = $response; $return = json\_encode( $return); print("\n\nJSON received:\n"); print($return); print("\n"); ?\>

Hello @ant_birch and welcome to the Corona Labs forums. OneSignal may answer your question here, but this forum is for people using OneSignal with the Corona Labs suite of app development products (Corona SDK, Corona Enterprise and CoronaCards.). Most of our community members won’t have the expertise you need. 

Hopefully  you can get the answer you are looking for, but there may be other sites better suited to answering this question.

Rob

Hello @Rob Miracle. I noticed that this forum was for Corona but thought someone may have possible come across the same issueat some point. Fingers crossed. Thank you for the welcome message. :slight_smile:

I should point out I’m working with PHP and JavaScript.

Hello @ant_birch and welcome to the Corona Labs forums. OneSignal may answer your question here, but this forum is for people using OneSignal with the Corona Labs suite of app development products (Corona SDK, Corona Enterprise and CoronaCards.). Most of our community members won’t have the expertise you need. 

Hopefully  you can get the answer you are looking for, but there may be other sites better suited to answering this question.

Rob

Hello @Rob Miracle. I noticed that this forum was for Corona but thought someone may have possible come across the same issueat some point. Fingers crossed. Thank you for the welcome message. :slight_smile:

I should point out I’m working with PHP and JavaScript.