Tickets

Tickets are a way to communicate with visitors and customers alike. They help answer questions from potential customers, and streamline post-purchase conversations with existing customers.

On this page, we'll dive into the different ticket endpoints you can use to manage tickets programmatically. We'll look at how to query and reply to tickets.

The ticket model

The ticket model contains all the information about your store's tickets, including the ticket's title, status, and customer details.

Properties

  • Name
    id
    Type
    integer
    Description

    The unique identifier for the ticket.

  • Name
    title
    Type
    string
    Description

    The title of the ticket.

  • Name
    status
    Type
    string
    Description

    The ticket status. One of two statuses:

    • OPEN
    • CLOSED
  • Name
    customer
    Type
    array
    Description

    Array of customer details consisting of two types of information:

    • id: Unique customer identifier
    • email: Email associated to the customer's ticket.
  • Name
    reference
    Type
    array
    Description

    Array of order details if ticket is associated with an order. Consists of two types of information:

    • id: Order ID
    • type: Order model
  • Name
    created_at
    Type
    timestamp
    Description

    The time at which this ticket was first created.

  • Name
    updated_at
    Type
    timestamp
    Description

    The time at which this ticket was last updated.

  • Name
    store_id
    Type
    integer
    Description

    The ID of the store this ticket belongs to.

  • Name
    read_by
    Type
    integer
    Description

    The ID of the user who read the ticket last.

  • Name
    archived
    Type
    integer
    Description

    Whether the ticket has been archived, one of two:

    • 1: Ticket is archived.
    • 0: Ticket is not archived.

The ticket message model

A ticket has many messages. Each ticket message model contains all the information about that specific message, including the ticket's author, content, and ticket ID.

Properties

  • Name
    id
    Type
    integer
    Description

    The unique identifier for the ticket message.

  • Name
    author
    Type
    string
    Description

    The author of the ticket message. One of two statuses:

    • STORE
    • CUSTOMER
  • Name
    sender
    Type
    string
    Description

    The details of the ticket message sender. One of two possibilities:

    • Username: For users logged into SellApp.
    • Email: For users not logged into SellApp.
  • Name
    content
    Type
    string
    Description

    The ticket message content; the actual message that is sent.

  • Name
    created_at
    Type
    timestamp
    Description

    The time at which this ticket was first created.

  • Name
    updated_at
    Type
    timestamp
    Description

    The time at which this ticket was last updated.

  • Name
    ticket_id
    Type
    integer
    Description

    The ID of the ticket this ticket message belongs to.


GET/v1/tickets

List all tickets

This endpoint allows you to retrieve a paginated list of all your tickets received. By default, a maximum of fifteen tickets are shown per page.

Optional attributes

  • Name
    limit
    Type
    integer
    Description

    Limit the number of tickets returned.

  • Name
    page
    Type
    integer
    Description

    The page number you are attempting to access.

Request

GET
/v1/tickets
$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://sell.app/api/v1/tickets');
$request->setRequestMethod('GET');
$request->setHeaders([
  'accept' => 'application/json',
  'Authorization' => 'Bearer {ApiKeyHere}'
]);

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();

Response

{
  "data": [
    {
      "id": 1,
      "title": "acquisition.",
      "status": "OPEN",
      "customer": {
        "id": "cfbbf27a-0595-3234-953d-5f6629fccc9d",
        "email": "e@x.com"
      },
      "reference": [],
      "created_at": "2022-12-12T12:12:12.000000Z",
      "updated_at": "2022-12-12T12:12:12.000000Z",
      "store_id": 1,
      "read_by": 1,
      "archived": 0
    }
  ],
  "links": {
    // ...
  },
  "meta": {
    // ...
  }
}

GET/v1/tickets/:id

Retrieve specific ticket

This endpoint allows you to retrieve a specific ticket by providing the unique identifier. Refer to the list at the top of this page to see which properties are included with ticket objects.

Request

GET
/v1/tickets/:id
$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://sell.app/api/v1/tickets/1');
$request->setRequestMethod('GET');
$request->setHeaders([
  'accept' => 'application/json',
  'Authorization' => 'Bearer {ApiKeyHere}'
]);

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();

Response

{
  "data": {
    "id": 1,
    "title": "acquisition.",
    "status": "OPEN",
    "customer": {
      "id": "cfbbf27a-0595-3234-953d-5f6629fccc9d",
      "email": "e@x.com"
    },
    "reference": [],
    "created_at": "2022-12-12T12:12:12.000000Z",
    "updated_at": "2022-12-12T12:12:12.000000Z",
    "store_id": 1,
    "read_by": 1,
    "archived": 0
  }
}

GET/v1/tickets/:id/messages

List all ticket messages

This endpoint allows you to retrieve a paginated list of all your ticket messages within a specific ticket received. By default, a maximum of fifteen ticket messages are shown per page.

Optional attributes

  • Name
    limit
    Type
    integer
    Description

    Limit the number of ticket messages returned.

  • Name
    page
    Type
    integer
    Description

    The page number you are attempting to access.

Request

GET
/v1/tickets/:id/messages
$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://sell.app/api/v1/tickets/1/messages');
$request->setRequestMethod('GET');
$request->setHeaders([
  'accept' => 'application/json',
  'Authorization' => 'Bearer {ApiKeyHere}'
]);

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();

Response

{
  "data": [
    {
      "id": 1,
      "author": "CUSTOMER",
      "sender": "e@x.com",
      "content": "Hi. I want to buy sell app. do you accept doge?",
      "created_at": "2022-12-12T12:12:12.000000Z",
      "updated_at": "2022-12-12T12:12:12.000000Z",
      "ticket_id": 1
    }
  ],
  "links": {
    // ...
  },
  "meta": {
    // ...
  }
}

POST/v1/tickets/:id/messages

Reply to ticket

This endpoint allows you to add a reply to a given ticket.

Required attributes

  • Name
    content
    Type
    string
    Description

    The reply you want to add to this ticket.

Request

POST
/v1/tickets/:id/messages
$client = new http\Client;
$request = new http\Client\Request;

$body = new http\Message\Body;
$body->append('{
  "content": "Hey thanks for reaching out but we do not accept doge."
}');

$request->setRequestUrl('https://sell.app/api/v1/tickets/1/messages');
$request->setRequestMethod('POST');
$request->setBody($body);

$request->setHeaders([
  'Content-Type' => 'application/json',
  'accept' => 'application/json',
  'Authorization' => 'Bearer {ApiKeyHere}'
]);

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();

Response

{
  "id": 2,
  "author": "STORE",
  "sender": null,
  "content": "Hey thanks for reaching out but we do not accept doge.",
  "created_at": "2022-12-12T12:12:12.000000Z",
  "updated_at": "2022-12-12T12:12:12.000000Z",
  "ticket_id": 1
}

GET/v1/tickets/:id/messages/:id

Retrieve specific ticket message

This endpoint allows you to retrieve a specific ticket message by providing the unique identifier. Refer to the list at the top of this page to see which properties are included with ticket message objects.

Request

GET
/v1/tickets/:id/messages/:id
$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://sell.app/api/v1/tickets/1/messages/2');
$request->setRequestMethod('GET');
$request->setHeaders([
  'accept' => 'application/json',
  'Authorization' => 'Bearer {ApiKeyHere}'
]);

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();

Response

{
  "data": {
    "id": 2,
    "author": "STORE",
    "sender": null,
    "content": "Hey thanks for reaching out but we do not accept doge.",
    "created_at": "2022-12-12T12:12:12.000000Z",
    "updated_at": "2022-12-12T12:12:12.000000Z",
    "ticket_id": 1
  }
}