Sign inGet Started

Upsert a language's content

PUT
/v1/whatsapp/templates/{template_ref}/versions/{version_id}/languages/{language}
const saved = await bird.whatsapp.templates.versions.languages.set(
  "order_update",
  "wav_01krdgeqcxet5s7t44vh8rt9mg",
  "es",
  {
    components: [
      {
        type: "body",
        text: "Tu pedido {{order_id}} ya fue enviado.",
        example_parameters: [{ type: "text", name: "order_id", text: "A-4192" }],
      },
    ],
  },
);
console.log(saved.language, saved.revision);
प्रतिक्रिया200
{
  "language": "pt-BR",
  "revision": 4,
  "content_hash": "sha256:9f2c4e1a7b03d85fbc6e29d417a05e8c3b1d9f76a2e4c018d53b7f9a6c2e18d4"
}

Writes one language of the template's draft, creating it when absent (201) and replacing it when present (200). A full replacement, so send the language's complete content every time. Only the draft is writable: submitted versions are immutable, and a language under active review at Meta refuses the write until that review finishes. Pass revision to make the write a compare-and-set against the copy you read. Tags are canonicalised, and the response echoes the canonical form: use it in later calls for this language.

पैरामीटर

template_refstring

Template ID (wat_ prefix) or slug. A value that parses as a valid ID resolves by ID; any other value resolves as a slug.

version_idstring

ID of the template version (wav_ prefix), as returned by the version list.

languagestring

The language, as a BCP-47 tag. Case and separator variance is accepted and normalised, and the canonical form is returned.

Request Payload

components
array of object

The template's content blocks for this language. Header, footer and buttons are optional. Every variable needs an example value, which is what Meta reviews against. May be omitted or empty on a draft; a body block is required before the language can be submitted.

चाइल्ड पैरामीटर दिखाएँ
revision
integer

The revision you last read for this language, making the write a compare-and-set: a mismatch is refused with a conflict, leaving an edit you have not seen in place. Omit it for last-write-wins, which is what a single writer wants. Supplying it for a language that does not exist is also refused with a conflict rather than recreating the language. Inside a template's initial languages seed on create, a value here is refused, since no prior revision exists yet to compare against.

Response Payload

language
string
आवश्यक

The canonical form of the tag you addressed. Use it in later calls for this language.

revision
integer
आवश्यक

The language's new revision, to pass back on your next write.

content_hash
string
आवश्यक

A hash over the content as saved, so you can tell whether your next write would change anything without diffing the document.

updated_at
string
आवश्यक

When this language was last written.

इस विषय के लिए दस्तावेज़, गाइड और उदाहरणों के साथ आगे बढ़ें।