๐Ÿ“ฑ WhatsApp Message API

A lightweight REST API for sending WhatsApp messages with PDF attachments โ€” routed through the proxy service.

๐Ÿ”— Endpoint

POST /message/route-message?port=4000

Port 4000 for Shop whatsapp number

Port 4001 for Gallery whatsapp number

All requests are routed via the main server proxy to the appropriate WhatsApp microservice.

๐Ÿงพ Request Details

Content-Type: multipart/form-data

FieldTypeRequiredDescription
numberstringโœ…Recipient phone number (e.g. 0501234567 or +972501234567)
subjectstringโœ…Determines message type (ื›ืจื˜ืกืช, ืžืจื›ื–ืช, ืงื‘ืœื”)
pdfFilefile (PDF)โœ…PDF document to send (e.g. invoice)

๐Ÿ’ฌ Node.js Example

import axios from "axios";
import FormData from "form-data";
import fs from "fs";

const form = new FormData();
form.append("number", "0501234567");
form.append("subject", "ื—ืฉื‘ื•ื ื™ืช ืžืก ืžืจื›ื–ืช");
form.append("pdfFile", fs.createReadStream("./invoice.pdf"));

axios.post("http://localhost:5000/message/route-message?port=4000", form, {
  headers: form.getHeaders(),
})
.then(res => console.log(res.data))
.catch(err => console.error("Error:", err.response?.data || err.message));

๐Ÿ’ป C# Example

using System;
using System.IO;
using System.Net.Http;
using System.Threading.Tasks;

class Program
{
    static async Task Main()
    {
        var client = new HttpClient();
        var form = new MultipartFormDataContent();
        form.Add(new StringContent("0501234567"), "number");
        form.Add(new StringContent("ื—ืฉื‘ื•ื ื™ืช ืžืก ืžืจื›ื–ืช"), "subject");
        form.Add(new StreamContent(File.OpenRead("invoice.pdf")), "pdfFile", "invoice.pdf");

        var response = await client.PostAsync("http://localhost:5000/message/route-message?port=4000", form);
        var content = await response.Content.ReadAsStringAsync();

        Console.WriteLine(content);
    }
}