Skip to main content

Getting started

Send your first WhatsApp message through the LUMA API in about five minutes.

Before you start​

  • A LUMA account on LUMA Elevate or LUMA Enterprise.
  • A WhatsApp number connected in the LUMA app (WhatsApp API, then My WABA).
  • An approved message template, or a customer who wrote to your number in the last 24 hours (then you may send free text). WhatsApp only lets businesses start a conversation with an approved template.
  • Credits on your account. See Plans, credits and limits.

Step 1: get your API key​

In the LUMA app, open the profile menu and choose API Key. Copy the key (lm_live_...). Keep it on your server.

Step 2: find your sender number​

The from number is your connected WhatsApp number in international format, digits only (for example 971500000000). You see it under WhatsApp API, then My WABA.

Step 3: send a template message​

curl --request POST 'https://api.itechintl.com/v1/messages' \
--header 'Authorization: Bearer lm_live_YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"from": "971500000000",
"to": "971500000001",
"type": "template",
"template": {
"name": "hello_world",
"lang_code": "en_US"
}
}'

Step 4: read the answer​

LUMA accepts the message and queues it for WhatsApp:

{
"message": "Message queued successfully.",
"data": [
{
"message_id": "MESSAGE_ID",
"status": "queued",
"to": "971500000001"
}
]
}

HTTP status 202 Accepted means LUMA took the message. Whether WhatsApp delivered it arrives later on your webhook as sent, delivered, read or failed.

Step 5: receive delivery statuses​

Create a webhook in the LUMA app (Technical, then Webhook), subscribe to Delivery status and Incoming message, and set a secret. See Webhooks.

The same call in other languages​

Node.js​

const res = await fetch("https://api.itechintl.com/v1/messages", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.LUMA_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
from: "971500000000",
to: "971500000001",
type: "template",
template: { name: "hello_world", lang_code: "en_US" },
}),
});
console.log(res.status, await res.json());

Python​

import os, requests

res = requests.post(
"https://api.itechintl.com/v1/messages",
headers={"Authorization": f"Bearer {os.environ['LUMA_API_KEY']}"},
json={
"from": "971500000000",
"to": "971500000001",
"type": "template",
"template": {"name": "hello_world", "lang_code": "en_US"},
},
timeout=30,
)
print(res.status_code, res.json())

C# (.NET)​

using System.Net.Http.Json;

public class LumaClient
{
private readonly HttpClient _http = new() { BaseAddress = new Uri("https://api.itechintl.com") };

public LumaClient(string apiKey) =>
_http.DefaultRequestHeaders.Authorization = new("Bearer", apiKey);

public async Task<string> SendTemplateAsync(string from, string to, string template, string lang)
{
var res = await _http.PostAsJsonAsync("/v1/messages", new
{
from, to, type = "template",
template = new { name = template, lang_code = lang }
});
return $"{(int)res.StatusCode} {await res.Content.ReadAsStringAsync()}";
}
}

// var luma = new LumaClient(Environment.GetEnvironmentVariable("LUMA_API_KEY")!);
// Console.WriteLine(await luma.SendTemplateAsync("971500000000", "971500000001", "hello_world", "en_US"));

PHP​

<?php
$ch = curl_init('https://api.itechintl.com/v1/messages');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('LUMA_API_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'from' => '971500000000',
'to' => '971500000001',
'type' => 'template',
'template' => ['name' => 'hello_world', 'lang_code' => 'en_US'],
]),
]);
echo curl_exec($ch);

Next steps​