Slack
Add astrology capabilities to Slack with an Occult API-powered slash command.
Slack App
Create a Slack app at api.slack.com/apps and add a slash command such as /horoscope. Set the command URL to your backend endpoint.
Endpoint
Point the slash command to your server route, for example https://your-domain.com/slack/horoscope.
Node.js Handler
An Express handler that calls Occult API and returns the result:
app.post('/slack/horoscope', async (req, res) => {
const text = req.body.text || 'aries';
const sign = text.trim().split(' ')[0];
const response = await fetch('https://api.occultapi.com/api/astro/rashifal/daily/', {
method: 'POST',
headers: { 'X-API-Key': process.env.OCCULT_API_KEY, 'Content-Type': 'application/json' },
body: JSON.stringify({ rashi: sign }),
});
const data = await response.json();
res.json({ response_type: 'in_channel', text: data.get_daily_rashifal.general_prediction });
});Usage
Type /horoscope leo in any Slack channel to receive the daily horoscope for Leo.