Migrating from the Grammarly Text Editor SDK
Important: The Grammarly Text Editor SDK will no longer be updated and will be deprecated on January 10, 2024. We suggest removing the integration from your app or website before that date. - Grammarly
The Grammarly Text Editor SDK will be discontinued on January 10, 2024 (source). Current Grammarly for Developers applications will function normally until the discontinuation date, new registrations are halted, and developers with recent registrations have until July 26, 2023, to create new apps with the SDK.
Grammarly SDK alternative
This is a quick guide for developers using the Grammarly SDK who are interested in maintaining spelling or grammar check functionality in their web applications. The functionality of Sapling's AI Writing Assistant can be included in any application as a drop-in replacement for the Grammarly SDK. The AI-powered Sapling SDK offers not only spelling and grammar checking, but also additional features such as tone analysis, AI content detection, context-aware suggestions, multilingual support, and much more. If you're looking for a Grammarly SDK alternative, this guide will help you make the transition.
API Access
Anyone can test out Sapling's API. To get started with the API, simply:
- Register for a Sapling account here.
- Once you've registered and signed in, visit your Sapling API settings dashboard.
- Click the Generate Key button under the "API" section of the settings pane.
- Start using the API by following the API documentation. We recommend starting with the Edits Overview guide.
Trial development keys allow for processing of 50,000 characters every 24 hours. Subscribe for production access and usage-based pricing.
Replacing Grammarly with Sapling
We cover both how to use Sapling through an HTML script
tag, as well as how to bundle it with your JavaScript application with npm
.
Besides changing an import and a new mechanism for observing an editable, remember to tag editables with sapling-ignore
to prevent users of the Sapling browser extension from getting duplicate UI elements.
HTML / JavaScript
Old Grammarly Code
<script src="https://cdn.jsdelivr.net/npm/@grammarly/editor-sdk?clientId=YOUR_CLIENT_ID"></script>
<grammarly-editor-plugin>
<div id="editor" contenteditable="true"></div>
</grammarly-editor-plugin>
New Sapling Code
<script src="https://cdn.sapling.ai/sapling-sdk.js"></script>
<div id="editor" sapling-ignore="true" contenteditable="true"></div>
<script type="text/javascript">
Sapling.init({
key: '<api-key>',
mode: 'dev',
});
const contentEditable = document.getElementById('editor');
Sapling.observe(contentEditable);
</script>
NPM
Old Grammarly Code
Installation:
npm install @grammarly/editor-sdk
Editor initialization:
<grammarly-editor-plugin>
<div id="editor" contenteditable="true"></div>
</grammarly-editor-plugin>
JavaScript initialization (we recommend adding this after the editor HTML):
import * as Grammarly from "@grammarly/editor-sdk";
await Grammarly.init("YOUR_CLIENT_ID");
New Sapling Code
Installation:
npm install @saplingai/sapling-js
Editor initialization:
<div id="editor" sapling-ignore="true" contentEditable="true">
</div>
JavaScript initialization (we recommend adding this after the editor HTML):
Sapling.init({
key: '<YOUR_API_KEY>',
mode: 'dev',
});
const editor = document.getElementById('editor');
Sapling.observe(editor);
Additional Functionality
Initialization Flags
Sapling's SDK also provides additional functionality that is not available in the Grammarly SDK:
- Support for other languages as well as language varieties (e.g., US or UK English).
- Custom error mappings and custom dictionaries.
- The ability to check text on a JavaScript callback instead of during textchange events to trigger checks manually or to reduce usage.
- Advanced Edits: corrections that go beyond regular spelling and grammar checking such as for DEI initiatives.
- Customization of the the edit UI and color scheme through style customization.
Backend API
Sapling provides a "headless" API that works without HTML UI elements as well. You can use this to power your backend applications. The npm
JavaScript SDK supports this behavior natively, and we also provide a Python SDK. For other languages, you can call the HTTP endpoint with your API key. We include examples here: https://sapling.ai/programming-languages.
Next Steps
- You can browse Sapling's SDK functionality and learn more about the platform through our Developer Documentation.
- Remember to to remove the Grammarly SDK in your code as well as in your
package.json
. - If at any point you run into issues with implementation or testing, feel free to reach out to us at support@sapling.ai or our Discord channel. We also try to answer all questions tagged
sapling
on Stackoverflow.