Skip to main content

Request Body

The request body should be a JSON object that adheres to the following TypeScript type:
{
  "title": "string (Required)",
  "externalId": "string (Required)",
  "service": "enum[
    'x',
    'zendesk',
    'linear',
    'googledoc',
    'youtube',
    'slack',
    'email',
    'twitter',
    'facebook',
    'reddit',
    'file',
    'play_store',
    'app_store',
    'spreadsheet',
    'telegram',
    'discord',
    'imessage',
    'custom'] (Required)",
  "quotes": [
    {
      "text": "string (Required)",
      "speaker": "string",
      "username": "string",
      "externalId": "string",
      "createdAt": "ISO 8601 date string",
      "replyingTo": "string",
      "upVotes": "number",
      "downVotes": "number",
      "score": "number"
    }
  ],
  "channelName": "string",
  "channelId": "string",
  "description": "string",
  "createdAt": "ISO 8601 date string",
  "url": "string",
  "upVotes": "number",
  "downVotes": "number",
  "score": "number"
}
type Body = {
  title: string;
  externalId: string;
  service:
    | 'x'
    | 'zendesk'
    | 'linear'
    | 'googledoc'
    | 'youtube'
    | 'slack'
    | 'email'
    | 'twitter'
    | 'facebook'
    | 'reddit'
    | 'file'
    | 'play_store'
    | 'app_store'
    | 'spreadsheet'
    | 'telegram'
    | 'discord'
    | 'imessage'
    | 'custom';
  quotes: {
    text: string;
    speaker?: string;
    username?: string;
    externalId?: string;
    createdAt?: string; // ISO 8601 date format
    replyingTo?: string | null;
    upVotes?: number;
    downVotes?: number;
    score?: number;
  }[];
  channelName?: string;
  channelId?: string;
  description?: string;
  createdAt?: string; // ISO 8601 date format
  url?: string;
  upVotes?: number;
  downVotes?: number;
  score?: number;
};

Field Explanations

  • title (string): The title of the new source.
  • externalId (string): The original external ID of the source, if applicable. This is used to prevent duplicates if the same source is posted twice.
  • service (enum): The type of the source. Possible values are:
    • x
    • zendesk
    • linear
    • googledoc
    • youtube
    • slack
    • email
    • twitter
    • facebook
    • reddit
    • file
    • play_store
    • app_store
    • spreadsheet
    • telegram
    • discord
    • imessage
    • custom
  • quotes (array of objects): An array of quote objects. Each quote object contains:
    • text (string): The text of the quote/comment.
    • speaker (string, optional): The speaker of the quote/comment. Either provide speaker or username, they are treated the same.
    • username (string, optional): The username associated with the quote/comment. Either provide speaker or username, they are treated the same.
    • externalId (string, optional): The original external ID of the quote/comment, if applicable. This is used to prevent duplicates if the same quote is posted twice.
    • createdAt (string, optional): The creation date of the quote/comment in ISO 8601 format.
    • replyingTo (string, optional): The ID of the quote/comment being replied to, if applicable.
    • upVotes (number, optional): The number of upvotes or likes the quote/comment received.
    • downVotes (number, optional): The number of downvotes or dislikes the quote/comment received.
    • score (number, optional): The score of the quote/comment. (upVotes - downVotes)
  • channelName (string, optional): The name of the channel or subreddit.
  • channelId (string, optional): The ID of the channel or subreddit.
  • description (string, optional): A brief description of the new source.
  • createdAt (string, optional): The creation date of the source in ISO 8601 format.
  • url (string, optional): The URL of the source, if applicable.
  • upVotes (number, optional): The number of upvotes or likes the source received.
  • downVotes (number, optional): The number of downvotes or dislikes the source received.
  • score (number, optional): The score of the source. (upVotes - downVotes)

Service Types

The service field accepts the following enum values (string):
  • x
  • zendesk
  • linear
  • googledoc
  • youtube
  • slack
  • email
  • twitter
  • facebook
  • reddit
  • file
  • play_store
  • app_store
  • spreadsheet
  • telegram
  • discord
  • imessage
  • custom
Each value represents a different type of service.

Responses

  • 200 OK: Successfully received and processed the request. Returns details of the created or updated source.
  • 400 Bad Request: The request was invalid. Returns an error specifying what was wrong.
  • 403 Forbidden: API key missing or invalid.
  • 500 Internal Server Error: An error occurred on the server.

Example Request

{
  "title": "Example Source",
  "externalId": "12345",
  "service": "zendesk",
  "quotes": [
    {
      "text": "Example quote",
      "speaker": "John Doe"
    }
  ]
}

Example Response

{
  "message": "New source received successfully.",
  "source": {
    "id": "1",
    "title": "Example Source",
    "description": "A brief description",
    "url": "http://example.com",
    "wordCount": 100,
    "status": "TRANSCRIBED",
    "createdAt": "2023-01-01T00:00:00Z",
    "externalId": "12345"
  },
  "quotes": [
    {
      "id": "1",
      "text": "Example quote",
      "speaker": "John Doe",
      "createdAt": "2023-01-01T00:00:00Z",
      "upVotes": 10,
      "downVotes": 2,
      "score": 8,
      "externalId": "q12345"
    }
  ]
}