• Stars
    star
    109
  • Rank 319,077 (Top 7 %)
  • Language
    Elixir
  • License
    Apache License 2.0
  • Created over 7 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Canvas API CircleCI Deploy

This is the Canvas API, which provides an HTTP interface to Canvas resources, as well as event notifications over WebSockets.

Dependencies

  • PostgreSQL: The API stores data in PostgreSQL.
  • Redis: Redis is used for API's worker queue and for event broadcasting.

Slack OAuth

Canvas uses Slack for OAuth authentication. In order to run API, you will need to create a new Slack API app. The client ID and secret for this app should be set as SLACK_CLIENT_ID and SLACK_CLIENT_SECRET in the app environment.

Next, you'll want to set the redirect URLs for your Slack app, which should be the same as your REDIRECT_URI and ADD_TO_SLACK_REDIRECT_URI environment variables.

Also, you'll want to enable events for your Slack app (this should point to protocol://host/webhooks/slack with the message.channels subscription. Once this is enabled, get your verification token from the app credentials section of the Slack app admin interface and set it as SLACK_VERIFICATION_TOKEN.

Finally, enable a bot user for your Slack app.

GitHub

Canvas uses GitHub OAuth to unfurl GitHub links in Canvases, as well as to add events to canvas event pulses when canvases are mentioned in GitHub.

For the OAuth part, simply create a GitHub OAuth application and set the GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET environment variables. The callback URL for the app should look like protocol://host/oauth/github/callback.

Webhooks currently have to be created manually on a per-org basis. Your webhook's URL should look like protocol://host/webhooks/github?team.domain=teamdomain&team.id=teamid with an application/json content type. The individual events to listen on would be "Commit comment", "Issue comment", "Issues, "Pull request", "Pull request review", "Pull request review comment", and "Push".

Make sure and set the webhook secret as GITHUB_VERIFICATION_TOKEN.

Embedly

Canvas uses the Embedly API in order to unfurl links in canvases. Set an Embedly API key as EMBEDLY_API_KEY.

Running on Heroku

Canvas API should be the first Canvas app deployed. Use the Heroku button in this README and fill in environment variables appropriately.

Importing/Updating Templates

A global template may be imported using the command line if it is in the ".canvas" format (meaning that it has a top-level "blocks" key, not "attributes.blocks" as in JSON API.

mix canvas_api.import_templates $URL1 $URL2 $URL3

Or, for a Heroku app:

herkou run -a canvas-pro-api-prod \
  mix canvas_api.import_templates $URL1 $URL2 $URL3

Note that if the JSON from the URL contains an "ID" key, the canvas or template with that ID will be replaced with the new contents. This allows for the updating of templates. If you want to create a new template from an existing canvas, make sure to strip the ID out of the JSON.

More Repositories

1

canvas-editor

JavaScript
224
star
2

ios-v1

iOS app for Canvas V1
Swift
122
star
3

web-v2

JavaScript
92
star
4

realtime-v2

JavaScript
63
star
5

logoot-js

JavaScript implementation of the Logoot CRDT
JavaScript
31
star
6

searchql

Search query parser written in Elixir
Elixir
26
star
7

livedb-postgresql

A PostgreSQL adapter for livedb
JavaScript
24
star
8

logoot_ex

An Elixir implementation of the Logoot CRDT
Elixir
13
star
9

curse

capture and restore selections in HTML elements
JavaScript
11
star
10

CanvasText

Canvas text system for iOS & OS X
Swift
10
star
11

canvas-cli

The command line interface to usecanvas.com
Go
8
star
12

presence

Simple user presence
JavaScript
7
star
13

CanvasCore

Shared business logic between Swift-based Canvas clients.
Swift
6
star
14

ember-electron

Experimenting with Electron + Ember CLI
JavaScript
6
star
15

CanvasKit

Swift Canvas API client
Swift
6
star
16

hapi-request-id

Set Hapi request IDs from the X-Request-ID header
JavaScript
6
star
17

canvas-native-ex

Elixir library for the Canvas Native format.
Elixir
5
star
18

sharejs-wrapper

A wrapper around ShareJS
JavaScript
4
star
19

canvas-native-3

https://usecanvas.github.io/canvas-native-3
JavaScript
4
star
20

CanvasNative

Swift implementation of Canvas Native
Swift
4
star
21

share-js-stream

A stream for ws <-> ShareJS communication
JavaScript
2
star
22

OperationalTransformation

Swift library for working with OT against a ShareJS server.
HTML
2
star
23

canvas-text

JavaScript
1
star
24

canvas-native

Utilities for working with native Canvas documents
JavaScript
1
star
25

ember-selector

A selection utility for Ember apps
JavaScript
1
star