# Add audio to website articles

> Give every article of a site a spoken version with the WordPress plugin or the Article to Speech callback API, and handle callbacks, retries and updates correctly.

## Choose the route

- **WordPress site**: install the Moknah plugin, paste the company API key, and choose voices per post. No code.
- **Any other site or CMS**: call the [Article to Speech API](../api/article-to-speech.md) from your server.

Both need a Moknah company with the Article to Speech service. Request company access in the dashboard.

## With the API

| Step | Do | Check |
| --- | --- | --- |
| 1 | Get the company API key and note its voice type. | |
| 2 | `POST /api/v1/voices/` with that key and choose a voice. | The voice's `voice_engine` equals the key's voice type. |
| 3 | Build a callback endpoint on your server that accepts a JSON `POST`. | It answers `200` to a test request. |
| 4 | When an article is published, `POST https://api.moknah.io/process-text` with the text and `postData` (`name`, `articleId`, `voiceId`, `callbackURL`). | The response is `202`. |
| 5 | In the callback, verify `response.signature`, then check that `audioFile` and `srtFile` are not null. | The signature matches and both URLs are present. |
| 6 | Store the two URLs with the article and show a player. Use the SRT file to highlight words while playing. | The article plays on the site. |

## Rules that keep it correct

- Use a stable `articleId`, such as the post id. It is the idempotency key.
- Sending the same `articleId` again without `regenerate` delivers the existing audio again and costs nothing. To voice changed text, send it with `regenerate` set to true.
- A callback with a null `audioFile` or `srtFile` is a failure. Do not mark the article as done; send it again with `regenerate` true.
- `409 ALREADY_PROCESSING` means the article is still being generated. Wait for the callback instead of resending.
- Submit a backlog of articles freely: all are accepted and generated a few at a time. Stay under the request rate in [Limits](../limits/index.md) to avoid `429`.
- For Arabic sites, `preprocessType` `2` adds diacritics and spells out numbers, at a higher price per character. With `language` `auto` it is applied only to Arabic text.

## Updating a published article

Open the article in **Article Studio** in the dashboard, edit the transcript or change the voice, regenerate, and press **Update Live** to send the new version to your site's callback.

## Cost

Per character of article text. See [Pricing](../pricing/index.md).
