Publish a message
To send a notify message you have two options. You can publish a message as an email or SMS directly to a phone.
Paramaters​
type
- required​
Pass email
or sms
for which notify method you'd like to use.
Note: sms
only supports US numbers. If you have a need for outside US texting, contact us.
message
- required​
The primary message to be delivered via sms or email.
subject
- optional​
Only required if you are using type email
.
contacts
- required​
Type requirements
If
If
type = email
send a concated string of email contacts seperated by a ,
. E.g. example@example.com,example1@example.com
If
type = sms
send a concated string of phone numbers contacts seperated by a ,
. E.g. 1112223333,4445556666
Code Example​
- NodeJS
POST - https://api.particlespace.com/api/v1/notify/new
var axios = require('axios');
var qs = require('qs');
const BEARER_TOKEN = 'SET_ME';
var data = qs.stringify({
'message': 'Water has been detected in the NW Corner on the 4th floor.',
'type': 'sms',
'contacts': '1112223333'
});
var config = {
method: 'post',
url: 'https://api.particlespace.com/api/v1/notify/new',
headers: {
'Authorization': 'Bearer ' + BEARER_TOKEN
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});