Typescript SDK

For all of its versatility and power, GraphQL can be tricky to set up. Especially if you just want to open an issue in Plain or submit a contact form.

To make it easier to use our API, today we are releasing our first SDK for Typescript and its open source:

https://github.com/team-plain/typescript-sdk

It doesn't allow you to do everything our GraphQL API does but it does handle the majority of use cases (and makes those a breeze).

This first version lets you:

  • Create custom timeline entries to submit contact forms
  • Log events that happen in your systems through timeline entries
  • Create, update and get customers
  • Create issues
  • Add and remove customers from customer groups

For example—this is how you create a customer in Plain:

import { PlainClient } from '../client';

const client = new PlainClient({ apiKey: 'plainApiKey_123' });

const res = await client.upsertCustomer({
  identifier: {
    email: 'jerry@acme.com',
  },
  onCreate: {
    fullName: 'Jerry Field',
    email: {
      email: 'jerry@acme.com',
      isVerified: true,
    },
  },
  onUpdate: {},
});

if (res.error) {
  console.error(res.error);
} else {
  console.log(`Created customer with ${res.data.id}`);
}

To show off the SDK we've built a very fancy example contact form:



If you’re looking for some inspiration,check out the code. It's all open source!

We'll be extending the functionality of the SDK very soon and creating SDKs for other languages. If you don't work with Typescript—let us know and we can help!

Besides that...

✨ Small but important improvements

  • You can now see the preview of a message in email notifications so you can triage inbound emails more quickly.
  • Improved handling of failures with our Slack notifications app.
  • Improved the timings of the animations when a customer exits a queue.
  • Added queries for myWorkspace, myPermissions and myMachineUser to make it easier to get your workspace, permissions and user when using our API via a Machine User.

🐛 Bugs squashed

  • Various dark mode fixes to the email composer and customer groups UI.
  • You are no longer stuck on error pages and now have a handy back button which will take you somewhere safe.
  • Fixed a bug which sometimes resulted in customer group counts being incorrect.
  • Fixed a bug which prevented you from navigating back when setting up email as part of the sign-up flow.
  • Fixed a bunch of inconsistent spacing in tags in customer queues.
  • #changelog

Get started with Plain ✨

Sign up now and provide support that's as polished as your product.

Join us 👩‍💻

…and write the next post. We're growing our small but mighty team.

© Plain. CS without the BS since 2020.
plain.com