Papercuts is currently in closed beta. To get access, contact us at saurav@papercuts.ai.

Papercuts integration relies on a secure, OAuth-inspired linking mechanism. Lets quickly see how.

1. Generate a linkToken to initiate integration

Generate a linkToken from your backend to initiate a integration between your user’s account and Papercuts.

Response
{
  "status": "ok",
  "linkToken": "string"
}

You will need to replace the USER_ID with your user’s unique identifier, INTEGRATION_NAME with the integration you want to link to and YOUR_COMPANY_LOGO_URL with your company logo URL.

You can find the list of supported integrations below.

You can now pass the linkToken back to your client to initialize the user account integration.

2. Initiate user account integration

Use the linkToken to open the pre-built pop-up interface to link the user’s account.

  • Add the SDK to your project:
npm install @papercuts/react-papercuts-link
  • On the client, call the init method with the linkToken and callbacks to handle success and error.
import { PaperLink } from "@papercuts/react-papercuts-link"

export default function App() {
    const { open, isReady } = PaperLink.init({
        linkToken: "LINK_TOKEN",
        onSuccess
        onError
    })

    const onSuccess = (authToken: string) => {
        /* exchange the authToken for userToken in order to talk to Papercuts endpoints */
    }

    const onError = (errors: any) => {
        console.error("An error from Papercuts occured: ", errors)
    }

    return (
        <button disabled={!isReady} onClick={open}>Connect your account</button>
    )
}

export default App;

Once the user has connected their account, the onSuccess callback will be called with an authToken. You will need to exchange this authToken for a userToken to make requests on behalf of the user.

3. Exchange the short lived authToken

The authToken is a short-lived token that can be exchanged for a userToken that can be used to make requests on behalf of the user.

Response
{
  "status": "ok",
  "userToken": "string"
}

You will need to replace the AUTH_TOKEN with the authToken you received in the previous step.

Now the user account is linked and session details are stored securely with Papercuts. You can use the userToken to make requests on behalf of the user. Same userToken can be used for all connected integrations.

Next Steps

Overview

Execute actions using authenticated user sessions.