API Docs
HomeDocsWebsite
  • Home
  • Introduction
    • Authorization
      • Authorize
      • Get a Token
      • Third-Party Login
    • Field Types and Validation
      • Field Types
      • Validation
    • Query Manipulation
      • Constraints
      • Result Control
      • Value Filters
    • Entity Permissions
      • Restricted Scope
  • API reference
    • Infoboard
      • InfoboardChannels
      • InfoboardPosts
      • InfoboardPostSeenUsers
      • InfoboardPostReadUsers
      • InfoboardComments
      • InfoboardDepartmentSettings
    • Manual
      • ManualChapters
      • ManualEntries
      • ManualEntrySeenUsers
    • Calendar
      • Calendars
      • CalendarEvents
    • Filemanager
      • FilemanagerDirectories
      • FilemanagerFiles
    • Files
    • Forms
      • Forms
      • FormFields
      • FormFieldTypes
      • FormFieldValidations
      • FormFieldValidationTypes
      • FormMessages
      • FormMessageFields
    • Layouts
      • Layouts
      • LayoutRows
      • LayoutColumns
      • LayoutColumnLayoutElements
    • Tasks 2.0
      • TaskTemplates
      • TaskFields
      • TaskAssignments
      • TaskExecutions
      • TaskProgressFields
    • Departments
    • Roles
    • Permissions
    • Users
    • UserActivities
    • EntityPermissions
    • Notifications
    • Reactions
    • Icons
    • Folders
    • SharedItems
    • UrlContext
  • Resources
    • Release Notes
      • v2.106.0
      • v2.102.0
Powered by GitBook
On this page
  • Introduction
  • Model Definition
  • Relations
  • Reactable types
  • Appends
  • List by reactable
  • Summary by reactable
  • Create or update
  • Delete
  1. API reference

Reactions

PreviousNotificationsNextIcons

Last updated 11 months ago

Introduction

Reactions are a quick and easy way to provide feedback to Reactable entities via an emoji. Each can only submit one Reaction per Reactable.

The Reactions of all are then summarized in order to obtain a quick picture of user sentiment for the Reactable.

Model Definition

Relations

Key
Relation
Type
Relation Field(s)

user

Belongs to

user_id

reactable

Reactable

Morph to

reactable_type, reactable_id

Reactable types

  • infoboardPost - React to a .

  • infoboardComment - React to a .

  • manualEntry - React to a .

  • chatMessage - React to a ChatMessages.

Appends

The following appends can be applied on all Reactable entities:

reactions_summary

Adds the reactions_summary append to the response, containing the reaction and the count. The reaction counts are sorted from highest to lowest.

Example response:

{
  "reactions_summary": [
    {
      "reaction": "👍",
      "count": 2
    },
    {
      "reaction": "👎",
      "count": 1
    }
  ]
}

List by reactable

List the Reactions for given Reactable.

Definition

GET /api/reactions/{reactableType}/{reactableId}

Example Request

$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('POST', '/api/reactions/infoboardPost/1', [
    'headers' => ['Authorization' => "Bearer {accessToken}"],
]);

Example Response

[
  {
    "user_id": 1,
    "reactable_id": 1,
    "reactable_type": "infoboardPost",
    "value": "👍",
    "created_at": "2024-07-01 12:00:00",
    "updated_at": "2024-07-01 12:00:00"
  },
  {
    "user_id": 2,
    "reactable_id": 1,
    "reactable_type": "infoboardPost",
    "value": "👍",
    "created_at": "2024-07-01 13:00:00",
    "updated_at": "2024-07-01 13:00:00"
  },
  {
    "user_id": 3,
    "reactable_id": 1,
    "reactable_type": "infoboardPost",
    "reaction": "👎",
    "created_at": "2024-07-01 14:00:00",
    "updated_at": "2024-07-01 14:00:00"
  }
]

Summary by reactable

Get a summary of Reactions for given Reactable. It has the same structure as the reactions_summary append.

Definition

GET /api/reactions/{reactableType}/{reactableId}/summary

Example Request

$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('POST', '/api/reactions/infoboardPost/1/summary', [
    'headers' => ['Authorization' => "Bearer {accessToken}"],
]);

Example Response

[
  {
    "reaction": "👍",
    "count": 2
  },
  {
    "reaction": "👎",
    "count": 1
  }
]

Create or update

Definition

POST /api/reactions

Request Keys

Key
Type
Description

reactable_id*

integer

The ID of the Reactable entity.

reactable_type*

string

value*

string

The emoji to react to the Reactable entity.

Keys with * are required.

Example Request

$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('POST', '/api/reactions', [
    'headers' => ['Authorization' => "Bearer {accessToken}"],
    'json' => [
        'reactable_id' => 1,
        'reactable_type' => 'infoboardPost',
        'value' => "👍"
    ]
]);

Example Response

{
  "id": 4,
  "reactable_id": 1,
  "reactable_type": "infoboardPost",
  "value": "👍",
  "user_id": 1,
  "created_at": "2024-07-01 15:00:00",
  "updated_at": "2024-07-01 15:00:00"
}

Delete

Delete an Reaction by id.

Definition

DELETE /api/reactions/{id}

Example Request

$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('DELETE', '/api/reactions/4', [
    'headers' => ['Authorization' => "Bearer {accessToken}"]
]);

Example Response

{
  "status": "success",
  "data": []
}

Create a new Reaction. If the reaction for given reactable_type, reactable_id and the authenticated ID exits, it will be updated.

The of the Reaction.

User
Users
InfoboardPost
InfoboardComment
ManualEntry
User's
User
Reactable type