resubscribe-sdk
v1.0.13
Published
Resubscribe.ai SDK for TypeScript
Downloads
68
Maintainers
Readme
Resubscribe.ai SDK
The official TypeScript SDK for Resubscribe.
Usage
Direct Link
Directly link your users to Resubscribe.
import Resubscribe from 'resubscribe-sdk';
const url = await Resubscribe.getLink({
email: '[email protected]',
userId: 'user_987654321',
});
// add url to an email, push notification, etc.
Cancellation Events
Send an email to your users when they cancel their subscription.
TypeScript:
import Resubscribe from 'resubscribe-sdk';
// init API key
Resubscribe.init({
apiKey: process.env.RESUBSCRIBE_API_KEY, // your API key
};
// register an event
Resubscribe.registerEvent(
{
id: 'event_12346789',
type: 'cancellation-unsubscribe-paid',
},
{
userId: 'user_987654321',
email: '[email protected]',
},
);
Node.js:
const Resubscribe = require('resubscribe-sdk').default;