Skip to content

Commit

Permalink
Fix all links
Browse files Browse the repository at this point in the history
  • Loading branch information
mattvagni committed Nov 22, 2023
1 parent 713ec7f commit eaf656f
Show file tree
Hide file tree
Showing 30 changed files with 91 additions and 89 deletions.
2 changes: 1 addition & 1 deletion api-reference/attachments.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ At a high level to upload attachments you:

## Step by step guide

To try this, you will need an [API key](/graphql/authentication/) with the following permission:
To try this, you will need an [API key](/api-reference/graphql/authentication/) with the following permission:

- `attachment:create`

Expand Down
2 changes: 1 addition & 1 deletion api-reference/customer-cards.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Your API should then reply with a list of cards matching the requested keys wher

## UI Components

To define what each customer card should look like, you use the Plain UI components. All the components are documented in the [Plain UI Components](/ui-components/) section.
To define what each customer card should look like, you use the Plain UI components. All the components are documented in the [Plain UI Components](/api-reference/ui-components/) section.

You can find example Customer Cards and an example API you can check out [team-plain/example-customer-cards](https://github.com/team-plain/example-customer-cards). Feel free to try these out in your workspace!

Expand Down
6 changes: 3 additions & 3 deletions api-reference/customer-cards/documentation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: 'Customer Cards Documentation'

This page is intended for a technical audience that will be implementing a Customer Card API.

Check out the [Customer Cards](/pages/customer-cards) page for an overview.
Check out the [Customer Cards](/customer-cards) page for an overview.

## Protocol overview

Expand All @@ -20,7 +20,7 @@ The protocol is as follows:
details).
4. Your APIs are then called with the customer's details, so you can look up the customer's data in your systems
(see [request](#request) section for details).
5. Your APIs then return Customer Cards that consist of [Plain UI components](/ui-components)
5. Your APIs then return Customer Cards that consist of [Plain UI components](/api-reference/ui-components)
(see [response](#response) section for details).
6. The cards are cached based on either an explicit TTL value in the response or the TTL in the card settings.
7. Cards are shown to the user in Plain.
Expand Down Expand Up @@ -122,7 +122,7 @@ The response body must be a JSON object with:
cards will be ignored.
- `key`: the requested key
- `timeToLiveSeconds` (optional, nullable): can either be omitted or `null`. If provided it will override the default time to live value. This allows you to control caching on a case-by-case basis.
- `components` (nullable): `null` to indicate that the card has no data or an array of [Plain UI Components](/ui-components/).
- `components` (nullable): `null` to indicate that the card has no data or an array of [Plain UI Components](/api-reference/ui-components/).

Example response body for a card cached for 1 hour:

Expand Down
6 changes: 3 additions & 3 deletions api-reference/graphql/customers.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ However, using our API to manage customers proactively can be helpful when you a

For example:

- You can [**put customers into groups**](/graphql/customers-setup/customer-groups/) to better organize your support queue. For example, you could group customers by pricing tier (e.g. Free Tier, Teams, Enterprise)
- You can [**create customers**](/graphql/customers-setup/upsert/) in Plain when they sign-up on your own site so that you can reach out to them proactively without waiting for them to get in touch.
- You can [**save your own customer's ID**](/graphql/customers-setup/upsert) for use with [**Customer Cards**](/customer-cards/).
- You can [**put customers into groups**](/api-reference/graphql/customers/customer-groups/) to better organize your support queue. For example, you could group customers by pricing tier (e.g. Free Tier, Teams, Enterprise)
- You can [**create customers**](/api-reference/graphql/customers/upsert/) in Plain when they sign-up on your own site so that you can reach out to them proactively without waiting for them to get in touch.
- You can [**save your own customer's ID**](/api-reference/graphql/customers/upsert) for use with [**Customer Cards**](/customer-cards/).
2 changes: 1 addition & 1 deletion api-reference/graphql/customers/delete.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: 'Delete customers'

You can delete customers with the `deleteCustomer` API, you will find this name in both our API and our SDKs.

To delete a customer you will need the customer's ID from within Plain. You can get this ID in the UI by going to a thread from that customer and pressing the 'Copy ID' button from the customer details panel on the right, or via our [fetch API](/graphql/customers/get).
To delete a customer you will need the customer's ID from within Plain. You can get this ID in the UI by going to a thread from that customer and pressing the 'Copy ID' button from the customer details panel on the right, or via our [fetch API](/api-reference/graphql/customers/get).

Deleting a customer will trigger an asynchronous process which causes all data (such as threads) associated with that customer to be deleted.

Expand Down
2 changes: 1 addition & 1 deletion api-reference/graphql/customers/get.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ All of these endpoints require the following permissions:

## Get customers

Our API allows you to fetch customers as a collection using `getCustomers` in our SDKs or the `customers` query in GraphQL. In both cases this endpoint supports [Pagination](/graphql/pagination).
Our API allows you to fetch customers as a collection using `getCustomers` in our SDKs or the `customers` query in GraphQL. In both cases this endpoint supports [Pagination](/api-reference/graphql/pagination).

This is a very flexible endpoint which supports a variety of options for filtering and sorting, for full details try our [API explorer](https://app.plain.com/developer/api-explorer/) or [Typescript SDK](https://github.com/team-plain/typescript-sdk/).

Expand Down
2 changes: 1 addition & 1 deletion api-reference/graphql/error-handling.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Every `MutationError` has the following fields (assuming you included all these
- Where `VALIDATION` means input validation failed. See the fields for details on why the input was invalid.
- Where `FORBIDDEN` means the user is not authorized to do this mutation. See `message` for details on which permissions are missing.
- Where `INTERNAL` means an unknown internal server error occurred. Retry in this scenario and contact [email protected] if the error persists.
- **code:** a unique error code for each type of error returned. This code can be used to provide a localized or user-friendly error message. You can find the [list of error codes](/error-codes) documented.
- **code:** a unique error code for each type of error returned. This code can be used to provide a localized or user-friendly error message. You can find the [list of error codes](/api-reference/graphql/error-codes) documented.
- **fields:** an array containing all the fields that errored
- **field:** the name of the input field the error is for.
- **message:** an English technical description of the error. This error is usually meant to be read by a developer and not an end user.
Expand Down
6 changes: 3 additions & 3 deletions api-reference/graphql/events.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ Events are created via the Plain API and you have full control of what they look

There are two types of events

- **[Customer events](/graphql/events/create-customer-event)**: these are created in every existing thread for a customer. When a anew thread is created (e.g. by an inbound communication, or by calling the [createThread](/graphql/threads/create) endpoint) the **25** most recent events are shown.
- **[Thread events](/graphql/events/create-thread-event)**: these events belong to a single thread, and only appear in a single thread's timeline.
- **[Customer events](/api-reference/graphql/events/create-customer-event)**: these are created in every existing thread for a customer. When a anew thread is created (e.g. by an inbound communication, or by calling the [createThread](/api-reference/graphql/threads/create) endpoint) the **25** most recent events are shown.
- **[Thread events](/api-reference/graphql/events/create-thread-event)**: these events belong to a single thread, and only appear in a single thread's timeline.

## UI Components

To define what each event should look like, you use the Plain UI components. All the components are documented in the [Plain UI Components](/ui-components/) section.
To define what each event should look like, you use the Plain UI components. All the components are documented in the [Plain UI Components](/api-reference/ui-components/) section.

### Playground

Expand Down
6 changes: 3 additions & 3 deletions api-reference/graphql/events/create-customer-event.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ title: 'Create a customer event'
<Info>
A customer event will be created in all threads that belong to the provided customer ID. If you
want an event to appear in a specific thread use a [thread
event](/graphql/events/create-thread-event).
event](/api-reference/graphql/events/create-thread-event).
</Info>

To create an event you need a customer ID.

You can get this by [upserting a customer](/graphql/customers/upsert) in Plain, from data in webhooks or other API calls you made. If you want to test this, press **⌘ + K** on any thread and then "Copy customer ID" to get an ID you can experiment with.
You can get this by [upserting a customer](/api-reference/graphql/customers/upsert) in Plain, from data in webhooks or other API calls you made. If you want to test this, press **⌘ + K** on any thread and then "Copy customer ID" to get an ID you can experiment with.

In this example we'll be creating the following event:

<Frame>![Example event](/public/images/events/events-example.png)</Frame>
<Frame>![Example event](/public/images/events-api-key-example.png)</Frame>

<Tabs>
<Tab title="Typescript SDK">
Expand Down
7 changes: 4 additions & 3 deletions api-reference/graphql/events/create-thread-event.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@ title: 'Create a thread event'

<Info>
A thread event will only be created in the thread ID provided. If you want an event to appear in
all threads for a customer please use a [customer event](/graphql/events/create-customer-event).
all threads for a customer please use a [customer
event](/api-reference/graphql/events/create-customer-event).
</Info>

To create a thread event you need a thread ID.

You can get this by [creating a thread](/graphql/threads/create) in Plain, from data in webhooks or other API calls you made. If you want to test this, press **⌘ + K** on any thread and then "Copy thread ID" to get an ID you can experiment with.
You can get this by [creating a thread](/api-reference/graphql/threads/create) in Plain, from data in webhooks or other API calls you made. If you want to test this, press **⌘ + K** on any thread and then "Copy thread ID" to get an ID you can experiment with.

In this example we'll be creating the following event:

<Frame>![Example event](/public/images/events/events-example.png)</Frame>
<Frame>![Example event](/public/images/events-api-key-example.png)</Frame>

<Tabs>
<Tab title="Typescript SDK">
Expand Down
6 changes: 3 additions & 3 deletions api-reference/graphql/introduction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: "An overview of Plain's GraphQL API."

Plain is built with this very GraphQL API we expose to you. This means that there are **no limitations** in what can be done via the API vs the UI.

These docs just highlight the most interesting and most used APIs. If you want to do something beyond what is documented here, please [reach out to us](mailto:[email protected]) or explore our [schema](/docs/api-reference/graphql/schema) on your own!
These docs just highlight the most interesting and most used APIs. If you want to do something beyond what is documented here, please [reach out to us](mailto:[email protected]) or explore our [schema](/api-reference/graphql/schema) on your own!

## Key details

Expand All @@ -16,7 +16,7 @@ Our API is compatible with all common GraphQL clients with the following details
- **Allowed method**: POST
- **Required headers:**
- `Content-Type: application/json`
- `Authorization: Bearer <token>` where token is your API key. See [authentication](/graphql-api/authentication/) for more details.
- `Authorization: Bearer <token>` where token is your API key. See [authentication](/api-reference/graphql/authentication/) for more details.
- **JSON body:**
- `query`: the GraphQL query string
- `variables`: a JSON object of variables used in the GraphQL query
Expand All @@ -29,7 +29,7 @@ from: `https://core-api.uk.plain.com/graphql/v1/schema.graphql`

In this example, we're going to get a customer in your workspace by their email address. You can find a customer's email on the right-hand side when looking at one of their threads in Plain.

You will need an API key with the `customer:read` permission. See [authentication](/graphql-api/authentication/) for details on how to get an API key
You will need an API key with the `customer:read` permission. See [authentication](/api-reference/graphql/authentication/) for details on how to get an API key

<Tabs>

Expand Down
2 changes: 1 addition & 1 deletion api-reference/graphql/labels.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ The available labels you can apply are defined by your label types. Label types

When you want to stop a label being available you can archive a label type. Archived label types are kept on existing threads in order to avoid losing valuable historic data.

Label changes can also be a starting point for integrations [via our webhooks](/webhooks/thread-labels-changed). This lets you build workflows triggered by the addition of a label.
Label changes can also be a starting point for integrations [via our webhooks](/api-reference/webhooks/thread-labels-changed). This lets you build workflows triggered by the addition of a label.
14 changes: 11 additions & 3 deletions api-reference/graphql/messaging.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,21 @@ sidebarTitle: 'Overview'
We provide various methods to message your customers with the Plain API. You can use this to reach out proactively, build an autoresponder or even to handle things like waiting list access.

<CardGroup cols={2}>
<Card title="Send emails" icon="paper-plane-top" href="/pages/graphql/messaging/send-email">
<Card
title="Send emails"
icon="paper-plane-top"
href="/api-reference/graphql/messaging/send-email"
>
Send a new email in a thread ignoring previous communications.
</Card>
<Card title="Reply to emails" icon="paper-plane-top" href="/pages/graphql/messaging/reply-email">
<Card
title="Reply to emails"
icon="paper-plane-top"
href="/api-reference/graphql/messaging/reply-email"
>
Use this to reply to an existing inbound email in a thread.
</Card>
<Card title="Reply to thread" icon="reply" href="/pages/graphql/messaging/reply-email">
<Card title="Reply to thread" icon="reply" href="/api-reference/graphql/messaging/reply-email">
Reply to a thread automatically using the best channel.
</Card>
</CardGroup>
8 changes: 4 additions & 4 deletions api-reference/graphql/messaging/reply-to-thread.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ title: 'Reply to threads'
You can reply to a thread using the `replyToThread` mutation. The call to this mutation will be successful if:

- the last message in the thread is an email from the customer OR
- the thread was just created with [`createThread`](/graphql/threads/create)
- the thread was just created with [`createThread`](/api-reference/graphql/threads/create)

If it is not possible to reply to this thread, you will get the mutation error code [`cannot_reply_to_thread`](/graphql/error-codes#cannot_reply_to_thread) and a message indicating why.
If it is not possible to reply to this thread, you will get the mutation error code [`cannot_reply_to_thread`](/api-reference/graphql/error-codes#cannot_reply_to_thread) and a message indicating why.

<Info>
Using the `replyToThread` mutation is the recommended way to create a simple auto-responder with
Plain. To do it, you should subscribe to the
[`thread.thread_created`](/../../webhooks/thread-created) event and use use this mutation whenever
you get this event.
[`thread.thread_created`](/api-reference/webhooks/thread-created) event and use use this mutation
whenever you get this event.
</Info>

<Tabs>
Expand Down
4 changes: 2 additions & 2 deletions api-reference/graphql/threads/create.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ Creating a thread is useful in scenarios where you want to programatically start

You can do this in many different scenarios but the most common use-cases are when a contact form is submitted or when you want to provide proactive support off the back of some event or error happening in your product.

A thread is created with an initial 'message' composed out of [UI components](/docs/ui-components). You have full control over the structure and appearance of the message in Plain.
A thread is created with an initial 'message' composed out of [UI components](/api-reference/ui-components). You have full control over the structure and appearance of the message in Plain.

To create a thread you need a `customerId`. You can get a customer id by [creating the customer](/docs/customers/upsert) in Plain first.
To create a thread you need a `customerId`. You can get a customer id by [creating the customer](/api-reference/graphql/customers/upsert) in Plain first.

<Tabs>
<Tab title="Typescript SDK">
Expand Down
Loading

0 comments on commit eaf656f

Please sign in to comment.