Back to Developer Help
4

Receive Messages (Webhooks)

Register a webhook URL to receive incoming SMS messages and delivery status updates.

You can also create and manage webhooks from the Settings panel. Go to Settings → Webhooks to configure URLs, events, and phone filters visually.

Endpoint

POST /api/v1/webhooks Requires authentication (X-API-Key)

Request Body

Field Type
url string (HTTPS URL to receive webhook payloads)
events array (e.g. ['message.received', 'message.delivered'])

Common Error Responses

400 VALIDATION_ERROR

Invalid URL or events array.

Code Samples

curl -X POST https://api.palmtext.com/api/v1/webhooks \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"url": "https://yourapp.com/webhook/sms", "events": ["message.received"]}'
import requests

resp = requests.post(
    'https://api.palmtext.com/api/v1/webhooks',
    headers={'X-API-Key': 'YOUR_API_KEY'},
    json={'url': 'https://yourapp.com/webhook/sms', 'events': ['message.received']}
)
print(resp.json())
const res = await fetch('https://api.palmtext.com/api/v1/webhooks', {
  method: 'POST',
  headers: { 'X-API-Key': 'YOUR_API_KEY', 'Content-Type': 'application/json' },
  body: JSON.stringify({ url: 'https://yourapp.com/webhook/sms', events: ['message.received'] })
});
const data = await res.json();
<?php
$ch = curl_init();
curl_setopt_array($ch, [
  CURLOPT_URL => 'https://api.palmtext.com/api/v1/webhooks',
  CURLOPT_POST => true,
  CURLOPT_HTTPHEADER => ['X-API-Key: YOUR_API_KEY', 'Content-Type: application/json'],
  CURLOPT_POSTFIELDS => json_encode([
    'url' => 'https://yourapp.com/webhook/sms',
    'events' => ['message.received']
  ]),
  CURLOPT_RETURNTRANSFER => true,
]);
$resp = curl_exec($ch);
echo $resp;
curl_close($ch);
package main

import (
  "bytes"
  "encoding/json"
  "fmt"
  "net/http"
)

func main() {
  body, _ := json.Marshal(map[string]interface{}{
    "url": "https://yourapp.com/webhook/sms",
    "events": []string{"message.received"},
  })
  req, _ := http.NewRequest("POST",
    "https://api.palmtext.com/api/v1/webhooks", bytes.NewBuffer(body))
  req.Header.Set("X-API-Key", "YOUR_API_KEY")
  req.Header.Set("Content-Type", "application/json")
  resp, _ := http.DefaultClient.Do(req)
  defer resp.Body.Close()
  fmt.Println(resp.Status)
}