lokalise-webhooks-events
Implement Lokalise webhook handling and event processing. Use when setting up webhook endpoints, handling translation events, or building automation based on Lokalise notifications. Trigger with phrases like "lokalise webhook", "lokalise events", "lokalise notifications", "handle lokalise events", "lokalise automation".
What this skill does
# Lokalise Webhooks Events
## Overview
Lokalise webhooks push real-time notifications to your endpoint when translation events occur — keys created, translations updated, files uploaded, contributors added. This skill covers creating webhooks via the API, handling each event type, verifying webhook secrets, and routing events to appropriate handlers.
## Prerequisites
- Lokalise project with admin or manager role (required for webhook creation)
- HTTPS endpoint accessible from the internet (Lokalise rejects HTTP URLs)
- Express.js or equivalent HTTP framework
- Webhook secret for payload verification (generated during webhook creation)
## Instructions
### 1. Create a Webhook via the API
Register your endpoint with Lokalise using `POST /projects/{project_id}/webhooks`:
```bash
curl -X POST "https://api.lokalise.com/api2/projects/${PROJECT_ID}/webhooks" \
-H "X-Api-Token: ${LOKALISE_API_TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"url": "https://your-app.example.com/webhooks/lokalise",
"branch": "main",
"events": [
"project.key.added",
"project.key.modified",
"project.translation.updated",
"project.translation.proofread",
"project.imported",
"project.exported",
"project.contributor.added",
"project.contributor.deleted"
],
"event_lang_map": [
{"event": "project.translation.updated", "lang_iso_codes": ["en", "fr", "de"]}
]
}'
```
The response includes a `secret` field — store this securely. You need it to verify incoming payloads.
To scope webhooks to specific languages, use `event_lang_map`. This prevents noise from languages you do not manage.
### 2. Know the Event Types
| Event | Fires When | Key Payload Fields |
|-------|-----------|-------------------|
| `project.key.added` | New key created | `key.key_id`, `key.key_name`, `key.platforms` |
| `project.key.modified` | Key name, tags, or metadata changed | `key.key_id`, `key.key_name`, `key.modifications` |
| `project.key.deleted` | Key removed | `key.key_id`, `key.key_name` |
| `project.key.comment.added` | Comment added to a key | `key.key_id`, `comment.comment` |
| `project.translation.updated` | Translation value changed | `translation.translation_id`, `translation.value`, `language.lang_iso` |
| `project.translation.proofread` | Translation marked as reviewed | `translation.translation_id`, `language.lang_iso` |
| `project.imported` | File uploaded to project | `import.filename`, `import.format` |
| `project.exported` | File downloaded/exported | `export.filename` |
| `project.contributor.added` | New team member added | `contributor.email`, `contributor.role` |
| `project.contributor.deleted` | Team member removed | `contributor.email` |
### 3. Understand the Webhook Payload Structure
Every webhook POST delivers this structure:
```json
{
"event": "project.translation.updated",
"project": {
"id": "123456789.abcdefgh",
"name": "My Project"
},
"user": {
"email": "[email protected]",
"full_name": "Jane Translator"
},
"language": {
"lang_id": 640,
"lang_iso": "fr",
"lang_name": "French"
},
"translation": {
"translation_id": 98765,
"key_id": 11223,
"value": "Bonjour le monde",
"is_reviewed": false,
"modified_at": "2026-03-19T10:30:00Z"
},
"created_at": "2026-03-19T10:30:01Z"
}
```
The top-level `event` field determines which nested objects are present. Always check `event` first before accessing nested fields.
### 4. Build an Express Handler with Secret Verification
Lokalise signs webhook payloads with the secret from step 1. Verify it using the `x-secret` header:
```typescript
import express from "express";
import type { Request, Response, NextFunction } from "express";
const app = express();
const WEBHOOK_SECRET = process.env.LOKALISE_WEBHOOK_SECRET!;
// Parse raw body for signature verification
app.use("/webhooks/lokalise", express.json());
// Verify webhook secret
function verifyLokaliseSecret(
req: Request,
res: Response,
next: NextFunction
): void {
const secret = req.headers["x-secret"] as string;
if (!secret || secret !== WEBHOOK_SECRET) {
console.error("Webhook signature verification failed");
res.status(401).json({ error: "Invalid webhook secret" });
return;
}
next();
}
app.post(
"/webhooks/lokalise",
verifyLokaliseSecret,
async (req: Request, res: Response) => {
// Respond immediately — Lokalise times out after 8 seconds
res.status(200).json({ received: true });
// Process asynchronously
try {
await routeEvent(req.body);
} catch (error) {
console.error("Webhook processing failed:", error);
}
}
);
```
Responding with 200 before processing is critical. Lokalise retries on timeout (8s) and treats non-2xx as failure. Process the event asynchronously to avoid timeouts.
### 5. Route Events by Type
```typescript
interface LokaliseWebhookPayload {
event: string;
project: { id: string; name: string };
user: { email: string; full_name: string };
language?: { lang_iso: string; lang_name: string };
key?: { key_id: number; key_name: string; platforms: string[] };
translation?: {
translation_id: number;
value: string;
is_reviewed: boolean;
};
import?: { filename: string; format: string };
contributor?: { email: string; role: string };
created_at: string;
}
type EventHandler = (payload: LokaliseWebhookPayload) => Promise<void>;
const eventHandlers: Record<string, EventHandler> = {
"project.key.added": async (payload) => {
console.log(`New key: ${payload.key!.key_name}`);
// Notify translators, update local cache, trigger CI
},
"project.translation.updated": async (payload) => {
const { translation, language } = payload;
console.log(
`Translation updated [${language!.lang_iso}]: ${translation!.value}`
);
// Trigger rebuild, invalidate CDN cache, update OTA bundle
},
"project.imported": async (payload) => {
console.log(`File imported: ${payload.import!.filename}`);
// Kick off translation memory update, notify reviewers
},
"project.contributor.added": async (payload) => {
console.log(`New contributor: ${payload.contributor!.email}`);
// Send onboarding info, assign default language pairs
},
};
async function routeEvent(payload: LokaliseWebhookPayload): Promise<void> {
const handler = eventHandlers[payload.event];
if (handler) {
await handler(payload);
} else {
console.log(`Unhandled event type: ${payload.event}`);
}
}
```
### 6. Implement Idempotency
Lokalise may retry webhooks on network failure, sending duplicates. Track processed events:
```typescript
const processedEvents = new Set<string>();
async function routeEventIdempotent(
payload: LokaliseWebhookPayload
): Promise<void> {
// Create a unique key from event + timestamp + relevant IDs
const eventKey = `${payload.event}:${payload.created_at}:` +
`${payload.translation?.translation_id ?? payload.key?.key_id ?? ""}`;
if (processedEvents.has(eventKey)) {
console.log(`Duplicate event skipped: ${eventKey}`);
return;
}
processedEvents.add(eventKey);
// For production: use Redis SET with TTL instead of in-memory Set
// await redis.set(`webhook:${eventKey}`, "1", "EX", 86400);
await routeEvent(payload);
}
```
## Output
- Webhook registered in Lokalise project with selected event subscriptions
- Express endpoint verifying `x-secret` header on every request
- Event router dispatching to type-specific handlers
- Idempotency guard preventing duplicate processing
- Immediate 200 response with async background processing
## Error Handling
| Issue | Cause | Solution |
|-------|-------|----------|
| Invalid signature | Wrong secret or secret rotated | Re-check `LOKALISE_WEBHOOK_SECRET` against Lokalise project settings |
| Timeout (8 seconds) | Synchronous processing too slow | Respond 200 immediately, process in background |
| Duplicate events | LoRelated in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.