Get notifications to your Slack about newly added items in Zotero libraries.
This is a plugin for Arkivo. Arkivo is a plugin platform for processing created/updated/deleted items from specified Zotero libraries.
- Node.js 7.6 or higher (needs await/async support)
- Redis running on localhost:6379
git clone https://github.com/mrtcode/arkivo-slack
cd arkivo-slack
npm install
Start Arkivo with enabled debug output.
DEBUG=arkivo:* $(npm bin)/arkivo up
- Go to https://my.slack.com/services/new/incoming-webhook/
- Choose a channel where you want this plugin to post messages.
- Click "Add Incoming WebHook integration".
- Copy the link from "WebHook URL" section.
Each subscription can have multiple plugins and each plugin can have a different configuration that is valid only for the specific subscription.
Arkivo has an integrated HTTP API which can be used to create, list or delete subscriptions.
Here is a request example to create a subscription with an activated and configured Arkivo Slack plugin:
curl -X POST http://localhost:8888/api/subscription \
-H 'Content-Type: application/json' \
-d @- << EOF
{
"url": "/users/123456/items/top",
"key": "vdZB5zVvYbai7ETJlln5vRyi",
"skip": true,
"plugins": [
{
"name": "slack",
"options": {
"webhookUrl": "https://hooks.slack.com/services/V9XBFPRFA/Y7XCFK4WG/ejO6LLyVlRKNqRpi1p4V2Mga"
}
}
]
}
EOF
Explanation of JSON parameters in the request:
url
- A path part of Zotero API endpoint URL that returns item array. For example:/users/123456/items
- fetch all updated items./groups/123456/items?tag=tag1
- fetch items with a matching tag./users/123456/items?q=title
- fetch items with a matching title./groups/123456/items?itemType=book
- fetch items with a matching item type./users/123456/collections/HNR32E9N/items
- fetch items from a specified collection.
key
- A Zotero access key to the library we are subscribing. For public libraries key isn't necessary.skip
- Skip processing already existing items.plugins[].name
- Activates the plugin for the current subscription.plugins[].options
- Plugin options for the current subscription. OnlywebhookUrl
is necessary for this plugin.
curl http://localhost:8888/api/subscription
curl -X "DELETE" http://localhost:8888/api/subscription/SUBSCRIPTION_ID