Skip to content

Latest commit

 

History

History
103 lines (88 loc) · 2.2 KB

webhooks.md

File metadata and controls

103 lines (88 loc) · 2.2 KB

Webhooks API

List all webhooks

https://app.lokalise.com/api2docs/curl/#transition-list-all-webhooks-get

$response = $client->webhooks->list(
    $projectId,
    [
        'limit' => 20,
        'page' => 1,
    ]
);
$response = $client->webhooks->fetchAll(
    $projectId 
);

Create a webhook

https://app.lokalise.com/api2docs/curl/#transition-create-a-webhook-post

$response = $client->webhooks->create(
    $projectId,
    [
        'url' => 'https://my.domain.com/webhook',
        'events' => [
            'project.translation.proofread',
            'project.translation.updated',
        ],
        'event_lang_map' => [
            [
                'event' => 'project.translation.updated',
                'lang_iso_codes' => [
                    'en_GB',
                ],
            ],
        ],
    ]
);

Retrieve a webhook

https://app.lokalise.com/api2docs/curl/#transition-retrieve-a-webhook-get

$response = $client->webhooks->retrieve($projectId, $webhookId);

Update a webhook

https://app.lokalise.com/api2docs/curl/#transition-update-a-webhook-put

$response = $client->webhooks->update(
    $projectId,
    $webhookId,
    [
        'events' => [
            'project.translation.proofread',
            'project.translation.updated',
            'project.imported',
        ],
        'event_lang_map' => [
            [
                'event' => 'project.translation.proofread',
                'lang_iso_codes' => [
                    'en_GB',
                ],
            ],
            [
                'event' => 'project.translation.updated',
                'lang_iso_codes' => [
                    'en_GB'
                ],
            ],
        ],
    ]
);

Delete a webhook

https://app.lokalise.com/api2docs/curl/#transition-delete-a-webhook-delete

$response = $client->webhooks->delete($projectId, $webhookId);

Regenerate a webhook secret

https://app.lokalise.com/api2docs/curl/#transition-regenerate-a-webhook-secret-patch

$response = $client->webhooks->regenerateSecret($projectId, $webhookId);