Welcome to the Node-RED forum.
Can I suggest, as a starting point, you show what you have done so far. By this I mean 'share' your NR flow here. This will enable people to help you (as at the moment any suggestion offered would be a complete guess).
This is how to share your code.