Webhooks can be created and managed directly in Smartling through the Webhook Subscriptions List in the dashboard or via Smartling’s Webhooks API. This article provides instructions for creating and managing webhooks programmatically using the Smartling API.
Creating a webhook subscription via API
Step 1: Authentication
You will need to create a Smartling API token in order to obtain a user identifier and user secret for authentication. You can create either an account-level or project-level API token. Project-level tokens only allow you to create webhooks for that specific project. If you need to create webhook subscriptions for multiple projects in your account, create an account-level API token. For step-by-step instructions, see API tokens.
Once you have created a token, authenticate using your user identifier and user secret to access the Smartling API. This request returns an access token, which should be attached to the header of all subsequent API requests. For more details, refer to the Smartling API documentation on authentication.
Step 2: Create a webhook subscription
You can create a new subscription by sending a POST request to the create subscription endpoint. Below is an example:
POST /webhooks-api/v2/accounts/{accountUid}/subscriptions
{
"subscriptionName": "SourceIssue Created Subscription",
"subscriptionUrl": "https://myurl.com/webhooks",
"description": "My subscription",
"payloadSecret": "mySuperLongAndSecurePayloadSecret",
"requestHeaders": [
{
"headerName": "CustomHeader1",
"headerValue": "HeaderValue1"
}
],
"events": [
{
"type": "sourceIssue.comment.created",
"schemaVersion": "1.0"
}
],
"projectUids": [
"111222333"
]
}By default, the new subscription will be enabled. If you would like to create the subscription but have it deactivated, you will need to disable it after it has been created.
Get available event types
You can see a list of all available event types in the Events Catalog or via the following endpoint:
GET /webhooks-api/v2/accounts/{accountUid}/available-event-typesManaging existing subscriptions
In addition to viewing, editing, enabling, or disabling webhook subscriptions via the Smartling dashboard, you can perform the same actions via API. For detailed endpoint documentation and examples, see the webhooks API documentation linked below:
- Retrieve all webhook subscriptions
- Enable webhook subscription
- Disable webhook subscription
- Edit an existing webhook subscription
View event details and attempts
You can view all delivery events for a given subscription with optional filters and pagination, as well as retrieve details of a specific webhook event.
- Retrieve webhook delivery events for a given subscription
- Retrieve details of a specific webhook event
- Retrieve all delivery attempts for a specific webhook event
Manually resend event
You can manually resend a specific event by using the following endpoint:
POST /accounts/{accountUid}/subscriptions/{subscriptionUid}/events/{eventId}/send
You can find more detailed technical documentation on Smartling webhooks in our Technical Reference.