Ⓜ️
Matar
  • ✍️About Matar
  • 📁Concept
    • 📄Understanding Matar
  • 📁Matar For Communities
    • 📄Hosting on Matar
    • 📄Trial Pilot
    • 📄Community Management
  • 📁🚀 Get Started
    • 📄Language Selection
    • 📄Organization Onboarding
    • 📄Signing Up
  • 📁Matar Features
    • 📄Browsing the App
    • 📄View Questions
    • 📄Changing Subjects
    • 📄Answer Questions
    • 📄Ask a Question
    • 📄Share a Question
    • 📄Like an Answer
    • 📄See Liked Answers
    • 📄Dislike an Answer
    • 📄See Recorded Questions
    • 📄See Recorded Answers
    • 📄Troubleshooting
    • 📄Version
    • 📄FAQ
  • 📁Developer Reference
    • 🗄️Architecture
      • 📄Overview
      • 📄Backend
      • 📄Frontend
      • 📄API Layer
    • 📜Guides
      • 📄Add/delete posts
    • 🛠️API
      • 📄API Flow
      • 📁User Login
        • 📄Login
        • 📄Submit OTP
        • 📄Get Current User
        • 📄Edit User
        • 📄Logout
      • 📄Organization Selection
      • 📄Language and Categories
      • 📄Activity Types
      • 📁Posts
        • 📄Post a New Question
        • 📄Delete a Post
        • 📄Post Activity Type
        • 📄Post Information
        • 📄Post GPT Processing
    • 📶DB Tables and Structure
      • 📄Matar DB tables
      • 📄Code Structure
    • 💻Backend Code
      • 📄Response on a Post from AI
      • 📄Post Sorting
      • 📄User Registration
      • 📄Org Based Code
    • 💻Frontend Code
      • 📄Overview
      • 📄Setting up Project
      • 📄Project Structure
      • 📄Code Directories
        • 📄Broadcast Directory
        • 📄Core Directory
        • 📄Data Directory
        • 📄di Directory
        • 📄domain/repository Directory
        • 📄model Directory
        • 📄retrofit Directory
        • 📄ui Directory
          • 📄dialog
          • 📄features
          • 📄service
  • 🤝Support
Powered by GitBook
On this page
  • Post new Question
  • Params
  • Create a Child Post.
  • Params
  1. Developer Reference
  2. API
  3. Posts

Post a New Question

PreviousPostsNextDelete a Post

Last updated 1 year ago

Post a New Question for audio conversations.

Post new Question

Params

Query Parameter ⬇️

Query Parameter
Data Type
Description

organization_id (required)

String

Organization ID in which post has to be created

Header Parameter ⬇️

Header Parameter
Data Type
Description

Bearer {{access_token}} (required)

String

Access tokens securely contain details for the user posting the question as an audio file.

Body Parameter ⬇️

Body Parameter
Data Type
Description

file (required)

String

Audio file to post. Audio Format Supported types: flac single channel mono audio. Max audio duration: 120 seconds

category_id (required)

String

A category ID in which an audio post has to be uploaded. Some categories are science, happiness, society, fitness, etc.

To see a list of known Categories with respect to Category ID mapping check Get all Categories API Endpoint.


Sample Request ⬇️️

curl --location 'https://matar.in.ngrok.io/api/v1/new_post?organization_id=129487316' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmcmVzaCI6dHJ1ZSwiaWF0IjoxNjkyODcyNDIxLCJqdGkiOiIyZmNiODJiYi0zMDYzLTQzNGUtOGM5OS00NTVjMDhhY2Y3MmMiLCJ0eXBlIjoiYWNjZXNzIiwic3ViIjoiMzk1MDFUIiwibmJmIjoxNjkyODcyNDIxLCJleHAiOjE2OTM3MzY0MjF9.ovz0ItiPsYG_rqT3vEYl42WZBonX52NXf-oWE4DuGmQ' \
--form 'file=@"YcyZ1KDNO/Sehat Question.flac"' \
--form 'category_id="TFTWNI"'

Responses ⬇️

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

{
    "message": "Post received.. generated transcription",
    "post": {
        "_id": "ACDM6HSQB3",
        "audio_data": null,
        "audio_text": "हमें अपनी अच्छी सेहत के लिए क्या करना चाहिए?",
        "audio_translation": null,
        "audio_url": "https://matar-audio.s3.ap-south-1.amazonaws.com/IT8WGDH8Z4v2Sehat_Question.flac",
        "category_ids": [
            "TFTWNI"
        ],
        "chatgpt_query_id": null,
        "created_at": "24/08/2023 , 10:36 AM",
        "data": {
            "duration": 4.56
        },
        "is_active": true,
        "is_chatgpt_enabled": false,
        "organization_id": "129487316",
        "parent_post_id": null,
        "sort_order": null,
        "text": "हमें अपनी अच्छी सेहत के लिए क्या करना चाहिए?",
        "user": {
            "_id": "39501T",
            "image_url": "https://listapp-images.s3.ap-south-1.amazonaws.com/matar_profile_05.png",
            "name": "Sri"
        },
        "user_id": "39501T",
        "whisper_id": null
    }
}

Status Code: 🔴400 (400 denotes 'Bad request')

/// Response 1
{
    "error": "No file provided"
}
///// Response 2
{
    "message": "no such category"
}

Response Parameters Description:

Response Parameter
Description

message

A response message displayed by servers when a question is successfully posted.

post_id

A unique identifier generated in map to posted 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.

chatgpt_query_id

A chatgpt unique identifier linked to audio question asked by users.

created_at

Post creation date

duration

Duration of audio post in minutes and seconds.

is_active

Is organization active or not.

is_chatgpt_enabled

Is chat gpt enabled to answer to post.

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.

whisper_id

Used internally for speech-to-text tasks.


Create a Child Post.

Params

Query Parameter ⬇️

Body Parameter
Data Type
Description

organization_id (required)

String

Organization ID in which post has to be created

Header Parameter ⬇️

Header Parameter
Data Type
Description

Bearer {{access_token}} (required)

String

Access tokens securely contain details for the user posting the question as an audio file.

Body Parameter ⬇️

Header Parameter
Data Type
Description

file (required)

String

Audio file containing the answer. Audio Format Supported types: flac single channel mono audio. Max audio duration: 120 seconds

category_id (required)

String

A category ID in which a post is uploaded. Some categories are science, happiness, society, fitness, etc.

To see a list of known Categories with respect to Category ID mapping check Get all Categories API Endpoint.

parent_post_id (required)

String

Parent Post ID is the Post ID of the posted Question to link child/answer post.


Sample Request ⬇️️

curl --location 'https://matar.in.ngrok.io/api/v1/new_post?organization_id=K7QUEV' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmcmVzaCI6dHJ1ZSwiaWF0IjoxNjkzMjk4NDEwLCJqdGkiOiJiYmE3NzdhYy05MTA5LTQyOTQtYjhkNy04NmQ1NDZiNTVmOGEiLCJ0eXBlIjoiYWNjZXNzIiwic3ViIjoiRUE5UzZaIiwibmJmIjoxNjkzMjk4NDEwLCJleHAiOjE2OTQxNjI0MTB9.qn7dyTb9ws4lrGdAoh6rAzu24gos-EIY3lbloFJTrH4' \
--form 'file=@"xglbaJXSR/Sehat Question.flac"' \
--form 'parent_post_id="9TX90RLDR4"' \
--form 'category_id="TFTWNI"'

Responses ⬇️

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

{
    "message": "Post received.. generated transcription",
    "post": {
        "_id": "K74Q9PXAXG",
        "audio_data": null,
        "audio_text": null,
        "audio_translation": null,
        "audio_url": "https://matar-audio.s3.ap-south-1.amazonaws.com/L89W2SSZRBv2Sehat_Question.flac",
        "category_ids": [
            "TFTWNI"
        ],
        "chatgpt_query_id": null,
        "created_at": "29/08/2023 , 12:02 PM",
        "data": {
            "duration": 4.56
        },
        "is_active": true,
        "is_chatgpt_enabled": false,
        "organization_id": "K7QUEV",
        "parent_post_id": "9TX90RLDR4",
        "sort_order": null,
        "text": null,
        "user": {
            "_id": "EA9S6Z",
            "image_url": "https://listapp-images.s3.ap-south-1.amazonaws.com/matar_profile_05.png",
            "name": "shantanu"
        },
        "user_id": "EA9S6Z",
        "whisper_id": null
    }
}

Status Code: 🔴400 (400 denotes 'Bad request')

/// Response 1
{
    "error": "No file provided"
}
///// Response 2
{
    "message": "no such category"
}

Response Parameters Description:

Response Parameter
Description

message

A response message displayed by servers when a question is successfully posted.

post_id

A unique identifier generated in map to posted 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.

chatgpt_query_id

created_at

Post creation date

duration

Duration of audio post in minutes and seconds.

is_active

is_chatgpt_enabled

Is chat gpt enabled to answer to post.

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.

whisper_id

Used internally for speech-to-text tasks.

📁
🛠️
📁
📄
Drawing
API: -
Drawing
API: -
https://matar.in.ngrok.io/api/v1//new_post?organization_id={{default_organization_id}}
https://matar.in.ngrok.io/api/v1//new_post?organization_id={{default_organization_id}}