Sending alert notifications from scheduled triggers to slack channel

I went through documentation about sending notification to slack from trigger but I could not understand the below snippet from the documentation, could any one please let me know how to achieve below snippet.
(How to Send MongoDB Document Changes to a Slack Channel | MongoDB)

// Read a token from the environment variables
const token = context.values.get(‘SLACK_TOKEN’);
const channelId = context.values.get(‘CHANNEL_ID’);

I am using scheduled trigger to run periodically and send notifications or not based on the trigger logic.

Thank you,
Praveen