Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

one signal api to send notification

const options = {
2  method: 'POST',
3  headers: {
4    Accept: 'application/json',
5    Authorization: 'Basic YOUR_REST_API_KEY',
6    'Content-Type': 'application/json'
7  },
8  body: JSON.stringify({
9    included_segments: ['Subscribed Users'],
10    contents: {en: 'English or Any Language Message', es: 'Spanish Message'},
11    name: 'INTERNAL_CAMPAIGN_NAME'
12  })
13};
14
15fetch('https://onesignal.com/api/v1/notifications', options)
16  .then(response => response.json())
17  .then(response => console.log(response))
18  .catch(err => console.error(err));
Comment

PREVIOUS NEXT
Code Example
Javascript :: req.params 
Javascript :: props in classes 
Javascript :: save text of div to localStorage, update localStorage when text is changed 
Javascript :: how to change string to array in javascript 
Javascript :: vue add watcher 
Javascript :: html video time 
Javascript :: javascript substration between times 
Javascript :: jquery parse url parameters 
Javascript :: basic json syntax 
Javascript :: arrow function vs function in javascript 
Javascript :: check if field exists in object javascript 
Javascript :: array validation in jquery 
Javascript :: add property to object javascript 
Javascript :: update an array element with an array in mongoose 
Javascript :: how to craete an array in js 
Javascript :: react computed example 
Javascript :: get nested objects via string 
Javascript :: why my favicon icon is not removing in react 
Javascript :: react form validation 
Javascript :: javascript, dynamic variable, and function to add data to O 
Javascript :: hot to start cypress 
Javascript :: inline style to change background color js 
Javascript :: reduce in javascript 
Javascript :: await javascript 
Javascript :: javascript destructing 
Javascript :: nodejs cache data 
Javascript :: auto create a test file in angular 
Javascript :: vue radio checked if 
Javascript :: findindex method javascript 
Javascript :: image react native base64 
ADD CONTENT
Topic
Content
Source link
Name
1+4 =