https://github.com/circuit/circuit-rest-bot
A bot that uses RESTful API calls to monitor a conversation for circuit.
https://github.com/circuit/circuit-rest-bot
api circuit circuit-sdk expr express oauth2 rest-api
Last synced: 9 months ago
JSON representation
A bot that uses RESTful API calls to monitor a conversation for circuit.
- Host: GitHub
- URL: https://github.com/circuit/circuit-rest-bot
- Owner: circuit
- Created: 2018-09-11T13:02:46.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-11T00:58:28.000Z (about 3 years ago)
- Last Synced: 2025-02-09T20:33:44.238Z (11 months ago)
- Topics: api, circuit, circuit-sdk, expr, express, oauth2, rest-api
- Language: JavaScript
- Homepage:
- Size: 42 KB
- Stars: 2
- Watchers: 9
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Circuit RESTful bot GET | POST | Webhook
==================================
## Description
This is an example bot that uses RESTful API calls to monitor a conversation on circuit. The bot will log the most recent items in the conversation, post a new item once it is listening, and then log any new items posted in the conversation.
## Prerequisites
[](https://nodejs.org)
* Developer account on circuitsandbox.net. Get it for free at [developer registration](https://circuit.github.io/).
* OAuth 2.0 `client_id` and optionally `client_secret`. Get if for free at [circuit.github.com/oauth](https://circuit.github.com/oauth).
## Dependencies
* [express](https://www.npmjs.com/package/express)
* [node-fetch](https://www.npmjs.com/package/node-fetch)
* [simple-oauth2](https://www.npmjs.com/package/simple-oauth2)
## REST Reference
Other examples of RESTful API's with circuit can be found [here](https://circuitsandbox.net/rest/v2/swagger/ui/index.html).
## Usage
1. Clone the respository.
2. Run : `$ npm install`.
3. Rename `config.json.template` to `config.json` after adding your `client_id`, `client_secret`, `url`, and the `port` the bot will run on. The `url` field should refer to the return url the webhook should send data to. Once you have done so all you need to do is run `$ npm start` and the bot will begin.
* Note: The bot must be a part of the conversation it is listening to.
4. If you want to host this on your local machine you can use something like [ngrok](https://ngrok.com/) to host the bot. For the webhooks just add the ngrok url as the `url` field in the `config.json` file, make sure you serve the ngrok tunnel on the same port as the bot.