Get a random quote from qdb.us and to post to a slack channel
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
server
.gitignore
README.md
package-lock.json
package.json

README.md

QDB Slack Integration

Get a random quote from http://www.qdb.us/ and to post to a slack channel

Using https://www.npmjs.com/package/qdb-api for Quotes Database API

To Run

  • Activate incoming webhooks on your Slack workspace
  • Add a webhook url to a particular Slack channel
  • add the HOOK_URL to your local environment variables file
  • Go to http://localhost:3000/quote to see your random quote in the selected Slack channel

APIs available

  • Get a random quote
  • Get the latest quote
  • Get specific quote by it's id
  • Search for a quote

Get a random quote

qdb.random()
	.then(quote => {
		console.log(quote.id);
		console.log(quote.score);
		console.log(quote.text);
	})
	.catch(reason => {
		console.log(reason);
	});

Get the latest quote

qdb.latest()
	.then(quote => {
		console.log(quote.id);
		console.log(quote.score);
		console.log(quote.text);
	})
	.catch(reason => {
		console.log(reason);
	});

Get a specific quote by it's id

qdb.get(4680)
	.then(quote => {
		console.log(quote.id);
		console.log(quote.score);
		console.log(quote.text);
	})
	.catch(reason => {
		console.log(reason);
	});

Search for a quote

qdb.search('tom', 0, 10)
	.then(quotes => {
		quotes.forEach(quote => {
			console.log(quote.id);
			console.log(quote.score);
			console.log(quote.text);
		});
	})
	.catch(reason => {
		console.log(reason);
	});