Simple wrapper to send Messages to Synology Chat
MIT License
Simple wrapper to send Messages to Synology Chat
๐ If you want a Go version, please check go-synology-chat ๐
debug
is supported ๐ชnpm install synology-chat-communicator
const { sendDirectMessage, getUsers, getChannels } = require('synology-chat-communicator')({
token: '<YOUR-TOKEN>',
baseUrl: 'https://<IP-OR-URL>:<PORT>',
ignoreSSLErrors: true
})
;(async () => {
const channels = await getChannels()
console.log("channels:", channels)
const users = await getUsers()
console.log("users:", users)
const user = users[0]
const userIdsList = users.map(({user_id}) => user_id)
const message = await sendDirectMessage(user.user_id, `Hello, ${user.username}!`)
console.log("message:", message)
const mediaMessage = await sendDirectMessage(user.user_id, `Check out this cool picture, ${user.username}!`, 'https://ulisesgascon.com/ulises_gascon.jpg')
console.log("Media Message:", mediaMessage)
const massiveMessage = await sendDirectMessage(userIdsList, "I am the new ๐ค. Chat with me!")
console.log("Massive Message:", massiveMessage)
})()
If you have a Synology NAS with invalid SSL certificates (due to expiration or other issues), you can disable the SSL validation in the requests generated by the library by using the configuration parameter ignoreSSLErrors
.
Please check out the official DSM Documentation to include new features
Development only:
Production only:
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
We use SemVer for versioning. For the versions available, see the tags on this repository.
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE.md file for details