Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR 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));
Source by documentation.onesignal.com #
 
PREVIOUS NEXT
Tagged: #signal #api #send #notification
ADD COMMENT
Topic
Name
4+5 =