From de562f3279a335101842cc1166ec812f130872ee Mon Sep 17 00:00:00 2001 From: Mathias Vagni Date: Sat, 18 Nov 2023 10:10:11 +0100 Subject: [PATCH] Update all snippets --- .../add-customer-to-group-by-group-id.mdx | 4 +- _snippets/graphql/add-customer-to-group.mdx | 4 +- _snippets/graphql/assign-thread.mdx | 4 +- _snippets/graphql/create-attachment-url.mdx | 6 +- _snippets/graphql/create-customer-event.mdx | 4 +- _snippets/graphql/create-thread.mdx | 4 +- _snippets/graphql/delete-customer.mdx | 4 +- _snippets/graphql/get-customer-by-email.mdx | 4 +- _snippets/graphql/get-customer-by-id.mdx | 4 +- _snippets/graphql/get-customers.mdx | 4 +- _snippets/graphql/mark-thread-as-done.mdx | 4 +- _snippets/graphql/mark-thread-as-todo.mdx | 4 +- _snippets/graphql/page-info-after.mdx | 8 +- ...emove-customer-from-groups-by-group-id.mdx | 10 +- .../graphql/remove-customer-from-groups.mdx | 12 +- _snippets/graphql/remove-labels.mdx | 4 +- _snippets/graphql/reply-email.mdx | 4 +- _snippets/graphql/send-email.mdx | 4 +- _snippets/graphql/snooze-thread.mdx | 4 +- _snippets/graphql/ui-divider.mdx | 2 +- _snippets/graphql/ui-spacer.mdx | 2 +- _snippets/graphql/unassign-thread.mdx | 4 +- _snippets/graphql/upsert-customer.mdx | 6 +- .../create-attachment-url-response.mdx | 2 +- .../typescript-sdk/create-attachment-url.mdx | 2 +- _snippets/webhooks/email-received.mdx | 120 +++++++++ _snippets/webhooks/email-sent.mdx | 123 +++++++++ .../thread-assignment-transitioned.mdx | 168 ++++++++++++ _snippets/webhooks/thread-labels-changed.mdx | 182 +++++++++++++ .../webhooks/thread-status-transitioned.mdx | 149 +++++++++++ pages/attachments.mdx | 240 +---------------- pages/customer-cards.mdx | 28 +- pages/customer-cards/documentation.mdx | 55 +--- pages/graphql/customers/customer-groups.mdx | 251 +----------------- pages/graphql/customers/delete.mdx | 46 +--- pages/graphql/customers/get.mdx | 144 +--------- pages/graphql/customers/upsert.mdx | 219 +-------------- pages/graphql/error-handling.mdx | 4 +- pages/graphql/events.mdx | 2 +- .../graphql/events/create-customer-event.mdx | 78 +----- pages/graphql/labels/add.mdx | 100 +------ pages/graphql/labels/remove.mdx | 39 +-- pages/graphql/messaging/reply-email.mdx | 45 +--- pages/graphql/messaging/send-email.mdx | 47 +--- pages/graphql/pagination.mdx | 56 +--- pages/graphql/threads/assignment.mdx | 167 +----------- pages/graphql/threads/create.mdx | 185 +------------ pages/graphql/threads/status-changes.mdx | 193 +------------- pages/ui-components/badge.mdx | 15 +- pages/ui-components/container.mdx | 22 +- pages/ui-components/copy-button.mdx | 18 +- pages/ui-components/divider.mdx | 29 +- pages/ui-components/link-button.mdx | 18 +- pages/ui-components/plain-text.mdx | 75 +----- pages/ui-components/row.mdx | 31 +-- pages/ui-components/spacer.mdx | 30 +-- pages/ui-components/text.mdx | 84 +----- pages/webhooks/customer-created.mdx | 46 +--- pages/webhooks/customer-deleted.mdx | 46 +--- .../customer-group-membership-changed.mdx | 108 +------- pages/webhooks/customer-updated.mdx | 77 +----- pages/webhooks/email-received.mdx | 121 +-------- pages/webhooks/email-sent.mdx | 128 +-------- .../thread-assignment-transitioned.mdx | 169 +----------- pages/webhooks/thread-created.mdx | 81 +----- pages/webhooks/thread-labels-changed.mdx | 183 +------------ pages/webhooks/thread-status-transitioned.mdx | 150 +---------- 67 files changed, 903 insertions(+), 3283 deletions(-) create mode 100644 _snippets/webhooks/email-received.mdx create mode 100644 _snippets/webhooks/email-sent.mdx create mode 100644 _snippets/webhooks/thread-assignment-transitioned.mdx create mode 100644 _snippets/webhooks/thread-labels-changed.mdx create mode 100644 _snippets/webhooks/thread-status-transitioned.mdx diff --git a/_snippets/graphql/add-customer-to-group-by-group-id.mdx b/_snippets/graphql/add-customer-to-group-by-group-id.mdx index 5c7a007..0256a92 100644 --- a/_snippets/graphql/add-customer-to-group-by-group-id.mdx +++ b/_snippets/graphql/add-customer-to-group-by-group-id.mdx @@ -1,4 +1,4 @@ -```json filename="Variables" +```json Variables { "input": { "customerId": "c_01GTC6ZHCMAGR06FMPN9VY5J95", @@ -11,7 +11,7 @@ } ``` -```json filename="Response" +```json Response { "data": { "customerGroupMemberships": [ diff --git a/_snippets/graphql/add-customer-to-group.mdx b/_snippets/graphql/add-customer-to-group.mdx index efdc7c6..e2e8080 100644 --- a/_snippets/graphql/add-customer-to-group.mdx +++ b/_snippets/graphql/add-customer-to-group.mdx @@ -1,4 +1,4 @@ -```graphql filename="Mutation" +```graphql Mutation mutation addCustomerToCustomerGroup($input: AddCustomerToCustomerGroupsInput!) { addCustomerToCustomerGroups(input: $input) { customerGroupMemberships { @@ -23,7 +23,7 @@ mutation addCustomerToCustomerGroup($input: AddCustomerToCustomerGroupsInput!) { } ``` -```json filename="Variables" +```json Variables { "input": { "customerId": "c_01GTC6ZHCMAGR06FMPN9VY5J95", diff --git a/_snippets/graphql/assign-thread.mdx b/_snippets/graphql/assign-thread.mdx index 3891f4c..3b353c0 100644 --- a/_snippets/graphql/assign-thread.mdx +++ b/_snippets/graphql/assign-thread.mdx @@ -1,4 +1,4 @@ -```graphql filename="Mutation" +```graphql Mutation mutation assignThread($input: AssignThreadInput!) { markThreadAsDone(input: $input) { thread { @@ -9,7 +9,7 @@ mutation assignThread($input: AssignThreadInput!) { } ``` -```json filename="Variables" +```json Variables { "input": { "threadId": "th_01H8H46YPB2S4MAJM382FG9423", diff --git a/_snippets/graphql/create-attachment-url.mdx b/_snippets/graphql/create-attachment-url.mdx index 434697d..ffb295e 100644 --- a/_snippets/graphql/create-attachment-url.mdx +++ b/_snippets/graphql/create-attachment-url.mdx @@ -1,4 +1,4 @@ -```graphql filename="Mutation" +```graphql Mutation mutation createAttachmentUploadUrl($input: CreateAttachmentUploadUrlInput!) { createAttachmentUploadUrl(input: $input) { attachmentUploadUrl { @@ -27,7 +27,7 @@ mutation createAttachmentUploadUrl($input: CreateAttachmentUploadUrlInput!) { } ``` -```json filename="Variables" +```json Variables { "input": { "customerId": "c_XXXXXXXXXXXXXXXXXXXXXXXXXX", @@ -38,7 +38,7 @@ mutation createAttachmentUploadUrl($input: CreateAttachmentUploadUrlInput!) { } ``` -```json filename="Response" +```json Response { "data": { "createAttachmentUploadUrl": { diff --git a/_snippets/graphql/create-customer-event.mdx b/_snippets/graphql/create-customer-event.mdx index 51f1758..4a8adac 100644 --- a/_snippets/graphql/create-customer-event.mdx +++ b/_snippets/graphql/create-customer-event.mdx @@ -1,4 +1,4 @@ -```graphql filename="Mutation" +```graphql Mutation mutation createCustomerEvent($input: CreateCustomerEventInput!) { createCustomerEvent(input: $input) { customerEvent { @@ -26,7 +26,7 @@ mutation createCustomerEvent($input: CreateCustomerEventInput!) { } ``` -```json filename="Variables" +```json Variables { "input": { "title": "API key generated", diff --git a/_snippets/graphql/create-thread.mdx b/_snippets/graphql/create-thread.mdx index 945dd2c..31db5e2 100644 --- a/_snippets/graphql/create-thread.mdx +++ b/_snippets/graphql/create-thread.mdx @@ -1,4 +1,4 @@ -```graphql filename="Mutation" +```graphql Mutation mutation createThread($input: CreateThreadInput!) { createThread(input: $input) { thread { @@ -33,7 +33,7 @@ mutation createThread($input: CreateThreadInput!) { } ``` -```json filename="Variables" +```json Variables { "input": { "title": "Bug Report", diff --git a/_snippets/graphql/delete-customer.mdx b/_snippets/graphql/delete-customer.mdx index 3305a7a..fcb71ab 100644 --- a/_snippets/graphql/delete-customer.mdx +++ b/_snippets/graphql/delete-customer.mdx @@ -1,4 +1,4 @@ -```graphql filename="Mutation" +```graphql Mutation mutation deleteCustomer($input: DeleteCustomerInput!) { deleteCustomer(input: $input) { error { @@ -16,7 +16,7 @@ mutation deleteCustomer($input: DeleteCustomerInput!) { } ``` -```json filename="Variables" +```json Variables { "input": { "customerId": "c_01H14DFQ4PDYBH398J1E99TWSS" diff --git a/_snippets/graphql/get-customer-by-email.mdx b/_snippets/graphql/get-customer-by-email.mdx index 025f445..232f0a1 100644 --- a/_snippets/graphql/get-customer-by-email.mdx +++ b/_snippets/graphql/get-customer-by-email.mdx @@ -1,4 +1,4 @@ -```graphql filename="Query" +```graphql Query query getCustomerByEmail($email: String!) { customerByEmail(email: $email) { id @@ -16,7 +16,7 @@ query getCustomerByEmail($email: String!) { } ``` -```json filename="Variables" +```json Variables { "email": "bob@example.com" } diff --git a/_snippets/graphql/get-customer-by-id.mdx b/_snippets/graphql/get-customer-by-id.mdx index 57fa836..b402ec7 100644 --- a/_snippets/graphql/get-customer-by-id.mdx +++ b/_snippets/graphql/get-customer-by-id.mdx @@ -1,4 +1,4 @@ -```graphql filename="Query" +```graphql Query query getCustomerById($customerId: ID!) { customer(customerId: $customerId) { id @@ -16,7 +16,7 @@ query getCustomerById($customerId: ID!) { } ``` -```json filename="Variables" +```json Variables { "customerId": "c_01H14DFQ4PDYBH398J1E99TWSS" } diff --git a/_snippets/graphql/get-customers.mdx b/_snippets/graphql/get-customers.mdx index 6fd3004..aa2e92e 100644 --- a/_snippets/graphql/get-customers.mdx +++ b/_snippets/graphql/get-customers.mdx @@ -1,4 +1,4 @@ -```graphql filename="Query" +```graphql Query query getCustomers($cursor: String!) { customers( after: $cursor @@ -32,7 +32,7 @@ query getCustomers($cursor: String!) { } ``` -```json filename="Variables" +```json Variables { "cursor": "eyJjdXN0b21lcnMuZnVsbF9uYW1lIjoiQWlkYSBTY2hpbm5lciIsImN1c3RvbWVycy5pZCI6ImNfMDFHMThFU01TWkdUWTQwU1pITk03M0hBQkIifQ==" } diff --git a/_snippets/graphql/mark-thread-as-done.mdx b/_snippets/graphql/mark-thread-as-done.mdx index b8d18eb..ed60d40 100644 --- a/_snippets/graphql/mark-thread-as-done.mdx +++ b/_snippets/graphql/mark-thread-as-done.mdx @@ -1,4 +1,4 @@ -```graphql filename="Mutation" +```graphql Mutation mutation markThreadAsDone($input: MarkThreadAsDoneInput!) { markThreadAsDone(input: $input) { thread { @@ -33,7 +33,7 @@ mutation markThreadAsDone($input: MarkThreadAsDoneInput!) { } ``` -```json filename="Variables" +```json Variables { "input": { "threadId": "th_01H8H46YPB2S4MAJM382FG9423" diff --git a/_snippets/graphql/mark-thread-as-todo.mdx b/_snippets/graphql/mark-thread-as-todo.mdx index 8386671..c36acdf 100644 --- a/_snippets/graphql/mark-thread-as-todo.mdx +++ b/_snippets/graphql/mark-thread-as-todo.mdx @@ -1,4 +1,4 @@ -```graphql filename="Mutation" +```graphql Mutation mutation markThreadAsTodo($input: MarkThreadAsTodoInput!) { markThreadAsTodo(input: $input) { thread { @@ -33,7 +33,7 @@ mutation markThreadAsTodo($input: MarkThreadAsTodoInput!) { } ``` -```json filename="Variables" +```json Variables { "input": { "threadId": "th_01H8H46YPB2S4MAJM382FG9423" diff --git a/_snippets/graphql/page-info-after.mdx b/_snippets/graphql/page-info-after.mdx index 7d9d186..1f475e1 100644 --- a/_snippets/graphql/page-info-after.mdx +++ b/_snippets/graphql/page-info-after.mdx @@ -1,4 +1,4 @@ -```graphql filename="Second page" +```graphql Query query getCustomers($cursor: String!) { customers(after: $cursor, first: 50) { edges { @@ -16,3 +16,9 @@ query getCustomers($cursor: String!) { } } ``` + +```js Variables +{ + after: 'eyJjdXN0b21lcnIRzlIODVORzE5SFdQIn0='; +} +``` diff --git a/_snippets/graphql/remove-customer-from-groups-by-group-id.mdx b/_snippets/graphql/remove-customer-from-groups-by-group-id.mdx index 5995f05..223cae2 100644 --- a/_snippets/graphql/remove-customer-from-groups-by-group-id.mdx +++ b/_snippets/graphql/remove-customer-from-groups-by-group-id.mdx @@ -1,4 +1,4 @@ -```json filename="Variables" +```json Variables { "input": { "customerId": "c_01GTC6ZHCMAGR06FMPN9VY5J95", @@ -10,11 +10,3 @@ } } ``` - -```json filename="Response" -{ - "data": { - "error": null - } -} -``` diff --git a/_snippets/graphql/remove-customer-from-groups.mdx b/_snippets/graphql/remove-customer-from-groups.mdx index a14c6d5..e2e9944 100644 --- a/_snippets/graphql/remove-customer-from-groups.mdx +++ b/_snippets/graphql/remove-customer-from-groups.mdx @@ -1,4 +1,4 @@ -```graphql filename="Mutation" +```graphql Mutation mutation removeCustomerFromCustomerGroup($input: RemoveCustomerFromCustomerGroupsInput!) { removeCustomerFromCustomerGroups(input: $input) { error { @@ -15,7 +15,7 @@ mutation removeCustomerFromCustomerGroup($input: RemoveCustomerFromCustomerGroup } ``` -```json filename="Variables" +```json Variables { "input": { "customerId": "c_01GTC6ZHCMAGR06FMPN9VY5J95", @@ -30,3 +30,11 @@ mutation removeCustomerFromCustomerGroup($input: RemoveCustomerFromCustomerGroup } } ``` + +```json Response +{ + "data": { + "error": null + } +} +``` diff --git a/_snippets/graphql/remove-labels.mdx b/_snippets/graphql/remove-labels.mdx index d88fb6a..49babad 100644 --- a/_snippets/graphql/remove-labels.mdx +++ b/_snippets/graphql/remove-labels.mdx @@ -1,4 +1,4 @@ -```graphql filename="Mutation" +```graphql Mutation mutation removeLabels($input: RemoveLabelsInput!) { removeLabels(input: $input) { error { @@ -10,7 +10,7 @@ mutation removeLabels($input: RemoveLabelsInput!) { } ``` -```json filename="Variables" +```json Variables { "input": { "labelIds": ["l_01HB8BTNTZ58730MX8H5VMKFD5", "l_01HB8BTNKSCF1FK5ETFVRSDC6G"] diff --git a/_snippets/graphql/reply-email.mdx b/_snippets/graphql/reply-email.mdx index 9c205c9..4e5dc0f 100644 --- a/_snippets/graphql/reply-email.mdx +++ b/_snippets/graphql/reply-email.mdx @@ -1,4 +1,4 @@ -```graphql filename="Mutation" +```graphql Mutation mutation replyToEmail($input: ReplyToEmailInput!) { replyToEmail(input: $input) { email { @@ -13,7 +13,7 @@ mutation replyToEmail($input: ReplyToEmailInput!) { } ``` -```json filename="Variables" +```json Variables { "input": { "customerId": "c_01GTC6ZHCMAGR06FMPN9VY5J95", diff --git a/_snippets/graphql/send-email.mdx b/_snippets/graphql/send-email.mdx index ba47af8..47ce23f 100644 --- a/_snippets/graphql/send-email.mdx +++ b/_snippets/graphql/send-email.mdx @@ -1,4 +1,4 @@ -```graphql filename="Mutation" +```graphql Mutation mutation sendNewEmail($input: SendNewEmailInput!) { sendNewEmail(input: $input) { email { @@ -13,7 +13,7 @@ mutation sendNewEmail($input: SendNewEmailInput!) { } ``` -```json filename="Variables" +```json Variables { "input": { "customerId": "c_01GTC6ZHCMAGR06FMPN9VY5J95", diff --git a/_snippets/graphql/snooze-thread.mdx b/_snippets/graphql/snooze-thread.mdx index c23870c..780efc1 100644 --- a/_snippets/graphql/snooze-thread.mdx +++ b/_snippets/graphql/snooze-thread.mdx @@ -1,4 +1,4 @@ -```graphql filename="Mutation" +```graphql Mutation mutation snoozeThread($input: SnoozeThreadInput!) { snoozeThread(input: $input) { thread { @@ -33,7 +33,7 @@ mutation snoozeThread($input: SnoozeThreadInput!) { } ``` -```json filename="Variables" +```json Variables { "input": { "threadId": "th_01H8H46YPB2S4MAJM382FG9423", diff --git a/_snippets/graphql/ui-divider.mdx b/_snippets/graphql/ui-divider.mdx index cc9aadc..5b4b8a4 100644 --- a/_snippets/graphql/ui-divider.mdx +++ b/_snippets/graphql/ui-divider.mdx @@ -1,4 +1,4 @@ -```json {7-11} +```json [ { "componentText": { diff --git a/_snippets/graphql/ui-spacer.mdx b/_snippets/graphql/ui-spacer.mdx index a240f55..b67c0d4 100644 --- a/_snippets/graphql/ui-spacer.mdx +++ b/_snippets/graphql/ui-spacer.mdx @@ -1,4 +1,4 @@ -```json {7-11} +```json [ { "componentText": { diff --git a/_snippets/graphql/unassign-thread.mdx b/_snippets/graphql/unassign-thread.mdx index f753da3..931a12b 100644 --- a/_snippets/graphql/unassign-thread.mdx +++ b/_snippets/graphql/unassign-thread.mdx @@ -1,4 +1,4 @@ -```graphql filename="Mutation" +```graphql Mutation mutation unassignThread($input: UnassignThreadInput!) { unassignThread(input: $input) { thread { @@ -9,7 +9,7 @@ mutation unassignThread($input: UnassignThreadInput!) { } ``` -```json filename="Variables" +```json Variables { "input": { "threadId": "th_01H8H46YPB2S4MAJM382FG9423" diff --git a/_snippets/graphql/upsert-customer.mdx b/_snippets/graphql/upsert-customer.mdx index bfe9895..84735ef 100644 --- a/_snippets/graphql/upsert-customer.mdx +++ b/_snippets/graphql/upsert-customer.mdx @@ -1,4 +1,4 @@ -```graphql filename="Mutation" +```graphql Mutation mutation upsertCustomer($input: UpsertCustomerInput!) { upsertCustomer(input: $input) { result @@ -37,7 +37,7 @@ mutation upsertCustomer($input: UpsertCustomerInput!) { } ``` -```json filename="Variables" +```json Variables { "input": { "identifier": { @@ -75,7 +75,7 @@ mutation upsertCustomer($input: UpsertCustomerInput!) { } ``` -```json filename="Response" +```json Response { "data": { "upsertCustomer": { diff --git a/_snippets/typescript-sdk/create-attachment-url-response.mdx b/_snippets/typescript-sdk/create-attachment-url-response.mdx index 5dd62db..b302262 100644 --- a/_snippets/typescript-sdk/create-attachment-url-response.mdx +++ b/_snippets/typescript-sdk/create-attachment-url-response.mdx @@ -1,4 +1,4 @@ -```json filename="Response" +```json { "__typename": "AttachmentUploadUrl", "attachment": { diff --git a/_snippets/typescript-sdk/create-attachment-url.mdx b/_snippets/typescript-sdk/create-attachment-url.mdx index f89b496..b963280 100644 --- a/_snippets/typescript-sdk/create-attachment-url.mdx +++ b/_snippets/typescript-sdk/create-attachment-url.mdx @@ -1,4 +1,4 @@ -```ts /c_XXXXXXXXXXXXXXXXXXXXXXXXXX/ +```tsx import { AttachmentType, PlainClient } from '@team-plain/typescript-sdk'; const client = new PlainClient({ apiKey: 'XXX' }); diff --git a/_snippets/webhooks/email-received.mdx b/_snippets/webhooks/email-received.mdx new file mode 100644 index 0000000..cfb90fc --- /dev/null +++ b/_snippets/webhooks/email-received.mdx @@ -0,0 +1,120 @@ +```json +{ + "timestamp": "2023-10-19T14:12:25.733Z", + "workspaceId": "w_01FXQ6A83FXNN9XA00415VR1XP", + "payload": { + "eventType": "thread.email_received", + "thread": { + "id": "th_01HD44FHMCDSSWE38N14FSYV6K", + "customer": { + "id": "c_01HD44FHDPG82VQ4QNHDR4N2T0", + "email": { + "email": "peter@example.com", + "isVerified": false, + "verifiedAt": null + }, + "externalId": null, + "fullName": "Peter Santos", + "shortName": "Peter", + "assignedAt": null, + "assignedToUser": null, + "status": "IDLE", + "statusChangedAt": "2023-10-19T14:12:25.142Z", + "markedAsSpamAt": null, + "markedAsSpamBy": null, + "customerGroupMemberships": [], + "createdAt": "2023-10-19T14:12:25.142Z", + "createdBy": { + "actorType": "system", + "system": "email_inbound_handler" + }, + "updatedAt": "2023-10-19T14:12:25.142Z", + "updatedBy": { + "actorType": "system", + "system": "email_inbound_handler" + } + }, + "title": "Unable to tail logs", + "previewText": "Hey, I am currently unable to tail the logs of the service svc-8af1e3", + "priority": 2, + "externalId": null, + "status": "TODO", + "statusChangedAt": "2023-10-19T14:12:25.266Z", + "statusChangedBy": { + "actorType": "system", + "system": "email_inbound_handler" + }, + "statusDetail": { + "type": "CREATED", + "createdAt": "2023-10-19T14:12:25.266Z" + }, + "assignee": null, + "assignedAt": null, + "labels": [], + "firstInboundMessageInfo": null, + "firstOutboundMessageInfo": null, + "lastInboundMessageInfo": null, + "lastOutboundMessageInfo": null, + "supportEmailAddresses": [], + "createdAt": "2023-10-19T14:12:25.266Z", + "createdBy": { + "actorType": "system", + "system": "email_inbound_handler" + }, + "updatedAt": "2023-10-19T14:12:25.266Z", + "updatedBy": { + "actorType": "system", + "system": "email_inbound_handler" + } + }, + "email": { + "timelineEntryId": "t_01HD44FHHJ4DJC452ZTAR73PPF", + "id": "em_01HD44FF33QTSGW5JN37BFY6YE", + "to": { + "email": "help@example.com", + "name": null, + "emailActor": { + "actorType": "supportEmailAddress", + "supportEmailAddress": "help@example.com" + } + }, + "from": { + "email": "peter@example.com", + "name": "Peter Santos", + "emailActor": { + "actorType": "customer", + "customerId": "c_01HD44FHDPG82VQ4QNHDR4N2T0" + } + }, + "additionalRecipients": [], + "hiddenRecipients": [], + "subject": "Unable to tail logs", + "textContent": "Hey, I am currently unable to tail the logs of the service svc-8af1e3", + "markdownContent": "Hey, I am currently unable to tail the logs of the service svc-8af1e3", + "authenticity": "PASS", + "sentAt": null, + "receivedAt": "2023-10-19T14:12:22.757Z", + "attachments": [], + "inReplyToEmailId": null, + "createdAt": "2023-10-19T14:12:25.733Z", + "createdBy": { + "actorType": "customer", + "customerId": "c_01HD44FHDPG82VQ4QNHDR4N2T0" + }, + "updatedAt": "2023-10-19T14:12:25.733Z", + "updatedBy": { + "actorType": "customer", + "customerId": "c_01HD44FHDPG82VQ4QNHDR4N2T0" + } + } + }, + "id": "pEv_01HD44FJ053ZHW13SWS9556THX", + "webhookMetadata": { + "webhookTargetId": "whTarget_01HD4400VTDJQ646V6RY37SR7K", + "webhookDeliveryAttemptId": "whAttempt_01HD44SZM21CPW0MXEQ73C2X7C", + "webhookDeliveryAttemptNumber": 1, + "webhookDeliveryAttemptTimestamp": "2023-10-19T14:18:07.362Z" + }, + "type": "thread.email_received" +} +``` diff --git a/_snippets/webhooks/email-sent.mdx b/_snippets/webhooks/email-sent.mdx new file mode 100644 index 0000000..bbf178d --- /dev/null +++ b/_snippets/webhooks/email-sent.mdx @@ -0,0 +1,123 @@ +```json +{ + "timestamp": "2023-10-19T21:44:01.325Z", + "workspaceId": "w_01FXQ6A83FXNN9XA00415VR1XP", + "payload": { + "eventType": "thread.email_sent", + "thread": { + "id": "th_01HD44FHMCDSSWE38N14FSYV6K", + "customer": { + "id": "c_01HD44FHDPG82VQ4QNHDR4N2T0", + "email": { + "email": "peter@example.com", + "isVerified": false, + "verifiedAt": null + }, + "externalId": null, + "fullName": "Peter Santos", + "shortName": "Peter", + "assignedAt": null, + "assignedToUser": null, + "status": "IDLE", + "statusChangedAt": "2023-10-19T21:24:36.109Z", + "markedAsSpamAt": null, + "markedAsSpamBy": null, + "customerGroupMemberships": [], + "createdAt": "2023-10-19T14:12:25.142Z", + "createdBy": { + "actorType": "system", + "system": "email_inbound_handler" + }, + "updatedAt": "2023-10-19T21:26:06.658Z", + "updatedBy": { + "actorType": "user", + "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" + } + }, + "title": "Unable to tail logs", + "previewText": "Hey, I am currently unable to tail the logs of the service svc-8af1e3", + "priority": 1, + "externalId": null, + "status": "DONE", + "statusChangedAt": "2023-10-19T21:24:36.108Z", + "statusChangedBy": { + "actorType": "user", + "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" + }, + "statusDetail": null, + "assignee": null, + "assignedAt": null, + "labels": [], + "firstInboundMessageInfo": { + "timestamp": "2023-10-19T14:12:25.733Z", + "messageSource": "EMAIL" + }, + "firstOutboundMessageInfo": null, + "lastInboundMessageInfo": { + "timestamp": "2023-10-19T14:12:25.733Z", + "messageSource": "EMAIL" + }, + "lastOutboundMessageInfo": null, + "supportEmailAddresses": ["help@example.com"], + "createdAt": "2023-10-19T14:12:25.266Z", + "createdBy": { + "actorType": "system", + "system": "email_inbound_handler" + }, + "updatedAt": "2023-10-19T21:38:54.335Z", + "updatedBy": { + "actorType": "user", + "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" + } + }, + "email": { + "timelineEntryId": "t_01HD4YABRC74XY3D4SKAWKHXMH", + "id": "em_01HD4YABKW46E4Y8384T6ARDA5", + "to": { + "email": "peter@example.com", + "name": "Peter Santos", + "emailActor": { + "actorType": "customer", + "customerId": "c_01HD44FHDPG82VQ4QNHDR4N2T0" + } + }, + "from": { + "email": "help@example.com", + "name": "Sam at Resolve", + "emailActor": { + "actorType": "supportEmailAddress", + "supportEmailAddress": "help@example.com" + } + }, + "additionalRecipients": [], + "hiddenRecipients": [], + "subject": "Re: Test", + "textContent": "Hey", + "markdownContent": "Hey", + "authenticity": "PASS", + "sentAt": "2023-10-19T21:44:00.865Z", + "receivedAt": null, + "attachments": [], + "inReplyToEmailId": "em_01HD44FF33QTSGW5JN37BFY6YE", + "createdAt": "2023-10-19T21:43:58.967Z", + "createdBy": { + "actorType": "user", + "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" + }, + "updatedAt": "2023-10-19T21:44:01.201Z", + "updatedBy": { + "actorType": "system", + "system": "email_sender" + } + } + }, + "id": "pEv_01HD4YAEHDHS2FW3F3VRSEGGVF", + "webhookMetadata": { + "webhookTargetId": "whTarget_01HD4400VTDJQ646V6RY37SR7K", + "webhookDeliveryAttemptId": "whAttempt_01HD4YAFB6VN6AJ4TGVY4DJ0VR", + "webhookDeliveryAttemptNumber": 1, + "webhookDeliveryAttemptTimestamp": "2023-10-19T21:44:02.150Z" + }, + "type": "thread.email_sent" +} +``` diff --git a/_snippets/webhooks/thread-assignment-transitioned.mdx b/_snippets/webhooks/thread-assignment-transitioned.mdx new file mode 100644 index 0000000..287f1f6 --- /dev/null +++ b/_snippets/webhooks/thread-assignment-transitioned.mdx @@ -0,0 +1,168 @@ +```json +{ + "timestamp": "2023-10-19T21:24:51.660Z", + "workspaceId": "w_01GST0W989ZNAW53X6XYHAY87P", + "payload": { + "eventType": "thread.thread_assignment_transitioned", + "previousThread": { + "id": "th_01HD44FHMCDSSWE38N14FSYV6K", + "customer": { + "id": "c_01HD44FHDPG82VQ4QNHDR4N2T0", + "email": { + "email": "peter@example.com", + "isVerified": false, + "verifiedAt": null + }, + "externalId": null, + "fullName": "Peter Santos", + "shortName": "Peter", + "assignedAt": null, + "assignedToUser": null, + "status": "IDLE", + "statusChangedAt": "2023-10-19T21:24:36.109Z", + "markedAsSpamAt": null, + "markedAsSpamBy": null, + "customerGroupMemberships": [], + "createdAt": "2023-10-19T14:12:25.142Z", + "createdBy": { + "actorType": "system", + "system": "email_inbound_handler" + }, + "updatedAt": "2023-10-19T21:24:51.734Z", + "updatedBy": { + "actorType": "user", + "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" + } + }, + "title": "Unable to tail logs", + "previewText": "Hey, I am currently unable to tail the logs of the service svc-8af1e3", + "priority": 1, + "externalId": null, + "status": "DONE", + "statusChangedAt": "2023-10-19T21:24:36.108Z", + "statusChangedBy": { + "actorType": "user", + "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" + }, + "statusDetail": null, + "assignee": null, + "assignedAt": null, + "labels": [], + "firstInboundMessageInfo": { + "timestamp": "2023-10-19T14:12:25.733Z", + "messageSource": "EMAIL" + }, + "firstOutboundMessageInfo": null, + "lastInboundMessageInfo": { + "timestamp": "2023-10-19T14:12:25.733Z", + "messageSource": "EMAIL" + }, + "lastOutboundMessageInfo": null, + "supportEmailAddresses": ["help@example.com"], + "createdAt": "2023-10-19T14:12:25.266Z", + "createdBy": { + "actorType": "system", + "system": "email_inbound_handler" + }, + "updatedAt": "2023-10-19T21:24:36.108Z", + "updatedBy": { + "actorType": "user", + "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" + } + }, + "thread": { + "id": "th_01HD44FHMCDSSWE38N14FSYV6K", + "customer": { + "id": "c_01HD44FHDPG82VQ4QNHDR4N2T0", + "email": { + "email": "peter@example.com", + "isVerified": false, + "verifiedAt": null + }, + "externalId": null, + "fullName": "Peter Santos", + "shortName": "Peter", + "assignedAt": null, + "assignedToUser": null, + "status": "IDLE", + "statusChangedAt": "2023-10-19T21:24:36.109Z", + "markedAsSpamAt": null, + "markedAsSpamBy": null, + "customerGroupMemberships": [], + "createdAt": "2023-10-19T14:12:25.142Z", + "createdBy": { + "actorType": "system", + "system": "email_inbound_handler" + }, + "updatedAt": "2023-10-19T21:24:51.734Z", + "updatedBy": { + "actorType": "user", + "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" + } + }, + "title": "Unable to tail logs", + "previewText": "Hey, I am currently unable to tail the logs of the service svc-8af1e3", + "priority": 1, + "externalId": null, + "status": "DONE", + "statusChangedAt": "2023-10-19T21:24:36.108Z", + "statusChangedBy": { + "actorType": "user", + "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" + }, + "statusDetail": null, + "assignee": { + "id": "u_01H1V4NA10RMHWFBXB6A1ZBYRA", + "email": "sam@example.com", + "fullName": "Sam", + "publicName": "Sam", + "status": "OFFLINE", + "statusChangedAt": "2023-06-01T09:29:48.903Z", + "createdAt": "2023-06-01T09:29:48.903Z", + "createdBy": { + "actorType": "user", + "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" + }, + "updatedAt": "2023-06-01T09:29:48.903Z", + "updatedBy": { + "actorType": "user", + "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" + }, + "deletedAt": null, + "deletedBy": null + }, + "assignedAt": "2023-10-19T21:24:51.660Z", + "labels": [], + "firstInboundMessageInfo": { + "timestamp": "2023-10-19T14:12:25.733Z", + "messageSource": "EMAIL" + }, + "firstOutboundMessageInfo": null, + "lastInboundMessageInfo": { + "timestamp": "2023-10-19T14:12:25.733Z", + "messageSource": "EMAIL" + }, + "lastOutboundMessageInfo": null, + "supportEmailAddresses": ["help@example.com"], + "createdAt": "2023-10-19T14:12:25.266Z", + "createdBy": { + "actorType": "system", + "system": "email_inbound_handler" + }, + "updatedAt": "2023-10-19T21:24:51.660Z", + "updatedBy": { + "actorType": "user", + "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" + } + } + }, + "id": "pEv_01HD4X7BTCJSP3NGTBKYSWGPSY", + "webhookMetadata": { + "webhookTargetId": "whTarget_01HD4400VTDJQ646V6RY37SR7K", + "webhookDeliveryAttemptId": "whAttempt_01HD4XHSAX79QW8E34V86CKJRK", + "webhookDeliveryAttemptNumber": 4, + "webhookDeliveryAttemptTimestamp": "2023-10-19T21:30:33.181Z" + }, + "type": "thread.thread_assignment_transitioned" +} +``` diff --git a/_snippets/webhooks/thread-labels-changed.mdx b/_snippets/webhooks/thread-labels-changed.mdx new file mode 100644 index 0000000..063da1f --- /dev/null +++ b/_snippets/webhooks/thread-labels-changed.mdx @@ -0,0 +1,182 @@ +```json +{ + "timestamp": "2023-10-19T21:38:54.335Z", + "workspaceId": "w_01FXQ6A83FXNN9XA00415VR1XP", + "payload": { + "eventType": "thread.thread_labels_changed", + "changeType": "ADDED", + "thread": { + "id": "th_01HD44FHMCDSSWE38N14FSYV6K", + "customer": { + "id": "c_01HD44FHDPG82VQ4QNHDR4N2T0", + "email": { + "email": "peter@example.com", + "isVerified": false, + "verifiedAt": null + }, + "externalId": null, + "fullName": "Peter Santos", + "shortName": "Peter", + "assignedAt": null, + "assignedToUser": null, + "status": "IDLE", + "statusChangedAt": "2023-10-19T21:24:36.109Z", + "markedAsSpamAt": null, + "markedAsSpamBy": null, + "customerGroupMemberships": [], + "createdAt": "2023-10-19T14:12:25.142Z", + "createdBy": { + "actorType": "system", + "system": "email_inbound_handler" + }, + "updatedAt": "2023-10-19T21:26:06.658Z", + "updatedBy": { + "actorType": "user", + "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" + } + }, + "title": "Unable to tail logs", + "previewText": "Hey, I am currently unable to tail the logs of the service svc-8af1e3", + "priority": 1, + "externalId": null, + "status": "DONE", + "statusChangedAt": "2023-10-19T21:24:36.108Z", + "statusChangedBy": { + "actorType": "user", + "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" + }, + "statusDetail": null, + "assignee": null, + "assignedAt": null, + "labels": [ + { + "id": "l_01HD4Y12Q6JJC2BQJRQJVWM5YB", + "labelType": { + "id": "lt_01HB81HYXZ2B8QGYCH5YG1AGM8", + "name": "Account setup", + "icon": "bug", + "isArchived": false, + "archivedAt": null, + "archivedBy": null, + "createdAt": "2023-09-26T06:06:52.863Z", + "createdBy": { + "actorType": "system", + "system": "job" + }, + "updatedAt": "2023-10-02T13:40:17.049Z", + "updatedBy": { + "actorType": "user", + "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" + } + }, + "createdAt": "2023-10-19T21:38:54.310Z", + "createdBy": { + "actorType": "user", + "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" + }, + "updatedAt": "2023-10-19T21:38:54.310Z", + "updatedBy": { + "actorType": "user", + "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" + } + } + ], + "firstInboundMessageInfo": { + "timestamp": "2023-10-19T14:12:25.733Z", + "messageSource": "EMAIL" + }, + "firstOutboundMessageInfo": null, + "lastInboundMessageInfo": { + "timestamp": "2023-10-19T14:12:25.733Z", + "messageSource": "EMAIL" + }, + "lastOutboundMessageInfo": null, + "supportEmailAddresses": ["help@example.com"], + "createdAt": "2023-10-19T14:12:25.266Z", + "createdBy": { + "actorType": "system", + "system": "email_inbound_handler" + }, + "updatedAt": "2023-10-19T21:38:54.335Z", + "updatedBy": { + "actorType": "user", + "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" + } + }, + "previousThread": { + "id": "th_01HD44FHMCDSSWE38N14FSYV6K", + "customer": { + "id": "c_01HD44FHDPG82VQ4QNHDR4N2T0", + "email": { + "email": "peter@example.com", + "isVerified": false, + "verifiedAt": null + }, + "externalId": null, + "fullName": "Peter Santos", + "shortName": "Peter", + "assignedAt": null, + "assignedToUser": null, + "status": "IDLE", + "statusChangedAt": "2023-10-19T21:24:36.109Z", + "markedAsSpamAt": null, + "markedAsSpamBy": null, + "customerGroupMemberships": [], + "createdAt": "2023-10-19T14:12:25.142Z", + "createdBy": { + "actorType": "system", + "system": "email_inbound_handler" + }, + "updatedAt": "2023-10-19T21:26:06.658Z", + "updatedBy": { + "actorType": "user", + "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" + } + }, + "title": "Unable to tail logs", + "previewText": "Hey, I am currently unable to tail the logs of the service svc-8af1e3", + "priority": 1, + "externalId": null, + "status": "DONE", + "statusChangedAt": "2023-10-19T21:24:36.108Z", + "statusChangedBy": { + "actorType": "user", + "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" + }, + "statusDetail": null, + "assignee": null, + "assignedAt": null, + "labels": [], + "firstInboundMessageInfo": { + "timestamp": "2023-10-19T14:12:25.733Z", + "messageSource": "EMAIL" + }, + "firstOutboundMessageInfo": null, + "lastInboundMessageInfo": { + "timestamp": "2023-10-19T14:12:25.733Z", + "messageSource": "EMAIL" + }, + "lastOutboundMessageInfo": null, + "supportEmailAddresses": ["help@example.com"], + "createdAt": "2023-10-19T14:12:25.266Z", + "createdBy": { + "actorType": "system", + "system": "email_inbound_handler" + }, + "updatedAt": "2023-10-19T21:24:51.660Z", + "updatedBy": { + "actorType": "user", + "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" + } + } + }, + "id": "pEv_01HD4Y12QZ1X7FQN2648JCVMN4", + "webhookMetadata": { + "webhookTargetId": "whTarget_01HD4400VTDJQ646V6RY37SR7K", + "webhookDeliveryAttemptId": "whAttempt_01HD4Y15J3HJ2BFDGXTGWSC2XC", + "webhookDeliveryAttemptNumber": 1, + "webhookDeliveryAttemptTimestamp": "2023-10-19T21:38:57.219Z" + }, + "type": "thread.thread_labels_changed" +} +``` diff --git a/_snippets/webhooks/thread-status-transitioned.mdx b/_snippets/webhooks/thread-status-transitioned.mdx new file mode 100644 index 0000000..f52ac9f --- /dev/null +++ b/_snippets/webhooks/thread-status-transitioned.mdx @@ -0,0 +1,149 @@ +```json +{ + "timestamp": "2023-10-19T21:24:36.108Z", + "workspaceId": "w_01GST0W989ZNAW53X6XYHAY87P", + "payload": { + "eventType": "thread.thread_status_transitioned", + "previousThread": { + "id": "th_01HD44FHMCDSSWE38N14FSYV6K", + "customer": { + "id": "c_01HD44FHDPG82VQ4QNHDR4N2T0", + "email": { + "email": "peter@example.com", + "isVerified": false, + "verifiedAt": null + }, + "externalId": null, + "fullName": "Peter Santos", + "shortName": "Peter", + "assignedAt": null, + "assignedToUser": null, + "status": "ACTIVE", + "statusChangedAt": "2023-10-19T21:18:12.863Z", + "markedAsSpamAt": null, + "markedAsSpamBy": null, + "customerGroupMemberships": [], + "createdAt": "2023-10-19T14:12:25.142Z", + "createdBy": { + "actorType": "system", + "system": "email_inbound_handler" + }, + "updatedAt": "2023-10-19T21:18:12.863Z", + "updatedBy": { + "actorType": "user", + "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" + } + }, + "title": "Unable to tail logs", + "previewText": "Hey, I am currently unable to tail the logs of the service svc-8af1e3", + "priority": 1, + "externalId": null, + "status": "TODO", + "statusChangedAt": "2023-10-19T21:18:12.862Z", + "statusChangedBy": { + "actorType": "user", + "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" + }, + "statusDetail": null, + "assignee": null, + "assignedAt": null, + "labels": [], + "firstInboundMessageInfo": { + "timestamp": "2023-10-19T14:12:25.733Z", + "messageSource": "EMAIL" + }, + "firstOutboundMessageInfo": null, + "lastInboundMessageInfo": { + "timestamp": "2023-10-19T14:12:25.733Z", + "messageSource": "EMAIL" + }, + "lastOutboundMessageInfo": null, + "supportEmailAddresses": ["help@example.com"], + "createdAt": "2023-10-19T14:12:25.266Z", + "createdBy": { + "actorType": "system", + "system": "email_inbound_handler" + }, + "updatedAt": "2023-10-19T21:20:07.612Z", + "updatedBy": { + "actorType": "user", + "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" + } + }, + "thread": { + "id": "th_01HD44FHMCDSSWE38N14FSYV6K", + "customer": { + "id": "c_01HD44FHDPG82VQ4QNHDR4N2T0", + "email": { + "email": "peter@example.com", + "isVerified": false, + "verifiedAt": null + }, + "externalId": null, + "fullName": "Peter Santos", + "shortName": "Peter", + "assignedAt": null, + "assignedToUser": null, + "status": "ACTIVE", + "statusChangedAt": "2023-10-19T21:18:12.863Z", + "markedAsSpamAt": null, + "markedAsSpamBy": null, + "customerGroupMemberships": [], + "createdAt": "2023-10-19T14:12:25.142Z", + "createdBy": { + "actorType": "system", + "system": "email_inbound_handler" + }, + "updatedAt": "2023-10-19T21:18:12.863Z", + "updatedBy": { + "actorType": "user", + "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" + } + }, + "title": "Unable to tail logs", + "previewText": "Hey, I am currently unable to tail the logs of the service svc-8af1e3", + "priority": 1, + "externalId": null, + "status": "DONE", + "statusChangedAt": "2023-10-19T21:24:36.108Z", + "statusChangedBy": { + "actorType": "user", + "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" + }, + "statusDetail": null, + "assignee": null, + "assignedAt": null, + "labels": [], + "firstInboundMessageInfo": { + "timestamp": "2023-10-19T14:12:25.733Z", + "messageSource": "EMAIL" + }, + "firstOutboundMessageInfo": null, + "lastInboundMessageInfo": { + "timestamp": "2023-10-19T14:12:25.733Z", + "messageSource": "EMAIL" + }, + "lastOutboundMessageInfo": null, + "supportEmailAddresses": ["help@example.com"], + "createdAt": "2023-10-19T14:12:25.266Z", + "createdBy": { + "actorType": "system", + "system": "email_inbound_handler" + }, + "updatedAt": "2023-10-19T21:24:36.108Z", + "updatedBy": { + "actorType": "user", + "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" + } + } + }, + "id": "pEv_01HD4X6WMCJSD8EHWDRHZ8WYDT", + "webhookMetadata": { + "webhookTargetId": "whTarget_01HD4400VTDJQ646V6RY37SR7K", + "webhookDeliveryAttemptId": "whAttempt_01HD4XH9YE8CK6KT3G8VRX38R7", + "webhookDeliveryAttemptNumber": 1, + "webhookDeliveryAttemptTimestamp": "2023-10-19T21:30:17.422Z" + }, + "type": "thread.thread_status_transitioned" +} +``` diff --git a/pages/attachments.mdx b/pages/attachments.mdx index 3c0198b..16abb17 100644 --- a/pages/attachments.mdx +++ b/pages/attachments.mdx @@ -26,177 +26,18 @@ To try this, you will need an [API key](/graphql/authentication/) with the follo -```typescript -import { AttachmentType, PlainClient } from '@team-plain/typescript-sdk'; - -const client = new PlainClient({ apiKey: 'XXX' }); - -const res = await client.createAttachmentUploadUrl({ - customerId: 'c_XXXXXXXXXXXXXXXXXXXXXXXXXX', - fileName: 'the-filename.jpeg', - fileSizeBytes: 32318, - attachmentType: AttachmentType.CustomTimelineEntry, -}); - -if (res.error) { - console.error(res.error); -} else { - console.log('Attachment upload url created'); - console.log(res.data); -} -``` + Which would console log something like this: -```json -{ - "__typename": "AttachmentUploadUrl", - "attachment": { - "__typename": "Attachment", - "id": "att_01H3970W7XG1716AVNGQ6FWYGD", - "fileName": "the-filename.jpeg", - "fileSize": { - "__typename": "FileSize", - "kiloBytes": 32.32, - "megaBytes": 0.03 - }, - "fileExtension": null, - "updatedAt": { - "__typename": "DateTime", - "iso8601": "2023-06-19T06:56:04.349Z", - "unixTimestamp": "1687157764349" - } - }, - "uploadFormUrl": "https://prod-uk-services-attachm-attachmentsuploadbucket2-1l2e4906o2asm.s3.eu-west-2.amazonaws.com/", - "uploadFormData": [ - { "key": "acl", "value": "private" }, - { "key": "x-amz-server-side-encryption", "value": "AES256" }, - { "key": "Content-Type", "value": "application/octet-stream" }, - { - "key": "bucket", - "value": "prod-uk-services-attachm-attachmentsuploadbucket2-1l2e4906o2asm" - }, - { "key": "X-Amz-Algorithm", "value": "AWS4-HMAC-SHA256" }, - { - "key": "X-Amz-Credential", - "value": "ASIAWYWBOL266XVGRRM7/20230619/eu-west-2/s3/aws4_request" - }, - { "key": "X-Amz-Date", "value": "20230619T065604Z" }, - { - "key": "X-Amz-Security-Token", - "value": "IQoJb3JpZ2luX2VjEC8aCWV1LXdlc3QtMiJIMEYCIQD6zKc5ZaobWAYgTZoWN62yv5+vXRwkAAZvRPOg51UevgIhAPFCm3pUv/StIqoxtC90G6kE0D9lqcRBlWdzA8FsErw+KpwDCIj//////////wEQARoMNDY1MzM1OTAxODg1Igz/lGT5c341L5ZjBZoq8AJjmuxX6/MR8uRmDH4BPh/6uuBoT2IDRIFVqVpDlll5hOGDKmMMSqxFdJ0EdxI9oCLRlM+cd/oupHTOfvC+Jc0g6vQrABgvbi7PSVzZZrxWZRtaGmSzb6rI3it0xBGJf1c/Ec3dZzX2nJqhG7fY9jqXzFzSWF3B+GX4A6kwcrU3mv8nRFenxPZpXq75thb3w0C3wNbaee2TfZWtdwXB24f0qJhbDKZuu1S399Fj1/1AMQVRjIdUy8mbXKYHhN1cqGONaruN2ypLffB45IlHoJsquqwS8/a3/E+1so7ybkdPKUCMqS42Lss5YX4cKJX70wJzc2SanyJhaBlTW93V/lBYCjlhtR5muAr9Gabybi5lSu1Am/SEymzKOYUWm2vqm/11ZfdgXofmgefaDlDPV+vckLo0lO4i11bS245waOW3bK9iIwX+m05DyzbUSy0zn5Hit1+z+R5VK/pnFR1pJ5fD/F9H5QlFO2I38DHQxpWBFTCq77+kBjqcATBd5fpX6yln9sw7UVlzy4eqyqP8asGiadpqiupsVygGahb1ZGS33XFqx0BClbvKBiO+gvQNZyicIgwvLvThQFxO4raEFqFZlVPVVZUe6vBsgb72CAwsGtV9chLm6C3AN3Ovb4ta/FNwVIc9sfXwOLIazLtAS0IpWuJi49FUw82725HvW5oY8pTl3NhWV60XFXmyuDUYsJlVfvtkWg==" - }, - { - "key": "key", - "value": "w_01GZEA2KYR63P8E00JBMYQT58Z/pending/machineUser/mu_01GZEA2M91124MPFAVZEPKC2MY/att_01H3970W7XG1716AVNGQ6FWXGD" - }, - { - "key": "Policy", - "value": "eyJleHBpcmF0aW9uIjoiMjA3Ni0xMi0wNFQxNTo1MjowOFoiLCJjb25kaXRpb25zIjpbWyJjb250ZW50LWxlbmd0aC1yYW5nZSIsMzIzMTgsMzIzMThdLHsiYWNsIjoicHJpdmF0ZSJ9LHsieC1hbXotc2VydmVyLXNpZGUtZW5jcnlwdGlvbiI6IkFFUzI1NiJ9LHsiQ29udGVudC1UeXBlIjoiYXBwbGljYXRpb24vb2N0ZXQtc3RyZWFtIn0seyJidWNrZXQiOiJwcm9kLXVrLXNlcnZpY2VzLWF0dGFjaG0tYXR0YWNobWVudHN1cGxvYWRidWNrZXQyLTFsMmU0OTA2bzJhc20ifSx7IlgtQW16LUFsZ29yaXRobSI6IkFXUzQtSE1BQy1TSEEyNTYifSx7IlgtQW16LUNyZWRlbnRpYWwiOiJBU0lBV1lXQk9MMjY2WFZHUlJNNy8yMDIzMDYxOS9ldS13ZXN0LTIvczMvYXdzNF9yZXF1ZXN0In0seyJYLUFtei1EYXRlIjoiMjAyMzA2MTlUMDY1NjA0WiJ9LHsiWC1BbXotU2VjdXJpdHktVG9rZW4iOiJJUW9KYjNKcFoybHVYMlZqRUM4YUNXVjFMWGRsYzNRdE1pSklNRVlDSVFENnpLYzVaYW9iV0FZZ1Rab1dONjJ5djUrdlhSd2tBQVp2UlBPZzUxVWV2Z0loQVBGQ20zcFV2L1N0SXFveHRDOTBHNmtFMEQ5bHFjUkJsV2R6QThGc0VydytLcHdEQ0lqLy8vLy8vLy8vL3dFUUFSb01ORFkxTXpNMU9UQXhPRGcxSWd6L2xHVDVjMzQxTDVaakJab3E4QUpqbXV4WDYvTVI4dVJtREg0QlBoLzZ1dUJvVDJJRFJJRlZxVnBEbGxsNWhPR0RLbU1NU3F4RmRKMEVkeEk5b0NMUmxNK2NkL291cEhUT2Z2QytKYzBnNnZRckFCZ3ZiaTdQU1Z6WlpyeFdaUnRhR21TemI2ckkzaXQweEJHSmYxYy9FYzNkWnpYMm5KcWhHN2ZZOWpxWHpGelNXRjNCK0dYNEE2a3djclUzbXY4blJGZW54UFpwWHE3NXRoYjN3MEMzd05iYWVlMlRmWld0ZHdYQjI0ZjBxSmhiREtadXUxUzM5OUZqMS8xQU1RVlJqSWRVeThtYlhLWUhoTjFjcUdPTmFydU4yeXBMZmZCNDVJbEhvSnNxdXF3UzgvYTMvRSsxc283eWJrZFBLVUNNcVM0MkxzczVZWDRjS0pYNzB3SnpjMlNhbnlKaGFCbFRXOTNWL2xCWUNqbGh0UjVtdUFyOUdhYnliaTVsU3UxQW0vU0V5bXpLT1lVV20ydnFtLzExWmZkZ1hvZm1nZWZhRGxEUFYrdmNrTG8wbE80aTExYlMyNDV3YU9XM2JLOWlJd1grbTA1RHl6YlVTeTB6bjVIaXQxK3orUjVWSy9wbkZSMXBKNWZEL0Y5SDVRbEZPMkkzOERIUXhwV0JGVENxNzcra0JqcWNBVEJkNWZwWDZ5bG45c3c3VVZsenk0ZXF5cVA4YXNHaWFkcHFpdXBzVnlnR2FoYjFaR1MzM1hGcXgwQkNsYnZLQmlPK2d2UU5aeWljSWd3dkx2VGhRRnhPNHJhRUZxRlpsVlBWVlpVZTZ2QnNnYjcyQ0F3c0d0VjljaExtNkMzQU4zT3ZiNHRhL0ZOd1ZJYzlzZlh3T0xJYXpMdEFTMElwV3VKaTQ5RlV3ODI3MjVIdlc1b1k4cFRsM05oV1Y2MFhGWG15dURVWXNKbFZmdnRrV2c9PSJ9LHsia2V5Ijoid18wMUdaRUEyS1lSNjNQOEUwMEpCTVlRVDU4Wi9wZW5kaW5nL21hY2hpbmVVc2VyL211XzAxR1pFQTJNOTExMjRNUEZBVlpFUEtDMk1ZL2F0dF8wMUgzOTcwVzdYRzE3MTZBVk5HUTZGV1hHRCJ9XX0=" - }, - { - "key": "X-Amz-Signature", - "value": "a68a18898e654e072f80b052853b0722aa58aada15d3cd3e9cc937f929ff2433" - } - ], - "expiresAt": { - "__typename": "DateTime", - "iso8601": "2023-06-19T08:56:04.348Z", - "unixTimestamp": "1687164964348" - } -} -``` + The GraphQL mutation to create an attachment upload URL is the following: -```graphql Mutation -mutation createAttachmentUploadUrl($input: CreateAttachmentUploadUrlInput!) { - createAttachmentUploadUrl(input: $input) { - attachmentUploadUrl { - attachment { - id - # There are more fields here but we are just selecting - # the id for simplicity. - } - uploadFormUrl - uploadFormData { - key - value - } - } - error { - message - type - code - fields { - field - message - type - } - } - } -} - -Variables -{ - "input": { - "customerId": "c_XXXXXXXXXXXXXXXXXXXXXXXXXX", - "fileName": "bruce.jpeg", - "fileSizeBytes": 32318, - "attachmentType": "CUSTOM_TIMELINE_ENTRY" - } -} -``` - -```json Response -{ - "data": { - "createAttachmentUploadUrl": { - "attachmentUploadUrl": { - "attachment": { - "id": "att_01H3970W7XG1716AVNGQ6FWYGD" - }, - "uploadFormUrl": "https://prod-uk-services-attachm-attachmentsuploadbucket2-1l2e4906o2asm.s3.eu-west-2.amazonaws.com/", - "uploadFormData": [ - { "key": "acl", "value": "private" }, - { "key": "x-amz-server-side-encryption", "value": "AES256" }, - { "key": "Content-Type", "value": "application/octet-stream" }, - { - "key": "bucket", - "value": "prod-uk-services-attachm-attachmentsuploadbucket2-1l2e4906o2asm" - }, - { "key": "X-Amz-Algorithm", "value": "AWS4-HMAC-SHA256" }, - { - "key": "X-Amz-Credential", - "value": "ASIAWYWBOL266XVGRRM7/20230619/eu-west-2/s3/aws4_request" - }, - { "key": "X-Amz-Date", "value": "20230619T065604Z" }, - { - "key": "X-Amz-Security-Token", - "value": "IQoJb3JpZ2luX2VjEC8aCWV1LXdlc3QtMiJIMEYCIQD6zKc5ZaobWAYgTZoWN62yv5+vXRwkAAZvRPOg51UevgIhAPFCm3pUv/StIqoxtC90G6kE0D9lqcRBlWdzA8FsErw+KpwDCIj//////////wEQARoMNDY1MzM1OTAxODg1Igz/lGT5c341L5ZjBZoq8AJjmuxX6/MR8uRmDH4BPh/6uuBoT2IDRIFVqVpDlll5hOGDKmMMSqxFdJ0EdxI9oCLRlM+cd/oupHTOfvC+Jc0g6vQrABgvbi7PSVzZZrxWZRtaGmSzb6rI3it0xBGJf1c/Ec3dZzX2nJqhG7fY9jqXzFzSWF3B+GX4A6kwcrU3mv8nRFenxPZpXq75thb3w0C3wNbaee2TfZWtdwXB24f0qJhbDKZuu1S399Fj1/1AMQVRjIdUy8mbXKYHhN1cqGONaruN2ypLffB45IlHoJsquqwS8/a3/E+1so7ybkdPKUCMqS42Lss5YX4cKJX70wJzc2SanyJhaBlTW93V/lBYCjlhtR5muAr9Gabybi5lSu1Am/SEymzKOYUWm2vqm/11ZfdgXofmgefaDlDPV+vckLo0lO4i11bS245waOW3bK9iIwX+m05DyzbUSy0zn5Hit1+z+R5VK/pnFR1pJ5fD/F9H5QlFO2I38DHQxpWBFTCq77+kBjqcATBd5fpX6yln9sw7UVlzy4eqyqP8asGiadpqiupsVygGahb1ZGS33XFqx0BClbvKBiO+gvQNZyicIgwvLvThQFxO4raEFqFZlVPVVZUe6vBsgb72CAwsGtV9chLm6C3AN3Ovb4ta/FNwVIc9sfXwOLIazLtAS0IpWuJi49FUw82725HvW5oY8pTl3NhWV60XFXmyuDUYsJlVfvtkWg==" - }, - { - "key": "key", - "value": "w_01GZEA2KYR63P8E00JBMYQT58Z/pending/machineUser/mu_01GZEA2M91124MPFAVZEPKC2MY/att_01H3970W7XG1716AVNGQ6FWXGD" - }, - { - "key": "Policy", - "value": "eyJleHBpcmF0aW9uIjoiMjA3Ni0xMi0wNFQxNTo1MjowOFoiLCJjb25kaXRpb25zIjpbWyJjb250ZW50LWxlbmd0aC1yYW5nZSIsMzIzMTgsMzIzMThdLHsiYWNsIjoicHJpdmF0ZSJ9LHsieC1hbXotc2VydmVyLXNpZGUtZW5jcnlwdGlvbiI6IkFFUzI1NiJ9LHsiQ29udGVudC1UeXBlIjoiYXBwbGljYXRpb24vb2N0ZXQtc3RyZWFtIn0seyJidWNrZXQiOiJwcm9kLXVrLXNlcnZpY2VzLWF0dGFjaG0tYXR0YWNobWVudHN1cGxvYWRidWNrZXQyLTFsMmU0OTA2bzJhc20ifSx7IlgtQW16LUFsZ29yaXRobSI6IkFXUzQtSE1BQy1TSEEyNTYifSx7IlgtQW16LUNyZWRlbnRpYWwiOiJBU0lBV1lXQk9MMjY2WFZHUlJNNy8yMDIzMDYxOS9ldS13ZXN0LTIvczMvYXdzNF9yZXF1ZXN0In0seyJYLUFtei1EYXRlIjoiMjAyMzA2MTlUMDY1NjA0WiJ9LHsiWC1BbXotU2VjdXJpdHktVG9rZW4iOiJJUW9KYjNKcFoybHVYMlZqRUM4YUNXVjFMWGRsYzNRdE1pSklNRVlDSVFENnpLYzVaYW9iV0FZZ1Rab1dONjJ5djUrdlhSd2tBQVp2UlBPZzUxVWV2Z0loQVBGQ20zcFV2L1N0SXFveHRDOTBHNmtFMEQ5bHFjUkJsV2R6QThGc0VydytLcHdEQ0lqLy8vLy8vLy8vL3dFUUFSb01ORFkxTXpNMU9UQXhPRGcxSWd6L2xHVDVjMzQxTDVaakJab3E4QUpqbXV4WDYvTVI4dVJtREg0QlBoLzZ1dUJvVDJJRFJJRlZxVnBEbGxsNWhPR0RLbU1NU3F4RmRKMEVkeEk5b0NMUmxNK2NkL291cEhUT2Z2QytKYzBnNnZRckFCZ3ZiaTdQU1Z6WlpyeFdaUnRhR21TemI2ckkzaXQweEJHSmYxYy9FYzNkWnpYMm5KcWhHN2ZZOWpxWHpGelNXRjNCK0dYNEE2a3djclUzbXY4blJGZW54UFpwWHE3NXRoYjN3MEMzd05iYWVlMlRmWld0ZHdYQjI0ZjBxSmhiREtadXUxUzM5OUZqMS8xQU1RVlJqSWRVeThtYlhLWUhoTjFjcUdPTmFydU4yeXBMZmZCNDVJbEhvSnNxdXF3UzgvYTMvRSsxc283eWJrZFBLVUNNcVM0MkxzczVZWDRjS0pYNzB3SnpjMlNhbnlKaGFCbFRXOTNWL2xCWUNqbGh0UjVtdUFyOUdhYnliaTVsU3UxQW0vU0V5bXpLT1lVV20ydnFtLzExWmZkZ1hvZm1nZWZhRGxEUFYrdmNrTG8wbE80aTExYlMyNDV3YU9XM2JLOWlJd1grbTA1RHl6YlVTeTB6bjVIaXQxK3orUjVWSy9wbkZSMXBKNWZEL0Y5SDVRbEZPMkkzOERIUXhwV0JGVENxNzcra0JqcWNBVEJkNWZwWDZ5bG45c3c3VVZsenk0ZXF5cVA4YXNHaWFkcHFpdXBzVnlnR2FoYjFaR1MzM1hGcXgwQkNsYnZLQmlPK2d2UU5aeWljSWd3dkx2VGhRRnhPNHJhRUZxRlpsVlBWVlpVZTZ2QnNnYjcyQ0F3c0d0VjljaExtNkMzQU4zT3ZiNHRhL0ZOd1ZJYzlzZlh3T0xJYXpMdEFTMElwV3VKaTQ5RlV3ODI3MjVIdlc1b1k4cFRsM05oV1Y2MFhGWG15dURVWXNKbFZmdnRrV2c9PSJ9LHsia2V5Ijoid18wMUdaRUEyS1lSNjNQOEUwMEpCTVlRVDU4Wi9wZW5kaW5nL21hY2hpbmVVc2VyL211XzAxR1pFQTJNOTExMjRNUEZBVlpFUEtDMk1ZL2F0dF8wMUgzOTcwVzdYRzE3MTZBVk5HUTZGV1hHRCJ9XX0=" - }, - { - "key": "X-Amz-Signature", - "value": "a68a18898e654e072f80b052853b0722aa58aada15d3cd3e9cc937f929ff2433" - } - ] - }, - "error": null - } - } -} -``` + @@ -215,83 +56,12 @@ Variables -```typescript -/** - * Upload an attachment. - * - * @param {Blob} fileBlob blob with the contents of the file to upload - * @param {string} uploadFormUrl The url to post the form to (from `createAttachmentUploadUrl.attachmentUploadUrl.uploadFormUrl`) - * @param {{ key: string; value: string }[]} uploadFormData Data to be added to the form along with the file contents (from `createAttachmentUploadUrl.attachmentUploadUrl.uploadFormData`) - */ -function uploadAttachment(fileBlob, uploadFormUrl, uploadFormData) { - const form = new FormData(); - uploadFormData.forEach(({ key, value }) => { - form.append(key, value); - }); - - const file = new File([fileBlob], 'file'); - form.append('file', file); - - console.log(`Uploading attachment to ${uploadFormUrl}`); - - fetch(uploadFormUrl, { - method: 'POST', - body: form, - }) - .then((res) => { - if (!res.ok) { - throw new Error(response.statusText); - } - console.log(`File successfully uploaded! (code=${res.status})`); - }) - .catch((err) => { - console.log(`There was an error uploading the file: %s`, err.message ? err.message : err); - }); -} -``` + -```typescript -const axios = require('axios'); -const FormData = require('form-data'); - -/** - * Upload an attachment. - * - * @param {Buffer} fileBuffer Buffer with the contents of the file to upload - * @param {string} uploadFormUrl The url to post the form to (from `createAttachmentUploadUrl.attachmentUploadUrl.uploadFormUrl`) - * @param {{ key: string; value: string }[]} uploadFormData Data to be added to the form along with the file contents (from `createAttachmentUploadUrl.attachmentUploadUrl.uploadFormData`) - */ -function uploadAttachment(fileBuffer, uploadFormUrl, uploadFormData) { - const form = new FormData(); - uploadFormData.forEach(({ key, value }) => { - form.append(key, value); - }); - - form.append('file', fileBuffer, { filename: 'file' }); - - console.log(`Uploading attachment to ${uploadFormUrl}`); - - axios - .post(uploadFormUrl, form, { - headers: { - ...form.getHeaders(), - 'Content-Length': form.getLengthSync(), - }, - }) - .then((res) => { - console.log(`File successfully uploaded! (code=${res.status})`); - }) - .catch((err) => { - console.log( - `There was an error uploading the file: %s`, - err.response ? err.response.data : err - ); - }); -} -``` + diff --git a/pages/customer-cards.mdx b/pages/customer-cards.mdx index b445370..0998a04 100644 --- a/pages/customer-cards.mdx +++ b/pages/customer-cards.mdx @@ -17,35 +17,11 @@ description: 'Customer Cards are a powerful feature in Plain that let you show i Based on your Customer Card settings, Plain will send a request to your API like the below example: -```json -{ - "cardKeys": ["plan-details"], - "customer": { - "email": "alex@grocery.co", - "externalId": "your_user_id_795BFCD5-130F-4E72-BD46-14F717BE0830" - } -} -``` + Your API should then reply with a list of cards matching the requested keys where each card contains the components you want to display: -```json -{ - "cards": [ - { - "key": "plan-details", - "timeToLiveSeconds": 86400, - "components": [ - { - "componentText": { - "text": "Enterprise Tier" - } - } - ] - } - ] -} -``` + ## UI Components diff --git a/pages/customer-cards/documentation.mdx b/pages/customer-cards/documentation.mdx index 4a04cfe..f44146b 100644 --- a/pages/customer-cards/documentation.mdx +++ b/pages/customer-cards/documentation.mdx @@ -77,15 +77,7 @@ Plain will make the following request to your backend: Example request body: -```json -{ - "cardKeys": ["plan-details", "subscription-status"], - "customer": { - "email": "alex@grocery.co", - "externalId": "your_user_id_795BFCD5-130F-4E72-BD46-14F717BE0830" - } -} -``` + ### Request deduplication @@ -133,52 +125,11 @@ The response body must be a JSON object with: Example response body for a card cached for 1 hour: -```json -{ - "cards": [ - { - "key": "plan-details", - "timeToLiveSeconds": 86400, - "components": [ - { - "componentRow": { - "rowMainContent": [ - { - "componentText": { - "text": "Plan", - "textColor": "MUTED", - "textSize": "M" - } - } - ], - "rowAsideContent": [ - { - "componentBadge": { - "badgeLabel": "Starter", - "badgeColor": "YELLOW" - } - } - ] - } - } - ] - } - ] -} -``` + Example response body for a card that has no data and should not be displayed and TTL omitted: -```json -{ - "cards": [ - { - "key": "plan-details", - "components": null - } - ] -} -``` + ## Retry strategy diff --git a/pages/graphql/customers/customer-groups.mdx b/pages/graphql/customers/customer-groups.mdx index 9a6729e..457f1c0 100644 --- a/pages/graphql/customers/customer-groups.mdx +++ b/pages/graphql/customers/customer-groups.mdx @@ -1,6 +1,6 @@ --- title: 'Customer groups' -description: 'Customer groups can be used to group and segment your customers, e.g. pricing tier: free, paying, enterprise etc.' +description: 'Customer groups can be used to group and segment your customers, e.g. pricing tier: free paying, enterprise etc.' --- Customers can belong to one or many groups. You can filter your customers by group, allowing you to quickly focus on a subset of your customers. @@ -24,176 +24,21 @@ This operation requires the following permissions: -```typescript -import { PlainClient } from '@team-plain/typescript-sdk'; - -const client = new PlainClient({ apiKey: 'plainApiKey_xxx' }); - -const res = await client.addCustomerToCustomerGroups({ - customerId: 'c_01GTC6ZHCMAGR06FMPN9VY5J95', - customerGroupIdentifiers: [ - { - customerGroupKey: 'free-tier', - }, - { - customerGroupKey: 'design-partner', - }, - ], -}); - -if (res.error) { - console.error(res.error); -} else { - console.log(res.data); -} -``` - - Running the above would console.log: - -```scheme -[ - { - customerId: 'c_01GTC6ZHCMAGR06FMPN9VY5J95', - createdAt: { - __typename: 'DateTime', - iso8601: '2023-06-21T14:20:12.014Z', - unixTimestamp: '1687357212014', - }, - createdBy: { - __typename: 'MachineUserActor', - machineUserId: 'mu_01H1P0P0PHA2BJRRS7EC02XKCF', - }, - updatedAt: { - __typename: 'DateTime', - iso8601: '2023-06-21T14:20:12.014Z', - unixTimestamp: '1687357212014', - }, - updatedBy: { - __typename: 'MachineUserActor', - machineUserId: 'mu_01H1P0P0PHA2BJRRS7EC02XKCF', - }, - customerGroup: { - id: 'cg_01H1P1RK22WTVMFRY8BX6S6VJX', - name: 'free tier', - key: 'free-tier', - color: '#E78450', - }, - }, - { - customerId: 'c_01GTC6ZHCMAGR06FMPN9VY5J95', - createdAt: { - __typename: 'DateTime', - iso8601: '2023-06-21T14:20:12.014Z', - unixTimestamp: '1687357212014', - }, - createdBy: { - __typename: 'MachineUserActor', - machineUserId: 'mu_01H1P0P0PHA2BJRRS7EC02XKCF', - }, - updatedAt: { - __typename: 'DateTime', - iso8601: '2023-06-21T14:20:12.014Z', - unixTimestamp: '1687357212014', - }, - updatedBy: { - __typename: 'MachineUserActor', - machineUserId: 'mu_01H1P0P0PHA2BJRRS7EC02XKCF', - }, - customerGroup: { - id: 'cg_01H1P1S2HD9PERNNS591ZT28ZZ', - name: 'design partner', - key: 'design-partner', - color: '#FBBF24', - }, - }, -]; -``` + + + Running the above would console.log: + + -```graphql Mutation -mutation addCustomerToCustomerGroup($input: AddCustomerToCustomerGroupsInput!) { - addCustomerToCustomerGroups(input: $input) { - customerGroupMemberships { - customerGroup { - id - name - key - color - } - } - error { - message - code - type - fields { - field - message - type - } - } - } -} -``` - -```json Variables -{ - "input": { - "customerId": "c_01GTC6ZHCMAGR06FMPN9VY5J95", - "customerGroupIdentifiers": [ - { - "customerGroupKey": "free-tier" - }, - { - "customerGroupKey": "design-partner" - } - ] - } -} -``` + If you prefer you can also use the customer group id instead of the key. You can do this like so: -```json Variables -{ - "input": { - "customerId": "c_01GTC6ZHCMAGR06FMPN9VY5J95", - "customerGroupIdentifiers": [ - { - "customerGroupId": "cg_01GX8H2BWS7Z4EP9RRGMF9NXX2" - } - ] - } -} -``` - -```json Variables -{ - "data": { - "customerGroupMemberships": [ - { - "customerGroup": { - "id": "cg_01GX8H2BWS7Z4EP9RRGMF9NXX2", - "name": "Free Tier", - "key": "free-tier", - "color": "#1D4ED8" - } - }, - { - "customerGroup": { - "id": "cg_05GXF4FGGS2Z7EW9RRGKL9NLL9", - "name": "Design partner", - "key": "design-partner", - "color": "#06B6D4" - } - } - ], - "error": null - } -} -``` + @@ -207,92 +52,18 @@ A customer can be removed from a customer group by using the `removeCustomerFrom -```typescript -import { PlainClient } from '@team-plain/typescript-sdk'; - -const client = new PlainClient({ - apiKey: 'plainApiKey_rO6tIKWU2w0gD_ek9HwjsHMiq1MHsgAn7mhVrcC7MGw', -}); - -const res = await client.removeCustomerFromCustomerGroups({ - customerId: 'c_01H1P4TE62AS5KZ4CZFC0578ED', - customerGroupIdentifiers: [ - { - customerGroupKey: 'free-tier', - }, - { - customerGroupKey: 'design-partner', - }, - ], -}); - -if (res.error) { - console.error(res.error); -} else { - console.log(res.data); -} -``` + Which if successful will console.log `null` -```graphql Mutation -mutation removeCustomerFromCustomerGroup($input: RemoveCustomerFromCustomerGroupsInput!) { - removeCustomerFromCustomerGroups(input: $input) { - error { - message - code - type - fields { - field - message - type - } - } - } -} -``` - -```json Variables -{ - "input": { - "customerId": "c_01GTC6ZHCMAGR06FMPN9VY5J95", - "customerGroupIdentifiers": [ - { - "customerGroupKey": "free-tier" - }, - { - "customerGroupKey": "design-partner" - } - ] - } -} -``` + If you prefer you can also use the customer group id instead of the key. You can do this like so: -```json Variables -{ - "input": { - "customerId": "c_01GTC6ZHCMAGR06FMPN9VY5J95", - "customerGroupIdentifiers": [ - { - "customerGroupId": "cg_01GX8H2BWS7Z4EP9RRGMF9NXX2" - } - ] - } -} -``` - -```json Response -{ - "data": { - "error": null - } -} -``` + diff --git a/pages/graphql/customers/delete.mdx b/pages/graphql/customers/delete.mdx index 482ef1d..c2aa1e4 100644 --- a/pages/graphql/customers/delete.mdx +++ b/pages/graphql/customers/delete.mdx @@ -16,53 +16,11 @@ This operation requires the following permissions: -```typescript -import { PlainClient } from '../client'; - -const client = new PlainClient({ - apiKey: 'XXX', -}); - -const res = await client.deleteCustomer({ - customerId: 'c_01H1P4TE62AS5KZ4CZFC0578ED', -}); - -if (res.error) { - console.error(res.error); -} else { - // Success -} -``` + - -```grapql Mutation -mutation deleteCustomer($input: DeleteCustomerInput!) { - deleteCustomer(input: $input) { - error { - __typename - message - type - code - fields { - field - message - type - } - } - } -} -``` - -```json Variables -{ - "input": { - "customerId": "c_01H14DFQ4PDYBH398J1E99TWSS" - } -} -``` - + diff --git a/pages/graphql/customers/get.mdx b/pages/graphql/customers/get.mdx index 380f7c6..1e776a8 100644 --- a/pages/graphql/customers/get.mdx +++ b/pages/graphql/customers/get.mdx @@ -20,67 +20,11 @@ This is a very flexible endpoint which supports a variety of options for filteri -```typescript -const client = new PlainClient({ - apiKey: 'XXX', -}); - -const res = await client.getCustomers({ - first: 50, - filters: { isMarkedAsSpam: false }, - sortBy: { field: CustomersSortField.FullName, direction: SortDirection.Asc }, -}); - -if (res.error) { - console.error(res.error); -} else { - console.log(res.data); -} -``` + - -```graphql Query -query getCustomers($cursor: String!) { - customers( - after: $cursor - first: 50 - filters: { isMarkedAsSpam: false } - sortBy: { field: FULL_NAME, direction: ASC } - ) { - edges { - node { - id - fullName - shortName - email { - email - isVerified - } - externalId - markedAsSpamAt { - iso8601 - } - } - } - totalCount - pageInfo { - hasPreviousPage - hasNextPage - startCursor - endCursor - } - } -} -``` - -```json Variables -{ - "cursor": "eyJjdXN0b21lcnMuZnVsbF9uYW1lIjoiQWlkYSBTY2hpbm5lciIsImN1c3RvbWVycy5pZCI6ImNfMDFHMThFU01TWkdUWTQwU1pITk03M0hBQkIifQ==" -} -``` - + @@ -90,48 +34,12 @@ query getCustomers($cursor: String!) { If you already have the ID of a customer from within Plain or one of our other endpoints you can fetch more details about them using `getCustomerById` in our SDKs or the `customer` query in GraphQL. - -```typescript -const client = new PlainClient({ - apiKey: 'XXX', -}); - -const res = await client.getCustomerById({ customerId: 'c_01H14DFQ4PDYBH398J1E99TWSS' }); - -if (res.error) { - console.error(res.error); -} else { - console.log(res.data); -} -``` + + - -```graphql Query -query getCustomerById($customerId: ID!) { - customer(customerId: $customerId) { - id - fullName - shortName - email { - email - isVerified - } - externalId - markedAsSpamAt { - iso8601 - } - } -} -``` - -```json Variables -{ - "customerId": "c_01H14DFQ4PDYBH398J1E99TWSS" -} -``` - + @@ -141,48 +49,12 @@ query getCustomerById($customerId: ID!) { To fetch a customer by email you can use `getCustomerByEmail` in our SDKs or the `customerByEmail` query in GraphQL. - -```typescript -const client = new PlainClient({ - apiKey: 'XXX', -}); - -const res = await client.getCustomerByEmail({ email: 'bob@example.com' }); - -if (res.error) { - console.error(res.error); -} else { - console.log(res.data); -} -``` + + - -```graphql Query -query getCustomerByEmail($email: String!) { - customerByEmail(email: $email) { - id - fullName - shortName - email { - email - isVerified - } - externalId - markedAsSpamAt { - iso8601 - } - } -} -``` - -```json Variables -{ - "email": "bob@example.com" -} -``` - + diff --git a/pages/graphql/customers/upsert.mdx b/pages/graphql/customers/upsert.mdx index f807911..75b80a4 100644 --- a/pages/graphql/customers/upsert.mdx +++ b/pages/graphql/customers/upsert.mdx @@ -30,227 +30,16 @@ This will: + -```typescript -import { PlainClient } from '@team-plain/typescript-sdk'; - -const client = new PlainClient({ apiKey: 'plainApiKey_xxx' }); - -const res = await client.upsertCustomer({ - identifier: { - emailAddress: 'donald@example.com', - }, - // If the customer is not found and should be created then - // these details will be used: - onCreate: { - fullName: 'Donald Duck', - shortName: 'Donald', - email: { - email: 'donald@example.com', - isVerified: true, - }, - - // This is the id of the customer in your own backend. - // Filling this out makes it easy to link customers in Plain - // back to customer in your own systems. - externalId: 'c_123', - - // This is optional but if you want to put a customer into a group - // on creation, this is how you do it. - customerGroupIdentifiers: [ - { - customerGroupKey: 'enterprise', - }, - ], - }, - // If the customer already exists and should be updated then - // these details will be used. You can do partial updates by - // just providing some of the fields below. - onUpdate: { - fullName: { - value: 'Donald Duck', - }, - shortName: { - value: 'Donald', - }, - email: { - email: 'donald@example.com', - isVerified: true, - }, - externalId: { - value: 'c_123', - }, - }, -}); - -if (res.error) { - console.error(res.error); -} else { - console.log(res.data); -} -``` - - Running the above would console.log: - -```json -{ - "result": "CREATED", - "customer": { - "__typename": "Customer", - "id": "c_01H3D5NFQCTC41PYXT2BX9MD6A", - "fullName": "Donald Duck", - "shortName": "Donald", - "externalId": "c_123", - "email": { - "email": "donald@example.com", - "isVerified": false, - "verifiedAt": null - }, - "status": "IDLE", - "statusChangedAt": { - "__typename": "DateTime", - "iso8601": "2023-06-20T19:49:20.236Z", - "unixTimestamp": "1687290560236" - }, - "assignedToUser": null, - "assignedAt": null, - "updatedAt": { - "__typename": "DateTime", - "iso8601": "2023-06-20T19:49:20.236Z", - "unixTimestamp": "1687290560236" - }, - "lastIdleAt": null, - "createdAt": { - "__typename": "DateTime", - "iso8601": "2023-06-20T19:49:20.236Z", - "unixTimestamp": "1687290560236" - }, - "createdBy": { - "__typename": "MachineUserActor", - "machineUserId": "mu_01GZEA2M91124MPFAVZEPKC2MY" - }, - "markedAsSpamAt": null - } -} -``` + Running the above would console.log: + The GraphQL mutation is the following: - -```graphql Mutation -mutation upsertCustomer($input: UpsertCustomerInput!) { - upsertCustomer(input: $input) { - result - customer { - id - externalId - shortName - fullName - email { - email - isVerified - } - status - customerGroupMemberships { - edges { - node { - customerGroup { - name - key - } - } - } - } - } - error { - message - type - code - fields { - field - message - type - } - } - } -} -``` - -```graphql Variables - -{ - "input": { - "identifier": { - "emailAddress": "donald@example.com" - }, - "onCreate": { - "fullName": "Donald Duck", - "shortName": "Donald", - "email": { - "email": "donald@example.com", - "isVerified": false - }, - "customerGroupIdentifiers": [ - { - "customerGroupKey": "enterprise" - } - ] - }, - "onUpdate": { - "fullName": { - "value": "Donald Duck" - }, - "shortName": { - "value": "Donald" - }, - "email": { - "email": "donald@example.com", - "isVerified": true - }, - "externalId": { - "value": "c_123" - } - } - } -} -``` - -```json Response -{ - "data": { - "upsertCustomer": { - "result": "CREATED", - "customer": { - "id": "c_01G8JVJ6A3CX5ZSJ4AVJYC42HW", - "externalId": null, - "shortName": "Donald", - "fullName": "Donald Duck", - "email": { - "email": "donald@example.com", - "isVerified": false - }, - "status": "IDLE", - "customerGroupMemberships": { - "edges": [ - { - "node": { - "customerGroup": { - "name": "Enterprise", - "key": "enterprise" - } - } - } - ] - } - }, - "error": null - } - } -} -``` - + diff --git a/pages/graphql/error-handling.mdx b/pages/graphql/error-handling.mdx index bbf5bb8..7b8d102 100644 --- a/pages/graphql/error-handling.mdx +++ b/pages/graphql/error-handling.mdx @@ -29,7 +29,7 @@ The list of error extensions that can be returned by queries: All mutations return with an `Output` type that follow a consistent pattern of having two optional fields, one for the result and one for the error. If the error is returned then the mutation failed. -```typescript +```tsx type Example { data: String! } @@ -66,7 +66,7 @@ You can see the [full error types in the code of the Typescript SDK](https://git This is how you can access the error when using the SDK: -```typescript +```tsx import { PlainClient } from '../client'; export async function createCustomer() { diff --git a/pages/graphql/events.mdx b/pages/graphql/events.mdx index 16bb9cc..33e12e4 100644 --- a/pages/graphql/events.mdx +++ b/pages/graphql/events.mdx @@ -18,7 +18,7 @@ To define what each event should look like, you use the Plain UI components. All **Coming soon!** - + We're still working on a nice interactive playground but in the meantime you may want to use the [Customer Cards Playground](https://app.plain.com/developer/customer-cards-playground/) as they both use the same [UI components](/ui-components/) so you can get a good visual sense of what your event will look like. diff --git a/pages/graphql/events/create-customer-event.mdx b/pages/graphql/events/create-customer-event.mdx index 85e37a8..65474ba 100644 --- a/pages/graphql/events/create-customer-event.mdx +++ b/pages/graphql/events/create-customer-event.mdx @@ -22,7 +22,7 @@ In this example we'll be creating the following event: - `customerEvent:read` - `customer:read` - ```typescript + ```tsx import { PlainClient, uiComponent } from '@team-plain/typescript-sdk'; const client = new PlainClient({ @@ -126,81 +126,7 @@ In this example we'll be creating the following event: - `customerEvent:create` - `customerEvent:read` -```graphql Mutation -mutation createCustomerEvent($input: CreateCustomerEventInput!) { - createCustomerEvent(input: $input) { - customerEvent { - __typename - id - title - createdAt { - __typename - iso8601 - unixTimestamp - } - } - error { - __typename - message - type - code - fields { - field - message - type - } - } - } -} -``` - -```json Variables -{ - "input": { - "title": "API key generated", - - "customerIdentifier": { - // You can use the email: - "email": "jane@acme.com" - - // ...or if you set external id on customers: - // externalId: 'YOUR_ID', - - // ...or you can use the customer's id in Plain: - // customerId: 'c_123' - }, - - "components": [ - { - "componentText": { - "text": "New API key was added with the fingerprint **3b7896975ee9fd15eeb7** with 4 associated roles." - } - }, - { - "componentSpacer": { - "spacerSize": "M" - } - }, - { - "componentLinkButton": { - "linkButtonLabel": "View in admin", - "linkButtonUrl": "https://admin.your-app.com" - } - } - ], - - // Optional - if provided, this will ensure that this event can only - // be created once and fail on the second time. This external id acts - // as an idempotency key while also letting you correlate an event to - // something your systems. - "externalId": "XXX", - - // Optional - if provided then the event will only be shown - // in a single thread vs all threads from a customer - "threadId": "th_01HB924RWAW8H3Q8KZDFWYBJHZ" - } -} -``` + diff --git a/pages/graphql/labels/add.mdx b/pages/graphql/labels/add.mdx index d1e33bf..b2ec154 100644 --- a/pages/graphql/labels/add.mdx +++ b/pages/graphql/labels/add.mdx @@ -13,111 +13,17 @@ This operation requires the following permissions: -```typescript -import { PlainClient } from '@team-plain/typescript-sdk'; - -const client = new PlainClient({ apiKey: 'plainApiKey_xxx' }); - -const res = await client.addLabels({ - labelTypeIds: ['lt_01HB8BTNVM7GEBKBEDNC2K8ST7'], - threadId: 'th_01HD1G6649R1DK061W27VBT7QB', -}); - -if (res.error) { - console.error(res.error); -} else { - console.log(res.data); -} -``` + This will output: -```json -[ - { - "__typename": "Label", - "id": "l_01HD4A7SJQ81DKP95A1GDCYE49", - "labelType": { - "__typename": "LabelType", - "id": "lt_01HB8BTN5S8NAJGSNC3NJZ7FV4", - "name": "Bug report", - "icon": "pest", - "isArchived": true, - "archivedAt": { - "__typename": "DateTime", - "iso8601": "2023-09-26T09:08:12.198Z", - "unixTimestamp": "1695719292198" - }, - "archivedBy": { - "__typename": "UserActor", - "userId": "u_01FN4BEVKY3EQQ5BFC24M8JTJH" - }, - "createdAt": { - "__typename": "DateTime", - "iso8601": "2023-09-26T09:06:23.545Z", - "unixTimestamp": "1695719183545" - }, - "createdBy": { - "__typename": "SystemActor", - "systemId": "job" - }, - "updatedAt": { - "__typename": "DateTime", - "iso8601": "2023-09-26T09:08:12.198Z", - "unixTimestamp": "1695719292198" - }, - "updatedBy": { - "__typename": "UserActor", - "userId": "u_01FN4BEVKY3EQQ5BFC24M8JTJH" - } - }, - "createdAt": { - "__typename": "DateTime", - "iso8601": "2023-10-19T15:53:02.808Z", - "unixTimestamp": "1697730782808" - }, - "createdBy": { - "__typename": "MachineUserActor", - "machineUserId": "mu_01HCYZZFGEGEMTKM0T2Z8Z2BK6" - }, - "updatedAt": { - "__typename": "DateTime", - "iso8601": "2023-10-19T15:53:02.808Z", - "unixTimestamp": "1697730782808" - }, - "updatedBy": { - "__typename": "MachineUserActor", - "machineUserId": "mu_01HCYZZFGEGEMTKM0T2Z8Z2BK6" - } - } -] -``` + -```graphql Mutation -mutation addLabels($input: AddLabelsInput!) { - addLabels(input: $input) { - labels { - id - createdAt { - iso8601 - } - } - } -} -``` - -```json Variables -{ - "input": { - "labelTypeIds": ["lt_01HB8BTNTZ58730MX8H5VMKFD5", "lt_01HB8BTNKSCF1FK5ETFVRSDC6G"], - "threadId": "th_01H8H46YPB2S4MAJM382FG9423" - } -} -``` + diff --git a/pages/graphql/labels/remove.mdx b/pages/graphql/labels/remove.mdx index d8c8c25..7c1da0a 100644 --- a/pages/graphql/labels/remove.mdx +++ b/pages/graphql/labels/remove.mdx @@ -9,45 +9,12 @@ This operation requires the following permissions: -```typescript -import { PlainClient } from '@team-plain/typescript-sdk'; - -const client = new PlainClient({ apiKey: 'plainApiKey_xxx' }); - -const res = await client.removeLabels({ labelIds: ['l_01HD428Y1TREH5KTXP019K6FPK'] }); - -if (res.error) { - console.error(res.error); -} else { - console.log(res.data); -} -``` - - A successful execution of this script would output `null`. + + Which if successful will console log `null`. - -```graphql Mutation -mutation removeLabels($input: RemoveLabelsInput!) { - removeLabels(input: $input) { - error { - message - type - code - } - } -} -``` - -```json Variables -{ - "input": { - "labelIds": ["l_01HB8BTNTZ58730MX8H5VMKFD5", "l_01HB8BTNKSCF1FK5ETFVRSDC6G"] - } -} -``` - + diff --git a/pages/graphql/messaging/reply-email.mdx b/pages/graphql/messaging/reply-email.mdx index 6d27c0c..8810dca 100644 --- a/pages/graphql/messaging/reply-email.mdx +++ b/pages/graphql/messaging/reply-email.mdx @@ -15,24 +15,7 @@ You can reply to an inbound email with the `replyToEmail` API. - `email:read` - `attachment:read` -```typescript -import { PlainClient } from '@team-plain/typescript-sdk'; - -const client = new PlainClient({ apiKey: 'plainApiKey_xxx' }); - -client.replyToEmail({ - customerId: 'c_01GTC6ZHCMAGR06FMPN9VY5J95', - inReplyToEmailId: 'em_01GM2X8K7D3RZ7ZFGHZ2AYG3SA', - textContent: 'The plain text version of your reply goes here.', - markdownContent: 'The markdown **version** of your _reply_ goes here.', -}); - -if (res.error) { - console.error(res.error); -} else { - console.log(res.data); -} -``` + @@ -42,31 +25,7 @@ if (res.error) { - `email:create` - `email:read` -```graphql Mutation -mutation replyToEmail($input: ReplyToEmailInput!) { - replyToEmail(input: $input) { - email { - id - } - error { - message - type - code - } - } -} -``` - -```json Variables -{ - "input": { - "customerId": "c_01GTC6ZHCMAGR06FMPN9VY5J95", - "inReplyToEmailId": "em_01GM2X8K7D3RZ7ZFGHZ2AYG3SA", - "textContent": "The plain text version of your reply goes here.", - "markdownContent": "The markdown **version** of your _reply_ goes here." - } -} -``` + diff --git a/pages/graphql/messaging/send-email.mdx b/pages/graphql/messaging/send-email.mdx index 047aeb5..bf167ed 100644 --- a/pages/graphql/messaging/send-email.mdx +++ b/pages/graphql/messaging/send-email.mdx @@ -5,56 +5,13 @@ description: 'You can send new outbound emails to customers with the `sendNewEma -```typescript -import { PlainClient } from '@team-plain/typescript-sdk'; - -const client = new PlainClient({ apiKey: 'plainApiKey_xxx' }); - -client.sendNewEmail({ - customerId: 'c_01GTC6ZHCMAGR06FMPN9VY5J95', - threadId: 'th_01HD44FHMCDSSWE38N14FSYV6K', - subject: 'Your account has a problem', - textContent: 'The plain text version of your email goes here.', - markdownContent: 'The markdown **version** of your _email_ goes here.', -}); - -if (res.error) { - console.error(res.error); -} else { - console.log(res.data); -} -``` + -```graphql Mutation -mutation sendNewEmail($input: SendNewEmailInput!) { - sendNewEmail(input: $input) { - email { - id - } - error { - message - type - code - } - } -} -``` - -```json Variables -{ - "input": { - "customerId": "c_01GTC6ZHCMAGR06FMPN9VY5J95", - "threadId": "th_01HD44FHMCDSSWE38N14FSYV6K", - "subject": "Your account has a problem", - "textContent": "The plain text version of your email goes here.", - "markdownContent": "The markdown **version** of your _email_ goes here." - } -} -``` + diff --git a/pages/graphql/pagination.mdx b/pages/graphql/pagination.mdx index c6802e5..7773d59 100644 --- a/pages/graphql/pagination.mdx +++ b/pages/graphql/pagination.mdx @@ -14,64 +14,18 @@ Endpoints which return paginated results will return a `pageInfo` object along w -```typescript -import { PlainClient } from '../client'; - -const client = new PlainClient({ - apiKey: 'XXX', -}); - -const firstPage = client.getCustomers({}); - -if (firstPage.error) { - console.error(firstPage.error); -} else { - const { pageInfo } = firstPage.data; - const secondPage = await client.getCustomers({ after: pageInfo.endCursor, first: 50 }); -} -``` + - Notice how we use the cursor information from the first page to fetch the second page. The returned `pageInfo` looks as follows: + Notice how we use the cursor information from the first page to fetch the second page. The returned `pageInfo` looks as follows: -```json -{ - "customers": [ - // Customers would be here, elided for clarity - ], - "totalCount": 1047, - "pageInfo": { - "hasPreviousPage": false, - "hasNextPage": true, - "startCursor": "eyJjdXN0b21lcnMuZnVsbF9uYW1lIjoiQWlzaGEgSGF5ZXMiLCJjdXN0b21lcnMuaWQiOiJjXzAxRllFWjlBRTk2S1c4SFJHSDhWVEZKU1JIIn0=", - "endCursor": "eyJjdXN0b21lcnMuZnVsbF9uYW1lIjoiQWxsYW4gQnJhdW4iLCJjdXN0b21lcnMuaWQiOiJjXzAxSDFSQkRBV1BFQlpIRzlIODVORzE5SFdQIn0=" - } -} -``` + - This will fetch a subsequent page of 50 entries by passing in the `endCursor` from an initial query. - -```grapql Second page -query getCustomers($cursor: String!) { - customers(after: $cursor, first: 50) { - edges { - node { - fullName - } - } - totalCount - pageInfo { - hasPreviousPage - hasNextPage - startCursor - endCursor - } - } -} -``` + This will fetch a subsequent page of 50 entries by passing in the `endCursor` from an initial query. + diff --git a/pages/graphql/threads/assignment.mdx b/pages/graphql/threads/assignment.mdx index 3cf013a..7be4745 100644 --- a/pages/graphql/threads/assignment.mdx +++ b/pages/graphql/threads/assignment.mdx @@ -1,9 +1,4 @@ import { Tabs, Tab } from 'nextra-theme-docs'; -import AssignThreadTypescriptSDK from '../../../snippets/typescript-sdk/assign-thread.mdx'; -import AssignThreadResponseTypescriptSDK from '../../../snippets/typescript-sdk/assign-thread-response.mdx'; -import AssignThreadGraphQL from '../../../snippets/graphql/assign-thread.mdx'; -import UnassignThreadTypescriptSDK from '../../../snippets/typescript-sdk/unassign-thread.mdx'; -import UnassignThreadGraphQL from '../../../snippets/graphql/unassign-thread.mdx'; # Assign threads @@ -18,130 +13,12 @@ To assign threads you need an API key with the following permissions: -```typescript -import { PlainClient } from '@team-plain/typescript-sdk'; - -const client = new PlainClient({ - apiKey: 'XXX', -}); - -const res = await client.assignThread({ - threadId: 'th_01H8H46YPB2S4MAJM382FG9423', - userId: 'u_01FSVKMHFDHJ3H5XFM20EMCBQN', - - // You could instead assign to a machine user by doing: - // machineUserId: 'XXX' -}); - -if (res.error) { - console.error(res.error); -} else { - console.log(`Thread assigned (${res.data.id})`); -} -``` + Where `res.data` is the full thread: -```json -import { PlainClient } from '@team-plain/typescript-sdk'; - -const client = new PlainClient({ - apiKey: 'XXX', -}); - -const res = await client.assignThread({ - threadId: 'th_01H8H46YPB2S4MAJM382FG9423', - userId: 'u_01FSVKMHFDHJ3H5XFM20EMCBQN', - - // You could instead assign to a machine user by doing: - // machineUserId: 'XXX' -}); - -if (res.error) { - console.error(res.error); -} else { - console.log(`Thread assigned (${res.data.id})`); -} -Where res.data is the full thread: - -{ -"**typename": "Thread", -"id": "th_01H8H46YPB2S4MAJM382FG9423", -"externalId": null, -"customer": { -"id": "c_01H8H46Y7N69VTSF4WXCJTVATZ" -}, -"status": "TODO", -"statusChangedAt": { -"**typename": "DateTime", -"iso8601": "2023-08-23T11:59:22.315Z", -"unixTimestamp": "1692791962315" -}, -"title": "Support request", -"previewText": "Hello can you please...", -"priority": 2, -"labels": [], -"assignedAt": { -"**typename": "DateTime", -"iso8601": "2023-10-05T13:12:12.050Z", -"unixTimestamp": "1696511532050" -}, -"assignedTo": { -"**typename": "User", -"id": "u_01FSVKMHFDHJ3H5XFM20EMCBQN", -"fullName": "Matt Vagni", -"publicName": "Matt", -"email": "matt@plain.com", -"updatedAt": { -"**typename": "DateTime", -"iso8601": "2023-05-16T12:36:52.266Z", -"unixTimestamp": "1684240612266" -} -}, -"createdAt": { -"**typename": "DateTime", -"iso8601": "2023-08-23T11:59:22.315Z", -"unixTimestamp": "1692791962315" -}, -"createdBy": { -"**typename": "MachineUserActor", -"machineUserId": "mu_01H0J96X3KJ3C2S2W9T5S3CC1R" -}, -"updatedAt": { -"**typename": "DateTime", -"iso8601": "2023-10-05T13:12:12.050Z", -"unixTimestamp": "1696511532050" -}, -"updatedBy": { -"\_\_typename": "MachineUserActor", -"machineUserId": "mu_01HBZM0TZAKAZPJ47NX7X7XMDY" -} -} - -```` + -```graphql Mutation -mutation assignThread($input: AssignThreadInput!) { - markThreadAsDone(input: $input) { - thread { - id - status - } - } -} -```` - -```json Variables -{ - "input": { - "threadId": "th_01H8H46YPB2S4MAJM382FG9423", - "userId": "u_01FSVKMHFDHJ3H5XFM20EMCBQN" - - // You could instead assign to a machine user by doing: - // machineUserId: 'XXX' - } -} -``` - + @@ -154,44 +31,10 @@ To unassign threads you need an API key with the following permissions: -```typescript -import { PlainClient } from '@team-plain/typescript-sdk'; - -const client = new PlainClient({ - apiKey: 'XXX', -}); - -const res = await client.unassignThread({ - threadId: 'th_01H8H46YPB2S4MAJM382FG9423', -}); - -if (res.error) { - console.error(res.error); -} else { - console.log(`Thread unassigned (${res.data.id})`); -} -``` + Where `res.data` is the full thread like with assignment. -```graphql Mutation -mutation unassignThread($input: UnassignThreadInput!) { - unassignThread(input: $input) { - thread { - id - status - } - } -} -``` - -```json Variables -{ - "input": { - "threadId": "th_01H8H46YPB2S4MAJM382FG9423" - } -} -``` - + diff --git a/pages/graphql/threads/create.mdx b/pages/graphql/threads/create.mdx index fee0337..70691a3 100644 --- a/pages/graphql/threads/create.mdx +++ b/pages/graphql/threads/create.mdx @@ -24,138 +24,11 @@ To create a thread you need a `customerId`. You can get a customer id by [creati - `thread:read` - `user:read` -```typescript -import { PlainClient } from '@team-plain/typescript-sdk'; - -const client = new PlainClient({ - apiKey: 'XXX', - debug: true, -}); - -const res = await client.createThread({ - title: 'Bug Report', - customerIdentifier: { - // You can use the email: - email: 'jane@acme.com', - - // ...or if you set external id on customers: - // externalId: '', - - // ...or you can use the customer's id in Plain: - // customerId: 'c_123' - }, - components: [ - { - componentText: { - text: "The login button is not working, it doesn't do anything.", - }, - }, - ], - // Label types are created in settings where you can also copy - // their ID. - labelTypeIds: ['lt_01HB924PME9C0YWKW1N4AK3BZA'], -}); - -if (res.error) { - console.error(res.error); -} else { - // The full thread is returned as res.data - console.log(`Thread created with id=${res.data.id}`); -} -``` + Where `result.data` is: -```json -{ - "__typename": "Thread", - "id": "th_01HB924RWAW8H3Q8KZDFWYBJHZ", - "externalId": null, - "customer": { - "id": "c_01H14DFQ4PDYBH398J1E99TWSS" - }, - "status": "TODO", - "statusChangedAt": { - "__typename": "DateTime", - "iso8601": "2023-09-26T15:36:23.690Z", - "unixTimestamp": "1695742583690" - }, - "title": "Bug Report", - "previewText": "The login button is not working, it doesn't do anything.", - "priority": 2, - "labels": [ - { - "__typename": "Label", - "id": "l_01HBZMPM4FWANWKB25NWP8Q1FS", - "labelType": { - "__typename": "LabelType", - "id": "lt_01HB924PME9C0YWKW1N4AK3BZA", - "name": "Bug report", - "icon": "bug", - "isArchived": false, - "archivedAt": null, - "archivedBy": null, - "createdAt": { - "__typename": "DateTime", - "iso8601": "2023-09-26T15:36:21.390Z", - "unixTimestamp": "1695742581390" - }, - "createdBy": { - "__typename": "SystemActor", - "systemId": "job" - }, - "updatedAt": { - "__typename": "DateTime", - "iso8601": "2023-09-26T15:36:21.390Z", - "unixTimestamp": "1695742581390" - }, - "updatedBy": { - "__typename": "SystemActor", - "systemId": "job" - } - }, - "createdAt": { - "__typename": "DateTime", - "iso8601": "2023-10-05T10:04:00.527Z", - "unixTimestamp": "1696500240527" - }, - "createdBy": { - "__typename": "UserActor", - "userId": "u_01FSVKMHFDHJ3H5XFM20EMCBQN" - }, - "updatedAt": { - "__typename": "DateTime", - "iso8601": "2023-10-05T10:04:00.527Z", - "unixTimestamp": "1696500240527" - }, - "updatedBy": { - "__typename": "UserActor", - "userId": "u_01FSVKMHFDHJ3H5XFM20EMCBQN" - } - } - ], - "assignedAt": null, - "assignedTo": null, - "createdAt": { - "__typename": "DateTime", - "iso8601": "2023-09-26T15:36:23.690Z", - "unixTimestamp": "1695742583690" - }, - "createdBy": { - "__typename": "MachineUserActor", - "machineUserId": "mu_01HBZM0TZAKAZPJ47NX7X7XMDY" - }, - "updatedAt": { - "__typename": "DateTime", - "iso8601": "2023-10-05T10:10:04.785Z", - "unixTimestamp": "1696500604785" - }, - "updatedBy": { - "__typename": "MachineUserActor", - "machineUserId": "mu_01HBZM0TZAKAZPJ47NX7X7XMDY" - } -} -``` + @@ -165,59 +38,7 @@ To create a thread, you need an API key with the following permissions: - `thread:create` - `thread:read` -```graphql Mutation -mutation createThread($input: CreateThreadInput!) { - createThread(input: $input) { - thread { - __typename - id - externalId - customer { - id - } - status - statusChangedAt { - __typename - iso8601 - unixTimestamp - } - title - previewText - priority - } - error { - __typename - message - type - code - fields { - field - message - type - } - } - } -} -``` - -```json Variables -{ - "input": { - "title": "Bug Report", - "customerIdentifier": { - "customerId": "c_01H14DFQ4PDYBH398J1E99TWSS" - }, - "components": [ - { - "componentText": { - "text": "The login button is not working, it doesn't do anything." - } - } - ], - "labelTypeIds": ["lt_01HB924PME9C0YWKW1N4AK3BZA"] - } -} -``` + diff --git a/pages/graphql/threads/status-changes.mdx b/pages/graphql/threads/status-changes.mdx index cc31643..29107b0 100644 --- a/pages/graphql/threads/status-changes.mdx +++ b/pages/graphql/threads/status-changes.mdx @@ -24,70 +24,11 @@ When any activity happens in a thread, it will move back to `Todo`. Unlike traditional ticketing software, we expect a ticket to move between `Todo` and `Done` a number of times in the course of helping a customer. This will not break or influence any metrics. `Done` in Plain means "I'm done for now, there is nothing left for me to do". - -```typescript -import { PlainClient } from '@team-plain/typescript-sdk'; - -const client = new PlainClient({ - apiKey: 'XXX', -}); - -const res = await client.markThreadAsDone({ - threadId: 'th_01HB924RWAW8H3Q8KZDFWYBJHZ', -}); - -if (res.error) { - console.error(res.error); -} else { - // The full thread is returned as res.data - console.log(`Thread marked as done (${res.data.id})`); -} -``` + + - -```graphql Mutation -mutation markThreadAsDone($input: MarkThreadAsDoneInput!) { - markThreadAsDone(input: $input) { - thread { - __typename - id - externalId - customer { - id - } - status - statusChangedAt { - __typename - iso8601 - unixTimestamp - } - title - previewText - priority - } - error { - __typename - message - type - code - fields { - field - message - type - } - } - } -} -``` - -```json Variables -{ - "input": { - "threadId": "th_01H8H46YPB2S4MAJM382FG9423" - } -} -``` - + + @@ -99,71 +40,10 @@ When any activity happens in a thread, it will be automatically unsnoozed and mo -```typescript -import { PlainClient } from '@team-plain/typescript-sdk'; - -const client = new PlainClient({ - apiKey: 'XXX', -}); - -const res = await client.snoozeThread({ - threadId: 'th_01HB924RWAW8H3Q8KZDFWYBJHZ', - durationSeconds: 5 * 24 * 60 * 60, // 5 days -}); - -if (res.error) { - console.error(res.error); -} else { - // The full thread is returned as res.data - console.log(`Thread snoozed (${res.data.id}`); -} -``` + -```grapql Mutation -mutation snoozeThread($input: SnoozeThreadInput!) { - snoozeThread(input: $input) { - thread { - __typename - id - externalId - customer { - id - } - status - statusChangedAt { - __typename - iso8601 - unixTimestamp - } - title - previewText - priority - } - error { - __typename - message - type - code - fields { - field - message - type - } - } - } -} -``` - -```json Variables -{ - "input": { - "threadId": "th_01H8H46YPB2S4MAJM382FG9423", - "durationSeconds": 432000 // 5 days - } -} -``` - + @@ -173,66 +53,9 @@ This is useful if you mistakenly marked a thread as done or snoozed a thread and -```typescript -import { PlainClient } from '@team-plain/typescript-sdk'; - -const client = new PlainClient({ - apiKey: 'XXX', -}); - -const res = await client.markThreadAsTodo({ - threadId: 'th_01HB924RWAW8H3Q8KZDFWYBJHZ', -}); - -if (res.error) { - console.error(res.error); -} else { - // The full thread is returned as res.data - console.log(`Thread marked as todo (${res.data.id})`); -} -``` + -```graphql Mutation -mutation markThreadAsTodo($input: MarkThreadAsTodoInput!) { - markThreadAsTodo(input: $input) { - thread { - __typename - id - externalId - customer { - id - } - status - statusChangedAt { - __typename - iso8601 - unixTimestamp - } - title - previewText - priority - } - error { - __typename - message - type - code - fields { - field - message - type - } - } - } -} -``` -```json Variables -{ - "input": { - "threadId": "th_01H8H46YPB2S4MAJM382FG9423" - } -} -``` + diff --git a/pages/ui-components/badge.mdx b/pages/ui-components/badge.mdx index e101da7..8750fe9 100644 --- a/pages/ui-components/badge.mdx +++ b/pages/ui-components/badge.mdx @@ -14,23 +14,12 @@ For example: -```typescript -import { uiComponent } from '@team-plain/typescript-sdk'; - -uiComponent.badge({ label: 'Subscribed', color: 'GREEN' }); -``` + -```json -{ - "componentBadge": { - "badgeLabel": "Subscribed", - "badgeColor": "GREEN" - } -} -``` + diff --git a/pages/ui-components/container.mdx b/pages/ui-components/container.mdx index 7289734..132eb51 100644 --- a/pages/ui-components/container.mdx +++ b/pages/ui-components/container.mdx @@ -24,30 +24,12 @@ For example: -```typescript -import { uiComponent } from '@team-plain/typescript-sdk'; - -uiComponent.container({ - content: [uiComponent.text({ text: 'Container content' })], -}); -``` + -```json -{ - "componentContainer": { - "containerContent": [ - { - "componentText": { - "text": "Container content" - } - } - ] - } -} -``` + diff --git a/pages/ui-components/copy-button.mdx b/pages/ui-components/copy-button.mdx index 0aa72bc..61b9ef9 100644 --- a/pages/ui-components/copy-button.mdx +++ b/pages/ui-components/copy-button.mdx @@ -15,26 +15,12 @@ For example: -```typescript -import { uiComponent } from '@team-plain/typescript-sdk'; - -uiComponent.copyButton({ - value: '2a8f2dae-3580-402b-aa0a-243efae55e39', - tooltip: 'Order ID', -}); -``` + -```json -{ - "componentCopyButton": { - "copyButtonTooltipLabel": "Order ID", - "copyButtonValue": "2a8f2dae-3580-402b-aa0a-243efae55e39" - } -} -``` + diff --git a/pages/ui-components/divider.mdx b/pages/ui-components/divider.mdx index 6d3e1f4..15032bf 100644 --- a/pages/ui-components/divider.mdx +++ b/pages/ui-components/divider.mdx @@ -14,37 +14,12 @@ For example: -```typescript -import { uiComponent } from '@team-plain/typescript-sdk'; - -[ - uiComponent.text({ text: 'Content before an XS divider' }), - uiComponent.divider({ spacingSize: 'XS' }), - uiComponent.text({ text: 'Content after divider' }), -]; -``` + -```json -[ - { - "componentText": { - "text": "Content before an XS divider" - } - }, - { - "componentDivider": { - "dividerSpacingSize": "XS" - } - }, - { - "componentText": { - "text": "Content after divider" - } - } -``` + diff --git a/pages/ui-components/link-button.mdx b/pages/ui-components/link-button.mdx index 01da550..fa0ec65 100644 --- a/pages/ui-components/link-button.mdx +++ b/pages/ui-components/link-button.mdx @@ -14,26 +14,12 @@ For example: -```typescript -import { uiComponent } from '@team-plain/typescript-sdk'; - -uiComponent.linkButton({ - label: 'Open in Admin Portal', - url: 'https://example.com', -}); -``` + -```json -{ - "componentLinkButton": { - "linkButtonLabel": "Open in Admin Portal", - "linkButtonUrl": "https://example.com" - } -} -``` + diff --git a/pages/ui-components/plain-text.mdx b/pages/ui-components/plain-text.mdx index 6c0dd6f..f96f553 100644 --- a/pages/ui-components/plain-text.mdx +++ b/pages/ui-components/plain-text.mdx @@ -15,83 +15,12 @@ For example: -```typescript -import { uiComponent } from '@team-plain/typescript-sdk'; - -[ - uiComponent.plainText({ text: 'Small text', size: 'S' }), - - uiComponent.plainText({ text: 'Medium text', size: 'M' }), - - uiComponent.plainText({ text: 'Large text', size: 'L' }), - - uiComponent.plainText({ text: 'Normal text', color: 'NORMAL' }), - - uiComponent.plainText({ text: 'Muted text', color: 'MUTED' }), - - uiComponent.plainText({ text: 'Success text', color: 'SUCCESS' }), - - uiComponent.plainText({ text: 'Warning text', color: 'WARNING' }), - - uiComponent.plainText({ text: 'Error text', color: 'ERROR' }), -]; -``` + -```json -[ - { - "componentPlainText": { - "plainText": "Small text", - "plainTextSize": "S" - } - }, - { - "componentPlainText": { - "plainText": "Medium text", - "plainTextSize": "M" - } - }, - { - "componentPlainText": { - "plainText": "Large text", - "plainTextSize": "L" - } - }, - { - "componentPlainText": { - "plainText": "Normal text", - "plainTextColor": "NORMAL" - } - }, - { - "componentPlainText": { - "plainText": "Muted text", - "plainTextColor": "MUTED" - } - }, - { - "componentPlainText": { - "plainText": "Success text", - "plainTextColor": "SUCCESS" - } - }, - { - "componentPlainText": { - "plainText": "Warning text", - "plainTextColor": "WARNING" - } - }, - { - "componentPlainText": { - "plainText": "Error text", - "plainTextColor": "ERROR" - } - } -] -``` + diff --git a/pages/ui-components/row.mdx b/pages/ui-components/row.mdx index 2963ec7..88c2424 100644 --- a/pages/ui-components/row.mdx +++ b/pages/ui-components/row.mdx @@ -24,39 +24,12 @@ For example: -```typescript -import { uiComponent } from '@team-plain/typescript-sdk'; - -uiComponent.row({ - mainContent: [uiComponent.text({ text: 'Membership' })], - asideContent: [uiComponent.badge({ label: 'Premium plan', color: 'BLUE' })], -}); -``` + -```json -{ - "componentRow": { - "rowMainContent": [ - { - "componentText": { - "text": "Membership" - } - } - ], - "rowAsideContent": [ - { - "componentBadge": { - "badgeLabel": "Premium plan", - "badgeColor": "BLUE" - } - } - ] - } -} -``` + diff --git a/pages/ui-components/spacer.mdx b/pages/ui-components/spacer.mdx index 2aa3b25..5a08d4f 100644 --- a/pages/ui-components/spacer.mdx +++ b/pages/ui-components/spacer.mdx @@ -12,38 +12,12 @@ For example: -```typescript -import { uiComponent } from '@team-plain/typescript-sdk'; - -[ - uiComponent.text({ text: 'Content before an XS spacer' }), - uiComponent.spacer({ spacingSize: 'XS' }), - uiComponent.text({ text: 'Content after spacer' }), -]; -``` + -```json -[ - { - "componentText": { - "text": "Content before an XS spacer" - } - }, - { - "componentSpacer": { - "spacerSize": "XS" - } - }, - { - "componentText": { - "text": "Content after spacer" - } - } -] -``` + diff --git a/pages/ui-components/text.mdx b/pages/ui-components/text.mdx index 0a122d2..1fb5954 100644 --- a/pages/ui-components/text.mdx +++ b/pages/ui-components/text.mdx @@ -14,92 +14,12 @@ For example: -```typescript -import { uiComponent } from '@team-plain/typescript-sdk'; - -[ - uiComponent.text({ - text: 'The **quick** brown fox _jumps_ over the [lazy link](https://plain.com)', - }), - - uiComponent.text({ text: 'Small text', size: 'S' }), - - uiComponent.text({ text: 'Medium text', size: 'M' }), - - uiComponent.text({ text: 'Large text', size: 'L' }), - - uiComponent.text({ text: 'Normal text', color: 'NORMAL' }), - - uiComponent.text({ text: 'Muted text', color: 'MUTED' }), - - uiComponent.text({ text: 'Success text', color: 'SUCCESS' }), - - uiComponent.text({ text: 'Warning text', color: 'WARNING' }), - - uiComponent.text({ text: 'Error text', color: 'ERROR' }), -]; -``` + -```json -[ - { - "componentText": { - "text": "The **quick** brown fox _jumps_ over the [lazy link](https://plain.com)" - } - }, - { - "componentText": { - "text": "Small text", - "textSize": "S" - } - }, - { - "componentText": { - "text": "Medium text", - "textSize": "M" - } - }, - { - "componentText": { - "text": "Large text", - "textSize": "L" - } - }, - { - "componentText": { - "text": "Normal text", - "textColor": "NORMAL" - } - }, - { - "componentText": { - "text": "Muted text", - "textColor": "MUTED" - } - }, - { - "componentText": { - "text": "Success text", - "textColor": "SUCCESS" - } - }, - { - "componentText": { - "text": "Warning text", - "textColor": "WARNING" - } - }, - { - "componentText": { - "text": "Error text", - "textColor": "ERROR" - } - } -] -``` + diff --git a/pages/webhooks/customer-created.mdx b/pages/webhooks/customer-created.mdx index 78ccc3a..6f1a998 100644 --- a/pages/webhooks/customer-created.mdx +++ b/pages/webhooks/customer-created.mdx @@ -9,48 +9,4 @@ description: 'This event is fired when a new customer is created in your workspa Example: -```json -{ - "timestamp": "2023-10-19T14:12:25.142Z", - "workspaceId": "w_01GST0W989ZNAW53X6XYHAY87P", - "payload": { - "eventType": "customer.customer_created", - "customer": { - "id": "c_01HD44FHDPG82VQ4QNHDR4N2T0", - "email": { - "email": "peter@example.com", - "isVerified": false, - "verifiedAt": null - }, - "externalId": null, - "fullName": "Peter Santos", - "shortName": "Peter", - "assignedAt": null, - "assignedToUser": null, - "status": "IDLE", - "statusChangedAt": "2023-10-04T14:17:41.991Z", - "markedAsSpamAt": null, - "markedAsSpamBy": null, - "customerGroupMemberships": [], - "createdAt": "2023-10-04T14:17:41.991Z", - "createdBy": { - "actorType": "system", - "system": "email_inbound_handler" - }, - "updatedAt": "2023-10-04T14:17:41.991Z", - "updatedBy": { - "actorType": "system", - "system": "email_inbound_handler" - } - } - }, - "id": "pEv_01HD44FHDPMZ3YJB5GEB1EZKQV", - "webhookMetadata": { - "webhookTargetId": "whTarget_01HD4400VTDJQ646V6RY37SR7K", - "webhookDeliveryAttemptId": "whAttempt_01HD44FJ45FJKVFHM3MDVYPGRS", - "webhookDeliveryAttemptNumber": 1, - "webhookDeliveryAttemptTimestamp": "2023-10-19T14:12:25.861Z" - }, - "type": "customer.customer_created" -} -``` + diff --git a/pages/webhooks/customer-deleted.mdx b/pages/webhooks/customer-deleted.mdx index 95c7dfa..1713653 100644 --- a/pages/webhooks/customer-deleted.mdx +++ b/pages/webhooks/customer-deleted.mdx @@ -9,48 +9,4 @@ description: 'This event is fired when a customer is deleted from your workspace Example: -```json -{ - "timestamp": "2023-10-19T14:05:22.312Z", - "workspaceId": "w_01GST0W989ZNAW53X6XYHAY87P", - "payload": { - "eventType": "customer.customer_deleted", - "previousCustomer": { - "id": "c_01HBXGTDV76AW7F14QV7EGWDJB", - "email": { - "email": "peter@example.com", - "isVerified": false, - "verifiedAt": null - }, - "externalId": null, - "fullName": "Peter Santos", - "shortName": "Peter", - "assignedAt": null, - "assignedToUser": null, - "status": "IDLE", - "statusChangedAt": "2023-10-04T14:17:41.991Z", - "markedAsSpamAt": null, - "markedAsSpamBy": null, - "customerGroupMemberships": [], - "createdAt": "2023-10-04T14:17:41.991Z", - "createdBy": { - "actorType": "system", - "system": "email_inbound_handler" - }, - "updatedAt": "2023-10-04T14:17:41.991Z", - "updatedBy": { - "actorType": "system", - "system": "email_inbound_handler" - } - } - }, - "id": "pEv_01HD442MG86ATWJ2MDEYCV6VPV", - "webhookMetadata": { - "webhookTargetId": "whTarget_01HD4400VTDJQ646V6RY37SR7K", - "webhookDeliveryAttemptId": "whAttempt_01HD444M37N1HYFVJ92DA05BQK", - "webhookDeliveryAttemptNumber": 1, - "webhookDeliveryAttemptTimestamp": "2023-10-19T14:06:27.431Z" - }, - "type": "customer.customer_deleted" -} -``` + diff --git a/pages/webhooks/customer-group-membership-changed.mdx b/pages/webhooks/customer-group-membership-changed.mdx index a1bd6ad..660aceb 100644 --- a/pages/webhooks/customer-group-membership-changed.mdx +++ b/pages/webhooks/customer-group-membership-changed.mdx @@ -14,110 +14,4 @@ The [`changeType`](https://json-schema.app/view/%23%2Fdefinitions%2FcustomerGrou Example: -```json -{ - "timestamp": "2023-10-19T16:58:32.357Z", - "workspaceId": "w_01GST0W989ZNAW53X6XYHAY87P", - "payload": { - "eventType": "customer.customer_group_memberships_changed", - "changeType": "ADDED", - "customer": { - "id": "c_01HD44FHDPG82VQ4QNHDR4N2T0", - "email": { - "email": "peter@example.com", - "isVerified": false, - "verifiedAt": null - }, - "externalId": null, - "fullName": "Peter Santos", - "shortName": "Peter", - "assignedAt": null, - "assignedToUser": null, - "status": "ACTIVE", - "statusChangedAt": "2023-10-19T14:12:25.267Z", - "markedAsSpamAt": null, - "markedAsSpamBy": null, - "customerGroupMemberships": [ - { - "customerId": "c_01HD44FHDPG82VQ4QNHDR4N2T0", - "customerGroupId": "cg_01GWVPYG1B8JBPGZC2VQDQEQAM", - "workspaceId": "w_01GST0W989ZNAW53X6XYHAY87P", - "createdAt": "2023-10-19T16:58:32.340Z", - "createdBy": { - "actorType": "user", - "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" - }, - "updatedAt": "2023-10-19T16:58:32.340Z", - "updatedBy": { - "actorType": "user", - "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" - }, - "customerGroup": { - "id": "cg_01GWVPYG1B8JBPGZC2VQDQEQAM", - "workspaceId": "w_01GST0W989ZNAW53X6XYHAY87P", - "name": "Free Tier", - "key": "free-tier", - "color": "#D66258", - "createdAt": "2023-03-31T11:30:50.539Z", - "createdBy": { - "actorType": "user", - "userId": "u_01GTVBT93M80K917N2FGAK3FD5" - }, - "updatedAt": "2023-05-31T07:27:21.519Z", - "updatedBy": { - "actorType": "user", - "userId": "u_01FN4BEVKY3EQQ5BFC24M8JTJH" - } - } - } - ], - "createdAt": "2023-10-19T14:12:25.142Z", - "createdBy": { - "actorType": "system", - "system": "email_inbound_handler" - }, - "updatedAt": "2023-10-19T16:57:13.845Z", - "updatedBy": { - "actorType": "user", - "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" - } - }, - "previousCustomer": { - "id": "c_01HD44FHDPG82VQ4QNHDR4N2T0", - "email": { - "email": "peter@example.com", - "isVerified": false, - "verifiedAt": null - }, - "externalId": null, - "fullName": "Peter Santos", - "shortName": "Peter", - "assignedAt": null, - "assignedToUser": null, - "status": "ACTIVE", - "statusChangedAt": "2023-10-19T14:12:25.267Z", - "markedAsSpamAt": null, - "markedAsSpamBy": null, - "customerGroupMemberships": [], - "createdAt": "2023-10-19T14:12:25.142Z", - "createdBy": { - "actorType": "system", - "system": "email_inbound_handler" - }, - "updatedAt": "2023-10-19T16:57:13.845Z", - "updatedBy": { - "actorType": "user", - "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" - } - } - }, - "id": "pEv_01HD4DZQ153AE8FK17TFJ7PC01", - "webhookMetadata": { - "webhookTargetId": "whTarget_01HD4400VTDJQ646V6RY37SR7K", - "webhookDeliveryAttemptId": "whAttempt_01HD4DZQD334K6KX0ER03JWDAR", - "webhookDeliveryAttemptNumber": 1, - "webhookDeliveryAttemptTimestamp": "2023-10-19T16:58:32.739Z" - }, - "type": "customer.customer_group_memberships_changed" -} -``` + diff --git a/pages/webhooks/customer-updated.mdx b/pages/webhooks/customer-updated.mdx index d80aeee..e5196a3 100644 --- a/pages/webhooks/customer-updated.mdx +++ b/pages/webhooks/customer-updated.mdx @@ -13,79 +13,4 @@ description: 'This event is fired when a customer is updated in your workspace. Example: -```json -{ - "timestamp": "2023-10-19T14:21:43.616Z", - "workspaceId": "w_01GST0W989ZNAW53X6XYHAY87P", - "payload": { - "eventType": "customer.customer_updated", - "customer": { - "id": "c_01HD44FHDPG82VQ4QNHDR4N2T0", - "email": { - "email": "peter@example.com", - "isVerified": false, - "verifiedAt": null - }, - "externalId": null, - "fullName": "Peter Santos", - "shortName": "Peter", - "assignedAt": null, - "assignedToUser": null, - "status": "ACTIVE", - "statusChangedAt": "2023-10-19T14:12:25.267Z", - "markedAsSpamAt": "2023-10-19T14:21:43.616Z", - "markedAsSpamBy": { - "actorType": "user", - "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" - }, - "customerGroupMemberships": [], - "createdAt": "2023-10-19T14:12:25.142Z", - "createdBy": { - "actorType": "system", - "system": "email_inbound_handler" - }, - "updatedAt": "2023-10-19T14:21:43.616Z", - "updatedBy": { - "actorType": "user", - "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" - } - }, - "previousCustomer": { - "id": "c_01HD44FHDPG82VQ4QNHDR4N2T0", - "email": { - "email": "peter@example.com", - "isVerified": false, - "verifiedAt": null - }, - "externalId": null, - "fullName": "Peter Santos", - "shortName": "Peter", - "assignedAt": null, - "assignedToUser": null, - "status": "IDLE", - "statusChangedAt": "2023-10-04T14:17:41.991Z", - "markedAsSpamAt": null, - "markedAsSpamBy": null, - "customerGroupMemberships": [], - "createdAt": "2023-10-04T14:17:41.991Z", - "createdBy": { - "actorType": "system", - "system": "email_inbound_handler" - }, - "updatedAt": "2023-10-04T14:17:41.991Z", - "updatedBy": { - "actorType": "system", - "system": "email_inbound_handler" - } - } - }, - "id": "pEv_01HD450JT0RPBT7RRKS1ZQJYBA", - "webhookMetadata": { - "webhookTargetId": "whTarget_01HD4400VTDJQ646V6RY37SR7K", - "webhookDeliveryAttemptId": "whAttempt_01HD450N6X782MDTDBMS6Z14DJ", - "webhookDeliveryAttemptNumber": 1, - "webhookDeliveryAttemptTimestamp": "2023-10-19T14:21:46.077Z" - }, - "type": "customer.customer_updated" -} -``` + diff --git a/pages/webhooks/email-received.mdx b/pages/webhooks/email-received.mdx index a4570d3..d722a42 100644 --- a/pages/webhooks/email-received.mdx +++ b/pages/webhooks/email-received.mdx @@ -16,123 +16,4 @@ description: 'This event is fired when an email is received in your workspace.' Example: -```json -{ - "timestamp": "2023-10-19T14:12:25.733Z", - "workspaceId": "w_01FXQ6A83FXNN9XA00415VR1XP", - "payload": { - "eventType": "thread.email_received", - "thread": { - "id": "th_01HD44FHMCDSSWE38N14FSYV6K", - "customer": { - "id": "c_01HD44FHDPG82VQ4QNHDR4N2T0", - "email": { - "email": "peter@example.com", - "isVerified": false, - "verifiedAt": null - }, - "externalId": null, - "fullName": "Peter Santos", - "shortName": "Peter", - "assignedAt": null, - "assignedToUser": null, - "status": "IDLE", - "statusChangedAt": "2023-10-19T14:12:25.142Z", - "markedAsSpamAt": null, - "markedAsSpamBy": null, - "customerGroupMemberships": [], - "createdAt": "2023-10-19T14:12:25.142Z", - "createdBy": { - "actorType": "system", - "system": "email_inbound_handler" - }, - "updatedAt": "2023-10-19T14:12:25.142Z", - "updatedBy": { - "actorType": "system", - "system": "email_inbound_handler" - } - }, - "title": "Unable to tail logs", - "previewText": "Hey, I am currently unable to tail the logs of the service svc-8af1e3", - "priority": 2, - "externalId": null, - "status": "TODO", - "statusChangedAt": "2023-10-19T14:12:25.266Z", - "statusChangedBy": { - "actorType": "system", - "system": "email_inbound_handler" - }, - "statusDetail": { - "type": "CREATED", - "createdAt": "2023-10-19T14:12:25.266Z" - }, - "assignee": null, - "assignedAt": null, - "labels": [], - "firstInboundMessageInfo": null, - "firstOutboundMessageInfo": null, - "lastInboundMessageInfo": null, - "lastOutboundMessageInfo": null, - "supportEmailAddresses": [], - "createdAt": "2023-10-19T14:12:25.266Z", - "createdBy": { - "actorType": "system", - "system": "email_inbound_handler" - }, - "updatedAt": "2023-10-19T14:12:25.266Z", - "updatedBy": { - "actorType": "system", - "system": "email_inbound_handler" - } - }, - "email": { - "timelineEntryId": "t_01HD44FHHJ4DJC452ZTAR73PPF", - "id": "em_01HD44FF33QTSGW5JN37BFY6YE", - "to": { - "email": "help@example.com", - "name": null, - "emailActor": { - "actorType": "supportEmailAddress", - "supportEmailAddress": "help@example.com" - } - }, - "from": { - "email": "peter@example.com", - "name": "Peter Santos", - "emailActor": { - "actorType": "customer", - "customerId": "c_01HD44FHDPG82VQ4QNHDR4N2T0" - } - }, - "additionalRecipients": [], - "hiddenRecipients": [], - "subject": "Unable to tail logs", - "textContent": "Hey, I am currently unable to tail the logs of the service svc-8af1e3", - "markdownContent": "Hey, I am currently unable to tail the logs of the service svc-8af1e3", - "authenticity": "PASS", - "sentAt": null, - "receivedAt": "2023-10-19T14:12:22.757Z", - "attachments": [], - "inReplyToEmailId": null, - "createdAt": "2023-10-19T14:12:25.733Z", - "createdBy": { - "actorType": "customer", - "customerId": "c_01HD44FHDPG82VQ4QNHDR4N2T0" - }, - "updatedAt": "2023-10-19T14:12:25.733Z", - "updatedBy": { - "actorType": "customer", - "customerId": "c_01HD44FHDPG82VQ4QNHDR4N2T0" - } - } - }, - "id": "pEv_01HD44FJ053ZHW13SWS9556THX", - "webhookMetadata": { - "webhookTargetId": "whTarget_01HD4400VTDJQ646V6RY37SR7K", - "webhookDeliveryAttemptId": "whAttempt_01HD44SZM21CPW0MXEQ73C2X7C", - "webhookDeliveryAttemptNumber": 1, - "webhookDeliveryAttemptTimestamp": "2023-10-19T14:18:07.362Z" - }, - "type": "thread.email_received" -} -``` + diff --git a/pages/webhooks/email-sent.mdx b/pages/webhooks/email-sent.mdx index 1a2218d..55a905e 100644 --- a/pages/webhooks/email-sent.mdx +++ b/pages/webhooks/email-sent.mdx @@ -1,6 +1,6 @@ --- -title: 'Email received' -description: 'This event is fired when an email is received in your workspace.' +title: 'Email sent' +description: 'This event is fired when an email is sent in your workspace.' --- @@ -16,126 +16,4 @@ description: 'This event is fired when an email is received in your workspace.' Example: -```json -{ - "timestamp": "2023-10-19T21:44:01.325Z", - "workspaceId": "w_01FXQ6A83FXNN9XA00415VR1XP", - "payload": { - "eventType": "thread.email_sent", - "thread": { - "id": "th_01HD44FHMCDSSWE38N14FSYV6K", - "customer": { - "id": "c_01HD44FHDPG82VQ4QNHDR4N2T0", - "email": { - "email": "peter@example.com", - "isVerified": false, - "verifiedAt": null - }, - "externalId": null, - "fullName": "Peter Santos", - "shortName": "Peter", - "assignedAt": null, - "assignedToUser": null, - "status": "IDLE", - "statusChangedAt": "2023-10-19T21:24:36.109Z", - "markedAsSpamAt": null, - "markedAsSpamBy": null, - "customerGroupMemberships": [], - "createdAt": "2023-10-19T14:12:25.142Z", - "createdBy": { - "actorType": "system", - "system": "email_inbound_handler" - }, - "updatedAt": "2023-10-19T21:26:06.658Z", - "updatedBy": { - "actorType": "user", - "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" - } - }, - "title": "Unable to tail logs", - "previewText": "Hey, I am currently unable to tail the logs of the service svc-8af1e3", - "priority": 1, - "externalId": null, - "status": "DONE", - "statusChangedAt": "2023-10-19T21:24:36.108Z", - "statusChangedBy": { - "actorType": "user", - "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" - }, - "statusDetail": null, - "assignee": null, - "assignedAt": null, - "labels": [], - "firstInboundMessageInfo": { - "timestamp": "2023-10-19T14:12:25.733Z", - "messageSource": "EMAIL" - }, - "firstOutboundMessageInfo": null, - "lastInboundMessageInfo": { - "timestamp": "2023-10-19T14:12:25.733Z", - "messageSource": "EMAIL" - }, - "lastOutboundMessageInfo": null, - "supportEmailAddresses": ["help@example.com"], - "createdAt": "2023-10-19T14:12:25.266Z", - "createdBy": { - "actorType": "system", - "system": "email_inbound_handler" - }, - "updatedAt": "2023-10-19T21:38:54.335Z", - "updatedBy": { - "actorType": "user", - "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" - } - }, - "email": { - "timelineEntryId": "t_01HD4YABRC74XY3D4SKAWKHXMH", - "id": "em_01HD4YABKW46E4Y8384T6ARDA5", - "to": { - "email": "peter@example.com", - "name": "Peter Santos", - "emailActor": { - "actorType": "customer", - "customerId": "c_01HD44FHDPG82VQ4QNHDR4N2T0" - } - }, - "from": { - "email": "help@example.com", - "name": "Sam at Resolve", - "emailActor": { - "actorType": "supportEmailAddress", - "supportEmailAddress": "help@example.com" - } - }, - "additionalRecipients": [], - "hiddenRecipients": [], - "subject": "Re: Test", - "textContent": "Hey", - "markdownContent": "Hey", - "authenticity": "PASS", - "sentAt": "2023-10-19T21:44:00.865Z", - "receivedAt": null, - "attachments": [], - "inReplyToEmailId": "em_01HD44FF33QTSGW5JN37BFY6YE", - "createdAt": "2023-10-19T21:43:58.967Z", - "createdBy": { - "actorType": "user", - "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" - }, - "updatedAt": "2023-10-19T21:44:01.201Z", - "updatedBy": { - "actorType": "system", - "system": "email_sender" - } - } - }, - "id": "pEv_01HD4YAEHDHS2FW3F3VRSEGGVF", - "webhookMetadata": { - "webhookTargetId": "whTarget_01HD4400VTDJQ646V6RY37SR7K", - "webhookDeliveryAttemptId": "whAttempt_01HD4YAFB6VN6AJ4TGVY4DJ0VR", - "webhookDeliveryAttemptNumber": 1, - "webhookDeliveryAttemptTimestamp": "2023-10-19T21:44:02.150Z" - }, - "type": "thread.email_sent" -} -``` + diff --git a/pages/webhooks/thread-assignment-transitioned.mdx b/pages/webhooks/thread-assignment-transitioned.mdx index 45f3ea8..7ec4035 100644 --- a/pages/webhooks/thread-assignment-transitioned.mdx +++ b/pages/webhooks/thread-assignment-transitioned.mdx @@ -9,171 +9,4 @@ description: 'This event is fired when the assignee of a thread changes or a thr Example: -```json -{ - "timestamp": "2023-10-19T21:24:51.660Z", - "workspaceId": "w_01GST0W989ZNAW53X6XYHAY87P", - "payload": { - "eventType": "thread.thread_assignment_transitioned", - "previousThread": { - "id": "th_01HD44FHMCDSSWE38N14FSYV6K", - "customer": { - "id": "c_01HD44FHDPG82VQ4QNHDR4N2T0", - "email": { - "email": "peter@example.com", - "isVerified": false, - "verifiedAt": null - }, - "externalId": null, - "fullName": "Peter Santos", - "shortName": "Peter", - "assignedAt": null, - "assignedToUser": null, - "status": "IDLE", - "statusChangedAt": "2023-10-19T21:24:36.109Z", - "markedAsSpamAt": null, - "markedAsSpamBy": null, - "customerGroupMemberships": [], - "createdAt": "2023-10-19T14:12:25.142Z", - "createdBy": { - "actorType": "system", - "system": "email_inbound_handler" - }, - "updatedAt": "2023-10-19T21:24:51.734Z", - "updatedBy": { - "actorType": "user", - "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" - } - }, - "title": "Unable to tail logs", - "previewText": "Hey, I am currently unable to tail the logs of the service svc-8af1e3", - "priority": 1, - "externalId": null, - "status": "DONE", - "statusChangedAt": "2023-10-19T21:24:36.108Z", - "statusChangedBy": { - "actorType": "user", - "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" - }, - "statusDetail": null, - "assignee": null, - "assignedAt": null, - "labels": [], - "firstInboundMessageInfo": { - "timestamp": "2023-10-19T14:12:25.733Z", - "messageSource": "EMAIL" - }, - "firstOutboundMessageInfo": null, - "lastInboundMessageInfo": { - "timestamp": "2023-10-19T14:12:25.733Z", - "messageSource": "EMAIL" - }, - "lastOutboundMessageInfo": null, - "supportEmailAddresses": ["help@example.com"], - "createdAt": "2023-10-19T14:12:25.266Z", - "createdBy": { - "actorType": "system", - "system": "email_inbound_handler" - }, - "updatedAt": "2023-10-19T21:24:36.108Z", - "updatedBy": { - "actorType": "user", - "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" - } - }, - "thread": { - "id": "th_01HD44FHMCDSSWE38N14FSYV6K", - "customer": { - "id": "c_01HD44FHDPG82VQ4QNHDR4N2T0", - "email": { - "email": "peter@example.com", - "isVerified": false, - "verifiedAt": null - }, - "externalId": null, - "fullName": "Peter Santos", - "shortName": "Peter", - "assignedAt": null, - "assignedToUser": null, - "status": "IDLE", - "statusChangedAt": "2023-10-19T21:24:36.109Z", - "markedAsSpamAt": null, - "markedAsSpamBy": null, - "customerGroupMemberships": [], - "createdAt": "2023-10-19T14:12:25.142Z", - "createdBy": { - "actorType": "system", - "system": "email_inbound_handler" - }, - "updatedAt": "2023-10-19T21:24:51.734Z", - "updatedBy": { - "actorType": "user", - "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" - } - }, - "title": "Unable to tail logs", - "previewText": "Hey, I am currently unable to tail the logs of the service svc-8af1e3", - "priority": 1, - "externalId": null, - "status": "DONE", - "statusChangedAt": "2023-10-19T21:24:36.108Z", - "statusChangedBy": { - "actorType": "user", - "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" - }, - "statusDetail": null, - "assignee": { - "id": "u_01H1V4NA10RMHWFBXB6A1ZBYRA", - "email": "sam@example.com", - "fullName": "Sam", - "publicName": "Sam", - "status": "OFFLINE", - "statusChangedAt": "2023-06-01T09:29:48.903Z", - "createdAt": "2023-06-01T09:29:48.903Z", - "createdBy": { - "actorType": "user", - "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" - }, - "updatedAt": "2023-06-01T09:29:48.903Z", - "updatedBy": { - "actorType": "user", - "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" - }, - "deletedAt": null, - "deletedBy": null - }, - "assignedAt": "2023-10-19T21:24:51.660Z", - "labels": [], - "firstInboundMessageInfo": { - "timestamp": "2023-10-19T14:12:25.733Z", - "messageSource": "EMAIL" - }, - "firstOutboundMessageInfo": null, - "lastInboundMessageInfo": { - "timestamp": "2023-10-19T14:12:25.733Z", - "messageSource": "EMAIL" - }, - "lastOutboundMessageInfo": null, - "supportEmailAddresses": ["help@example.com"], - "createdAt": "2023-10-19T14:12:25.266Z", - "createdBy": { - "actorType": "system", - "system": "email_inbound_handler" - }, - "updatedAt": "2023-10-19T21:24:51.660Z", - "updatedBy": { - "actorType": "user", - "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" - } - } - }, - "id": "pEv_01HD4X7BTCJSP3NGTBKYSWGPSY", - "webhookMetadata": { - "webhookTargetId": "whTarget_01HD4400VTDJQ646V6RY37SR7K", - "webhookDeliveryAttemptId": "whAttempt_01HD4XHSAX79QW8E34V86CKJRK", - "webhookDeliveryAttemptNumber": 4, - "webhookDeliveryAttemptTimestamp": "2023-10-19T21:30:33.181Z" - }, - "type": "thread.thread_assignment_transitioned" -} -``` + diff --git a/pages/webhooks/thread-created.mdx b/pages/webhooks/thread-created.mdx index 654b88d..6018e4c 100644 --- a/pages/webhooks/thread-created.mdx +++ b/pages/webhooks/thread-created.mdx @@ -20,83 +20,4 @@ You can subscribe to this event **if you want to build an auto-responder**. To d Example: -```json -{ - "timestamp": "2023-10-19T14:12:25.266Z", - "workspaceId": "w_01GST0W989ZNAW53X6XYHAY87P", - "payload": { - "eventType": "thread.thread_created", - "thread": { - "id": "th_01HD44FHMCDSSWE38N14FSYV6K", - "customer": { - "id": "c_01HD44FHDPG82VQ4QNHDR4N2T0", - "email": { - "email": "peter@example.com", - "isVerified": false, - "verifiedAt": null - }, - "externalId": null, - "fullName": "Peter Santos", - "shortName": "Peter", - "assignedAt": null, - "assignedToUser": null, - "status": "IDLE", - "statusChangedAt": "2023-10-04T14:17:41.991Z", - "markedAsSpamAt": null, - "markedAsSpamBy": null, - "customerGroupMemberships": [], - "createdAt": "2023-10-04T14:17:41.991Z", - "createdBy": { - "actorType": "system", - "system": "email_inbound_handler" - }, - "updatedAt": "2023-10-04T14:17:41.991Z", - "updatedBy": { - "actorType": "system", - "system": "email_inbound_handler" - } - }, - "title": "Unable to tail logs", - "previewText": "Hey, I am currently unable to tail the logs of the service svc-8af1e3", - "priority": 2, - "externalId": null, - "status": "TODO", - "statusChangedAt": "2023-10-19T14:12:25.266Z", - "statusChangedBy": { - "actorType": "system", - "system": "email_inbound_handler" - }, - "statusDetail": { - "type": "CREATED", - "createdAt": "2023-10-19T14:12:25.266Z" - }, - "assignee": null, - "assignedAt": null, - "labels": [], - "firstInboundMessageInfo": null, - "firstOutboundMessageInfo": null, - "lastInboundMessageInfo": null, - "lastOutboundMessageInfo": null, - "supportEmailAddresses": [], - "createdAt": "2023-10-19T14:12:25.266Z", - "createdBy": { - "actorType": "system", - "system": "email_inbound_handler" - }, - "updatedAt": "2023-10-19T14:12:25.266Z", - "updatedBy": { - "actorType": "system", - "system": "email_inbound_handler" - } - } - }, - "id": "pEv_01HD44FHHJ0YABSNGKWMG3CJ5J", - "webhookMetadata": { - "webhookTargetId": "whTarget_01HD4400VTDJQ646V6RY37SR7K", - "webhookDeliveryAttemptId": "whAttempt_01HD44FJASQM23MNHYDYPAXEG8", - "webhookDeliveryAttemptNumber": 1, - "webhookDeliveryAttemptTimestamp": "2023-10-19T14:12:26.073Z" - }, - "type": "thread.thread_created" -} -``` + diff --git a/pages/webhooks/thread-labels-changed.mdx b/pages/webhooks/thread-labels-changed.mdx index a45a422..7f20448 100644 --- a/pages/webhooks/thread-labels-changed.mdx +++ b/pages/webhooks/thread-labels-changed.mdx @@ -9,185 +9,4 @@ description: 'This event is fired when labels are added to or removed from a thr Example: -```json -{ - "timestamp": "2023-10-19T21:38:54.335Z", - "workspaceId": "w_01FXQ6A83FXNN9XA00415VR1XP", - "payload": { - "eventType": "thread.thread_labels_changed", - "changeType": "ADDED", - "thread": { - "id": "th_01HD44FHMCDSSWE38N14FSYV6K", - "customer": { - "id": "c_01HD44FHDPG82VQ4QNHDR4N2T0", - "email": { - "email": "peter@example.com", - "isVerified": false, - "verifiedAt": null - }, - "externalId": null, - "fullName": "Peter Santos", - "shortName": "Peter", - "assignedAt": null, - "assignedToUser": null, - "status": "IDLE", - "statusChangedAt": "2023-10-19T21:24:36.109Z", - "markedAsSpamAt": null, - "markedAsSpamBy": null, - "customerGroupMemberships": [], - "createdAt": "2023-10-19T14:12:25.142Z", - "createdBy": { - "actorType": "system", - "system": "email_inbound_handler" - }, - "updatedAt": "2023-10-19T21:26:06.658Z", - "updatedBy": { - "actorType": "user", - "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" - } - }, - "title": "Unable to tail logs", - "previewText": "Hey, I am currently unable to tail the logs of the service svc-8af1e3", - "priority": 1, - "externalId": null, - "status": "DONE", - "statusChangedAt": "2023-10-19T21:24:36.108Z", - "statusChangedBy": { - "actorType": "user", - "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" - }, - "statusDetail": null, - "assignee": null, - "assignedAt": null, - "labels": [ - { - "id": "l_01HD4Y12Q6JJC2BQJRQJVWM5YB", - "labelType": { - "id": "lt_01HB81HYXZ2B8QGYCH5YG1AGM8", - "name": "Account setup", - "icon": "bug", - "isArchived": false, - "archivedAt": null, - "archivedBy": null, - "createdAt": "2023-09-26T06:06:52.863Z", - "createdBy": { - "actorType": "system", - "system": "job" - }, - "updatedAt": "2023-10-02T13:40:17.049Z", - "updatedBy": { - "actorType": "user", - "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" - } - }, - "createdAt": "2023-10-19T21:38:54.310Z", - "createdBy": { - "actorType": "user", - "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" - }, - "updatedAt": "2023-10-19T21:38:54.310Z", - "updatedBy": { - "actorType": "user", - "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" - } - } - ], - "firstInboundMessageInfo": { - "timestamp": "2023-10-19T14:12:25.733Z", - "messageSource": "EMAIL" - }, - "firstOutboundMessageInfo": null, - "lastInboundMessageInfo": { - "timestamp": "2023-10-19T14:12:25.733Z", - "messageSource": "EMAIL" - }, - "lastOutboundMessageInfo": null, - "supportEmailAddresses": ["help@example.com"], - "createdAt": "2023-10-19T14:12:25.266Z", - "createdBy": { - "actorType": "system", - "system": "email_inbound_handler" - }, - "updatedAt": "2023-10-19T21:38:54.335Z", - "updatedBy": { - "actorType": "user", - "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" - } - }, - "previousThread": { - "id": "th_01HD44FHMCDSSWE38N14FSYV6K", - "customer": { - "id": "c_01HD44FHDPG82VQ4QNHDR4N2T0", - "email": { - "email": "peter@example.com", - "isVerified": false, - "verifiedAt": null - }, - "externalId": null, - "fullName": "Peter Santos", - "shortName": "Peter", - "assignedAt": null, - "assignedToUser": null, - "status": "IDLE", - "statusChangedAt": "2023-10-19T21:24:36.109Z", - "markedAsSpamAt": null, - "markedAsSpamBy": null, - "customerGroupMemberships": [], - "createdAt": "2023-10-19T14:12:25.142Z", - "createdBy": { - "actorType": "system", - "system": "email_inbound_handler" - }, - "updatedAt": "2023-10-19T21:26:06.658Z", - "updatedBy": { - "actorType": "user", - "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" - } - }, - "title": "Unable to tail logs", - "previewText": "Hey, I am currently unable to tail the logs of the service svc-8af1e3", - "priority": 1, - "externalId": null, - "status": "DONE", - "statusChangedAt": "2023-10-19T21:24:36.108Z", - "statusChangedBy": { - "actorType": "user", - "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" - }, - "statusDetail": null, - "assignee": null, - "assignedAt": null, - "labels": [], - "firstInboundMessageInfo": { - "timestamp": "2023-10-19T14:12:25.733Z", - "messageSource": "EMAIL" - }, - "firstOutboundMessageInfo": null, - "lastInboundMessageInfo": { - "timestamp": "2023-10-19T14:12:25.733Z", - "messageSource": "EMAIL" - }, - "lastOutboundMessageInfo": null, - "supportEmailAddresses": ["help@example.com"], - "createdAt": "2023-10-19T14:12:25.266Z", - "createdBy": { - "actorType": "system", - "system": "email_inbound_handler" - }, - "updatedAt": "2023-10-19T21:24:51.660Z", - "updatedBy": { - "actorType": "user", - "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" - } - } - }, - "id": "pEv_01HD4Y12QZ1X7FQN2648JCVMN4", - "webhookMetadata": { - "webhookTargetId": "whTarget_01HD4400VTDJQ646V6RY37SR7K", - "webhookDeliveryAttemptId": "whAttempt_01HD4Y15J3HJ2BFDGXTGWSC2XC", - "webhookDeliveryAttemptNumber": 1, - "webhookDeliveryAttemptTimestamp": "2023-10-19T21:38:57.219Z" - }, - "type": "thread.thread_labels_changed" -} -``` + diff --git a/pages/webhooks/thread-status-transitioned.mdx b/pages/webhooks/thread-status-transitioned.mdx index f1cc945..eb6c64e 100644 --- a/pages/webhooks/thread-status-transitioned.mdx +++ b/pages/webhooks/thread-status-transitioned.mdx @@ -9,152 +9,4 @@ description: 'This event is fired when the status of a thread changes.' Example: -```json -{ - "timestamp": "2023-10-19T21:24:36.108Z", - "workspaceId": "w_01GST0W989ZNAW53X6XYHAY87P", - "payload": { - "eventType": "thread.thread_status_transitioned", - "previousThread": { - "id": "th_01HD44FHMCDSSWE38N14FSYV6K", - "customer": { - "id": "c_01HD44FHDPG82VQ4QNHDR4N2T0", - "email": { - "email": "peter@example.com", - "isVerified": false, - "verifiedAt": null - }, - "externalId": null, - "fullName": "Peter Santos", - "shortName": "Peter", - "assignedAt": null, - "assignedToUser": null, - "status": "ACTIVE", - "statusChangedAt": "2023-10-19T21:18:12.863Z", - "markedAsSpamAt": null, - "markedAsSpamBy": null, - "customerGroupMemberships": [], - "createdAt": "2023-10-19T14:12:25.142Z", - "createdBy": { - "actorType": "system", - "system": "email_inbound_handler" - }, - "updatedAt": "2023-10-19T21:18:12.863Z", - "updatedBy": { - "actorType": "user", - "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" - } - }, - "title": "Unable to tail logs", - "previewText": "Hey, I am currently unable to tail the logs of the service svc-8af1e3", - "priority": 1, - "externalId": null, - "status": "TODO", - "statusChangedAt": "2023-10-19T21:18:12.862Z", - "statusChangedBy": { - "actorType": "user", - "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" - }, - "statusDetail": null, - "assignee": null, - "assignedAt": null, - "labels": [], - "firstInboundMessageInfo": { - "timestamp": "2023-10-19T14:12:25.733Z", - "messageSource": "EMAIL" - }, - "firstOutboundMessageInfo": null, - "lastInboundMessageInfo": { - "timestamp": "2023-10-19T14:12:25.733Z", - "messageSource": "EMAIL" - }, - "lastOutboundMessageInfo": null, - "supportEmailAddresses": ["help@example.com"], - "createdAt": "2023-10-19T14:12:25.266Z", - "createdBy": { - "actorType": "system", - "system": "email_inbound_handler" - }, - "updatedAt": "2023-10-19T21:20:07.612Z", - "updatedBy": { - "actorType": "user", - "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" - } - }, - "thread": { - "id": "th_01HD44FHMCDSSWE38N14FSYV6K", - "customer": { - "id": "c_01HD44FHDPG82VQ4QNHDR4N2T0", - "email": { - "email": "peter@example.com", - "isVerified": false, - "verifiedAt": null - }, - "externalId": null, - "fullName": "Peter Santos", - "shortName": "Peter", - "assignedAt": null, - "assignedToUser": null, - "status": "ACTIVE", - "statusChangedAt": "2023-10-19T21:18:12.863Z", - "markedAsSpamAt": null, - "markedAsSpamBy": null, - "customerGroupMemberships": [], - "createdAt": "2023-10-19T14:12:25.142Z", - "createdBy": { - "actorType": "system", - "system": "email_inbound_handler" - }, - "updatedAt": "2023-10-19T21:18:12.863Z", - "updatedBy": { - "actorType": "user", - "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" - } - }, - "title": "Unable to tail logs", - "previewText": "Hey, I am currently unable to tail the logs of the service svc-8af1e3", - "priority": 1, - "externalId": null, - "status": "DONE", - "statusChangedAt": "2023-10-19T21:24:36.108Z", - "statusChangedBy": { - "actorType": "user", - "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" - }, - "statusDetail": null, - "assignee": null, - "assignedAt": null, - "labels": [], - "firstInboundMessageInfo": { - "timestamp": "2023-10-19T14:12:25.733Z", - "messageSource": "EMAIL" - }, - "firstOutboundMessageInfo": null, - "lastInboundMessageInfo": { - "timestamp": "2023-10-19T14:12:25.733Z", - "messageSource": "EMAIL" - }, - "lastOutboundMessageInfo": null, - "supportEmailAddresses": ["help@example.com"], - "createdAt": "2023-10-19T14:12:25.266Z", - "createdBy": { - "actorType": "system", - "system": "email_inbound_handler" - }, - "updatedAt": "2023-10-19T21:24:36.108Z", - "updatedBy": { - "actorType": "user", - "userId": "u_01H1V4NA10RMHWFBXB6A1ZBYRA" - } - } - }, - "id": "pEv_01HD4X6WMCJSD8EHWDRHZ8WYDT", - "webhookMetadata": { - "webhookTargetId": "whTarget_01HD4400VTDJQ646V6RY37SR7K", - "webhookDeliveryAttemptId": "whAttempt_01HD4XH9YE8CK6KT3G8VRX38R7", - "webhookDeliveryAttemptNumber": 1, - "webhookDeliveryAttemptTimestamp": "2023-10-19T21:30:17.422Z" - }, - "type": "thread.thread_status_transitioned" -} -``` +