# Post Activity Type

{% hint style="info" %}
Perform Activity Types (like, dislike, share, etc.) on any created audio post.
{% endhint %}

***

### Post Activity Type

Post an Activity Type on an audio post.

<img src="/files/fdIhU2KgKfGpfDUgFucR" alt="API: - https://matar.in.ngrok.io/api/v1/post_activity?organization_id=<ORG_ID>" class="gitbook-drawing">

### Params

**Query Parameter ⬇️**

<table data-full-width="false"><thead><tr><th width="234.33333333333331">Query Parameter</th><th width="129">Data Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>organization_id </strong><mark style="color:red;"><strong>(required)</strong></mark></td><td>String</td><td>6-Digit Alpha Numerical number for identifying a particular org.</td></tr></tbody></table>

**Header Parameter ⬇️**

<table data-full-width="false"><thead><tr><th width="231.33333333333331">Header Parameter</th><th width="129">Data Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>Bearer {{access_token}} </strong><mark style="color:red;"><strong>(required)</strong></mark></td><td>String</td><td>Access tokens enable secure access to Matar Resources.</td></tr></tbody></table>

**Body Parameter ⬇️**

<table data-full-width="false"><thead><tr><th width="229.33333333333331">Body Parameter</th><th width="129">Data Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>post_activity_type </strong><mark style="color:red;"><strong>(required)</strong></mark></td><td>String</td><td><p>Activity Type can be of 8 types reply, like, downvote, dislike, share, upvote, block, view. </p><p>To know more about activity types check the Activity Types API endpoint.</p></td></tr><tr><td><strong>post_id </strong><mark style="color:red;"><strong>(required)</strong></mark></td><td>String</td><td>Every created post has a unique identifier that identifies a particular audio post.</td></tr></tbody></table>

***

**Sample Request ⬇️️**&#x20;

```
curl --location 'https://matar.in.ngrok.io/api/v1/post_activity?organization_id=685QVK' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmcmVzaCI6dHJ1ZSwiaWF0IjoxNjkyOTQzNDY0LCJqdGkiOiJmNTY2MWMzMC00YWNkLTRjNDUtYmU2NS03ZmQyOGM2OTJiYzMiLCJ0eXBlIjoiYWNjZXNzIiwic3ViIjoiMzk1MDFUIiwibmJmIjoxNjkyOTQzNDY0LCJleHAiOjE2OTM4MDc0NjR9.soJepZDtTK3JLfvMjl_XL5jwQr9sP8oTOiA43Fi7VZs' \
--header 'Content-Type: application/json' \
--data '{
    "post_activity_type": "like",
    "post_id": "VAGDWM8YZP",
    "data": {
        "hi": "hello"
    }
}'
```

**Responses ⬇️**

Status Code: **🟢200** (200 denotes **'ok'**)

```200
{
    "message": "New user activity on post",
    "post_activity": {
        "_id": "4RAY29",
        "data": {
            "hi": "hello"
        },
        "is_active": true,
        "organization_id": "685QVK",
        "post_activity_type": "like",
        "post_id": "VAGDWM8YZP",
        "user_id": "39501T"
    }
}
```

Status Code: 🔴**404** (404 denotes **'Not found'**)

```
{
      "message": "Ain't no cake like that."
}
```

***

**Response Parameters Description:**

| Response Parameter   | Description                                                         |
| -------------------- | ------------------------------------------------------------------- |
| message              | Server generated message when some new activity is detected on post |
| post\_activity\_id   | A unique identifier linked to activity type on post.                |
| post\_activity\_data |                                                                     |
| is active            | Whether organization is active or not.                              |
| organization\_id     | Phone Number Linked to User Account                                 |
| post\_activity\_type | Type of user activity on post.                                      |
| post\_id             | Post ID linked to the post on which user activity is detected.      |
| user\_id             | User ID linked to user from which activity is posted.               |

***

## Get User Post Activity

Get user activity type for questions and answers posts.

<img src="/files/GBnYBTRQvBLa63p6ZfWt" alt="API: - https://matar.in.ngrok.io/api/v1/user_post_activities?post_activity_type=<ACTIVITY_TYPE>&#x26;organization_id=<ORG_ID>" class="gitbook-drawing">

### Params

**Query Parameter ⬇️**

<table data-full-width="false"><thead><tr><th width="240.33333333333331">Query Parameter</th><th width="114">Data Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>organization_id </strong><mark style="color:red;"><strong>(required)</strong></mark></td><td>String</td><td>A unique identifier for organization in which question or answer is posted.</td></tr><tr><td><strong>post_activity_type </strong><mark style="color:green;"><strong>(optional)</strong></mark></td><td>String</td><td>Activity Type can be of 8 types reply, like, downvote, dislike, share, upvote, block, view. Provide any type to find the relevant type of posts.</td></tr></tbody></table>

**Header Parameter ⬇️**

<table data-full-width="false"><thead><tr><th width="235.33333333333331">Header Parameter</th><th width="109">Data Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>Bearer {{access_token}} </strong><mark style="color:red;"><strong>(required)</strong></mark></td><td>String</td><td>Access Token for securely accessing Matar server resources.</td></tr></tbody></table>

***

**Sample Request ⬇️️**&#x20;

```
The request below will get alist of posts that are liked by user.


curl --location --request GET 'https://matar.in.ngrok.io/api/v1/user_post_activities?post_activity_type=like&organization_id=129487316' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmcmVzaCI6dHJ1ZSwiaWF0IjoxNjkzMTY3MDI4LCJqdGkiOiI3YWMxYmI5Mi02MDljLTRjMzktYTliOC1kZDBhNmExOTJjZjEiLCJ0eXBlIjoiYWNjZXNzIiwic3ViIjoiRUE5UzZaIiwibmJmIjoxNjkzMTY3MDI4LCJleHAiOjE2OTQwMzEwMjh9.ef95SR3_rR3KkGCdIQoiZBMixU6TA2xNJ5w-i3xTtig' \
--form 'file=@"/Users/srikalyanburra/Downloads/aud1.m4a"' \
--form 'parent_post_id="LX8LQC"'
```

**Responses ⬇️**

Status Code: **🟢200** (200 denotes **'ok'**)

```200
{
    "page_details": {
        "current_start": 0,
        "next_offset": 1,
        "total": 1
    },
    "posts": [
        {
            "_id": "YQ4V7H6JN7",
            "audio_data": null,
            "audio_text": "हमें अपनी अच्छी सेहत के लिए क्या करना चाहिए?",
            "audio_translation": null,
            "audio_url": "https://matar-audio.s3.ap-south-1.amazonaws.com/26O9BZNI43v2Sehat_Question.flac",
            "category_ids": [
                "TFTWNI"
            ],
            "chatgpt_query_id": null,
            "child_posts": [],
            "child_posts_details": {
                "current_start": 0,
                "cursor": 0,
                "next_offset": 0,
                "total": 0
            },
            "created_at": "27/08/2023 , 08:13 PM",
            "data": {
                "duration": 4.56,
                "like": 1
            },
            "is_active": true,
            "is_chatgpt_enabled": false,
            "organization_id": "129487316",
            "parent_post": {},
            "parent_post_id": null,
            "sort_order": null,
            "text": "हमें अपनी अच्छी सेहत के लिए क्या करना चाहिए?",
            "user": {
                "_id": "EA9S6Z",
                "image_url": null,
                "name": "Sri"
            },
            "user_id": "EA9S6Z",
            "user_post_activities": {
                "like": true
            },
            "whisper_id": null
        }
    ]
}
```

***

**Response Parameters Description:**

| Response Parameter            | Description                                                                                                                                                                       |
| ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| page\_details\_current\_start | Current post page number.                                                                                                                                                         |
| page\_details\_next\_offset   | Set a particular page number to start for post-viewing via offset.                                                                                                                |
| page\_details \_total         | Total number of post pages available to view.                                                                                                                                     |
| post\_id                      | A unique identifier linked to posted audio question.                                                                                                                              |
| post\_audio\_text             | Contains transcribed version of audio post.                                                                                                                                       |
| post\_audio\_url              | URL of where audio post is stored.                                                                                                                                                |
| category\_ids                 | A unique identifier containing the category in which question is posted.                                                                                                          |
| child\_posts                  | Contains list of child posts. A child post is a answer/reply post to the parent/question post.                                                                                    |
| child\_posts\_current\_start  | Current child post page number.                                                                                                                                                   |
| child\_posts\_cursor          |                                                                                                                                                                                   |
| child\_posts\_next\_offset    | Set a particular page number to start from for child post-viewing via offset.                                                                                                     |
| total                         | Total number of child posts                                                                                                                                                       |
| chatgpt\_query\_id            | A chatgpt identifier linked to audio question asked by users.                                                                                                                     |
| created\_at                   | Post creation date                                                                                                                                                                |
| duration                      | Duration of audio post in minutes and seconds.                                                                                                                                    |
| like                          | Total number of likes for the post.                                                                                                                                               |
| is\_active                    | Is the organization active or not.                                                                                                                                                |
| is\_chatgpt\_enabled          | Is chat gpt enabled to answer to question post inn an organization                                                                                                                |
| organization\_id              | Organization in which the question is posted.                                                                                                                                     |
| parent\_post\_id              | If question post has replies or child post then the question has a valid parent\_post\_id. parent\_post\_id is set to null when question post has no replies.                     |
| sort\_order                   | When there are multiple posts to display they are sorted by sort order and has a number assigned to it. If there is a single post to display the sort\_order will be set to null. |
| text                          | Contains post text transcribed from audio.                                                                                                                                        |
| user\_id                      | User ID of the account from which audio is posted.                                                                                                                                |
| user image\_url               | Image URL containing the user account image.                                                                                                                                      |
| user\_name                    | Name for the user account.                                                                                                                                                        |
| user\_post\_activities        | Any post activity performed by the linked user.                                                                                                                                   |
| whisper\_id                   | Used internally for speech-to-text tasks.                                                                                                                                         |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://gramhal.gitbook.io/matar/developer-reference/api/posts/post-activity-type.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
