--- title: "Data Structures for WhatsApp API via OAuth 2.0" slug: "data-structures-for-whatsapp-api-via-oauth-20" description: "Documents the message object structures for the OAuth 2.0 WhatsApp API, covering template, text, media, location, and interactive message JSON formats." updated: 2026-11-02T13:45:57Z published: 2026-11-02T13:45:57Z canonical: "academy.insiderone.com/data-structures-for-whatsapp-api-via-oauth-20" --- > ## Documentation Index > Fetch the complete documentation index at: https://academy.insiderone.com/llms.txt > Use this file to discover all available pages before exploring further. # Data Structures for WhatsApp API via OAuth 2.0 This article provides an overview of the data structures used in OAuth 2.0 message requests, focusing on how messages and templates are defined and structured. ## Message Object The primary object used to define the message content. ### Type: template This request is used for sending template messages. All templates must be pre-approved by Meta. ```json {  "type": "template",  "template": {    "name": "welcome_message",    "language": {      "code": "tr"    },    "components": [      {        "type": "body",        "parameters": [          {            "type": "text",            "text": "Variable value"          }        ]      }    ]  } } ``` ### Type: text This request is used to send plain-text messages. ```json {  "type": "text",  "text": {    "body": "Hello! How can I help you?",    "preview_url": false  } } ``` ### Type: image This request is used to send images. ```json {  "type": "image",  "image": {    "link": "https://example.com/image.jpg",    "caption": "Image description"  } } ``` Or using an uploaded media ID: ```json {  "type": "image",  "image": {    "id": "1234567890123456",    "caption": "Image description"  } } ``` ### Type: video This request is used to send videos. ```json {  "type": "video",  "video": {    "link": "https://example.com/video.mp4",    "caption": "Video description"  } } ``` ### Type: document This request is used to send documents. ```json {  "type": "document",  "document": {    "link": "https://example.com/document.pdf",    "filename": "dokuman.pdf",    "caption": "Document description"  } } ``` ### Type: audio This request is used to send audio files. You can also send an audio file as a voice note. ```json {  "type": "audio",  "audio": {    "link": "https://example.com/audio.mp3"  } } ``` Or using an uploaded media ID: ```json {  "type": "audio",  "audio": {    "id": "1234567890123456"  } } ``` To send the audio as a voice note, set `voice` to `true`: ```json {  "type": "audio",  "audio": {    "link": "https://example.com/media/voice-note.ogg",    "voice": true  } } ``` > [!NOTE] > The `voice` parameter is optional. To send a voice note, use an OGG file with the OPUS codec. If you do not specify `voice`, the audio is sent as a regular audio file. If `voice` is not a boolean value, for example `"yes"`, the request returns HTTP 400 with error code 2001. ### Type: location This request is used to send locations. ```json {  "type": "location",  "location": {    "latitude": 41.0082,    "longitude": 28.9784,    "name": "Istanbul",    "address": "Istanbul, Turkey"  } } ``` ### Type: interactive This request is used to send interactive messages (buttons, lists). ```json {  "type": "interactive",  "interactive": {    "type": "button",    "body": {      "text": "Which action would you like to take?"    },    "action": {      "buttons": [        {          "type": "reply",          "reply": {            "id": "btn_1",            "title": "Place Order"          }        },        {          "type": "reply",          "reply": {            "id": "btn_2",            "title": "Get Support"          }        }      ]    }  } } ``` ## Template Components The following component types are utilized within template messages: ### Body Component ```json {  "type": "body",  "parameters": [    {      "type": "text",      "text": "John Doe"    }  ] } ``` ### Header Component ```json {  "type": "header",  "parameters": [    {      "type": "image",      "image": {        "link": "https://example.com/header-image.jpg"      }    }  ] } ``` ### Button Component ```json {  "type": "button",  "sub_type": "url",  "index": "0",  "parameters": [    {      "type": "text",      "text": "PROMO2024"    }  ] } ``` ### Carousel Component ```json {  "type": "carousel",  "cards": [    {      "card_index": 0,      "components": [        {          "type": "header",          "parameters": [            {              "type": "image",              "image": {                "link": "https://example.com/product1.jpg"              }            }          ]        },        {          "type": "body",          "parameters": [            {              "type": "text",              "text": "Product 1"            }          ]        }      ]    }  ] } ```