# Text Messages

{% hint style="info" %}
You can only send a text message up until 24 hours after receiving a message from the user. If you have not received a message from the user within this time, you will need to start a new conversation by sending a [Template Message](../../quick-start).
{% endhint %}

{% hint style="info" %}
Specify `text` in the `type` field. A text message can be a maximum of 4096 characters long.
{% endhint %}

### Sending a text message

## Send a text message

<mark style="color:green;">`POST`</mark> `https://api.qikchat.in/v1/messages`

To send a message, use the request URL and the following body parameters.

**Request Example**

`{`

&#x20;   `"to_contact": "+918080808080",`

&#x20;   `"type": "text",`

&#x20;   `"text": {`

&#x20;       `"body": "Hey There!"`

&#x20;   `}`

`}`

#### Headers

| Name                                              | Type   | Description   |
| ------------------------------------------------- | ------ | ------------- |
| QIKCHAT-API-KEY<mark style="color:red;">\*</mark> | string | place API key |

#### Request Body

| Name                                          | Type   | Description                                       |
| --------------------------------------------- | ------ | ------------------------------------------------- |
| to\_contact<mark style="color:red;">\*</mark> | string | customer whatsapp number you want to send message |
| type<mark style="color:red;">\*</mark>        | string | text                                              |
| text<mark style="color:red;">\*</mark>        | object | contains body field                               |

{% tabs %}
{% tab title="200: OK " %}
A successful response includes a data object with an ID for the message sent.

```json
{
    "status": true,
    "message": "Messages queued successfully",
    "data": [
        {
            "id": "52JH6WmuSruAVyXvBBYemd0Ia",
            "channel": "whatsapp",
            "from": "918080808081",
            "recipient": "+918080808080",
            "credits": 0.80,
            "created_at": "2023-02-19T12:52:25.222Z",
            "status": "queued"
        }
    ]
}
```
{% endtab %}
{% endtabs %}

#### Formatting in Text Messages <a href="#formatting" id="formatting"></a>

WhatsApp allows some formatting in messages. To format all or part of a message, use these formatting symbols:

| Formatting         | Symbol                   | Example                          |
| ------------------ | ------------------------ | -------------------------------- |
| **Bold**           | Asterisk (\*)            | Dear \*Siva\*,                   |
| _Italics_          | Underscore (\_)          | Welcome to \_Pet Shop\_!         |
| ~~Strike-through~~ | Tilde (\~)               | This is \~better\~ best!         |
| `Code`             | Three backticks (\`\`\`) | \`\`\`print('Hello World')\`\`\` |

#### Sending URLs in Text Messages <a href="#urls" id="urls"></a>

By default, the mobile WhatsApp application recognizes URLs and makes them clickable. To include a URL preview, include `"preview_url": true` in the message body and make sure the URL begins with `http://` or `https://`. A hostname is required, IP addresses are not matched.

**Example:**

```json
{
    "to_contact": "+918080808080",
    "type": "text",
    "preview_url": true,
    "text": {
        "body": "You have to check out this amazing messaging service https://www.whatsapp.com/"
    }
}
```

The majority of the time when you send a URL, whether with a preview or not, the receiver of the message will see a URL that they can click on.

URL previews are only rendered after one of the following has happened:

1. The business has sent a message template to the user.
2. The user initiates a conversation with a "click to chat" link.
3. The user adds the business phone number to their address book and initiates a conversation.

If the end user did not initiate the conversation with you - you must use a [Template message ](broken-reference)instead.&#x20;
