What changes when you upgrade @routa-chat/sdk, from 0.2.0 to 0.5.0: what stops working or compiling and how to migrate.
The SDK is 0.x. A change to a public type ships as a minor version. Nothing was removed or renamed in 0.3.0. The full list is in the CHANGELOG.
From 0.4.0 to 0.5.0
0.5.0 adds the examples of template variables and the header and button parameters of a send. The new fields are optional in the types.
The API requires an example for each variable of a template. A version earlier than 0.5.0 does not have the field and drops a value passed anyway, so templates.submit() of a template with a variable gets 422 template_variables_invalid. Upgrade the SDK and send the examples.
await routa.templates.submit({ channel: 'chan_...', name: 'order_shipped', language: 'en_US', category: 'utility', bodyText: 'Your order {{1}} has shipped.', variableExamples: ['1234'], // new, one per body variable})
What is new
Examples.variableExamples in templates.submit() and example on the text header and on the URL button.
Template send.headerParameter and buttonParameters in messages.send().
Reading.header_parameter and button_parameters in the content of a message, and example in template.variables, on the text header and on the URL button.
New exported types.SendMessageTemplateHeaderParameter, SendMessageTemplateButtonParameter, MessageTemplateHeaderParameter and MessageTemplateButtonParameter.
From 0.3.0 to 0.4.0
The experimental Partner API gains partner.webhook.constructEvent(), which verifies an organization webhook delivery without a Routa instance.
TemplateStatus has a new member, 'failed'. Routa could not send the template to the provider. A switch on the status that ends in a never check needs the new case. failureCode and failureDetail say why.EventType goes from 13 to 17 members.template.failed, template.category_changed, template.updated and template.deleted are new, and RoutaEvent has a member for each. An exhaustive switch (event.type) needs to handle them. See Webhooks.New required fields in the types you read. Reading a Template, a Message or an event works as before. Code that builds one of these values, such as test data or a mock of the SDK, stops compiling until it provides the fields:
Type
New fields
Template
bodyText (string | null), failureCode, failureDetail, deletionRequested, deletionFailureDetail, origin, readOnly and unsupportedComponents. components is optional and absent on a body-only template.
Message
origin ('api', 'business_app' or null on an inbound message) and failureCode.
Every known event
externalRef, the external_ref of the project or null.
RoutaApiError gains type and details.ErrorEnvelope and RoutaApiErrorDetails accept them, and both are optional: a response from a proxy has neither.402 and 409 have their own classes.RoutaBillingError (with limit, used and resetsAt) and RoutaConflictError (with reason) extend RoutaApiError. A catch on RoutaApiError keeps working. Only code that compared error.constructor === RoutaApiError for those statuses notices the difference. The retry policy does not change: a 402 is never retried, and a 409 only when it is idempotency_in_progress. See Error handling.HttpResponse has status. Whoever implements the internal HttpClient interface, such as a transport test double, must return status from requestWithHeaders(). The interface is not exported, so code that only calls routa.* is not affected.new Routa('rt_partner_...') throws. A partner key is only accepted by the partner routes, so a Routa built with one answered 401 to every call. Nothing that worked was affected. Use RoutaPartner.
How to migrate
import { RoutaBillingError } from '@routa-chat/sdk'import type { Template } from '@routa-chat/sdk'// 1. Handle the new status.function report(template: Template) { switch (template.status) { // ...the cases you already have... case 'failed': console.error(template.failureCode, template.failureDetail) break } // 2. `components` can be absent: guard the read. if (template.components?.buttons) { console.log(template.components.buttons.length) }}// 3. Tell a billing error apart.try { await routa.messages.send(params)} catch (error) { if (!(error instanceof RoutaBillingError)) throw error // The free allowance or the plan allowance is used up. Stop sending. console.error(error.code, error.used, error.limit)}
What is new
Media.routa.media.upload() stores a file, from bytes or from a URL. If you called POST /v1/media directly, you can migrate.
Templates with components.templates.submit() accepts components, with header, footer and up to 10 buttons. templates.uploadMedia() uploads the file of a media header.
New fields.Template (bodyText, components and the others), Message (origin, failureCode) and the events (externalRef).
New exported types.MessageOrigin, TemplateFailureCode, TemplateOrigin, TemplateUnsupportedComponent, TemplateComponents, TemplateHeader, TemplateFooter, TemplateButton, TemplateHeaderMediaFormat and RoutaErrorDetailValues, plus TemplateMediaId, TemplateMedia and the *Input types of the components. See Types and IDs.
Partner API.RoutaPartner, in @routa-chat/sdk/partner. Experimental.
From 0.1.0 to 0.2.0
Message['content'] became MessageContent | null, and Message gained contentRedactedAt: string | null.Routa removes the content of a message after the retention period of your plan and returns content: null with content_redacted_at. On 0.1.0, messages.retrieve() and messages.list() threw TypeError: Cannot read properties of null when they met one of those messages, and a single one broke the whole listing. Now they are returned with the rest of the message intact.This is a type change, so code that reads message.content without checking stops compiling. Guard the read:
if (message.content) { console.log(message.content.type)}
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Routa","description":"Documentação oficial da Routa: infraestrutura de mensageria para WhatsApp com uma API REST simples, SDK oficial e webhooks confiáveis.","colors":{"primary":"#5B3FD9","light":"#8B72F2","dark":"#5B3FD9"},"logo":{"light":"https://mintcdn.com/routa/ag603HEZUqTlzO0m/logo/light.svg?fit=max\u0026auto=format\u0026n=ag603HEZUqTlzO0m\u0026q=85\u0026s=6caea08d96f076dfed53bf350bae202a","dark":"https://mintcdn.com/routa/ag603HEZUqTlzO0m/logo/dark.svg?fit=max\u0026auto=format\u0026n=ag603HEZUqTlzO0m\u0026q=85\u0026s=e8bbd6d1b776d73cf8d48bf0a09ac541","href":"https://routa.chat"},"favicon":"https://mintcdn.com/routa/ag603HEZUqTlzO0m/favicon.svg?fit=max\u0026auto=format\u0026n=ag603HEZUqTlzO0m\u0026q=85\u0026s=95ead90699526fb53153a0fc79e8858e","api":{"playground":{"display":"interactive"},"examples":{"defaults":"required","languages":["bash","javascript","python","php","go"]}},"footer":{"socials":{"github":"https://github.com/routa-chat"}},"contextual":{"options":["copy","view","chatgpt","claude","perplexity","mcp","cursor","vscode"],"display":"header"},"styling":{"latex":false},"navigation":{"languages":[{"language":"pt-BR","default":true,"navbar":{"links":[{"href":"mailto:[email protected]","label":"Suporte"}],"primary":{"type":"button","label":"Abrir o painel","href":"https://app.routa.chat"}},"href":""},{"language":"en","navbar":{"links":[{"href":"mailto:[email protected]","label":"Support"}],"primary":{"type":"button","label":"Open dashboard","href":"https://app.routa.chat"}},"href":"en"}]}},"deployment":{"deploymentMetadataValue":{"subdomain":"routa","hasAudioNarration":false,"actualSubdomain":"routa","customDomains":["docs.routa.chat"],"gitSource":{"type":"github","owner":"routa-chat","repo":"documentation","deployBranch":"main","contentDirectory":"","isPrivate":false,"mountPath":"","label":""},"entitlements":{"AI_CHAT":{"status":"DISABLED"},"WEB_MCP":{"status":"DISABLED"},"NARRATION":{"status":"DISABLED"}},"buildId":"6b0cdc9e6b52207771a7e111","clientVersion":"0.0.4377","searchFilterCounts":[{"language":"pt-BR","tag":"Referência da API","count":37},{"language":"en","tag":"API reference","count":37},{"language":"pt-BR","tag":"Documentação","count":31},{"language":"en","tag":"Documentation","count":31},{"language":"pt-BR","tag":"Parceiros","count":18},{"language":"en","tag":"Partners","count":18},{"language":"pt-BR","tag":"Webhooks","count":15},{"language":"en","tag":"Webhooks","count":15},{"language":"pt-BR","tag":"SDK Node.js","count":12},{"language":"en","tag":"Node.js SDK","count":12},{"language":"pt-BR","tag":"Projetos","count":8},{"language":"en","tag":"Projects","count":8},{"language":"pt-BR","tag":"Guias","count":7},{"language":"pt-BR","tag":"Recursos","count":7},{"language":"en","tag":"Guides","count":7},{"language":"en","tag":"Resources","count":7},{"language":"pt-BR","tag":"Comece aqui","count":6},{"language":"en","tag":"Get started","count":6},{"language":"pt-BR","tag":"Conceitos","count":5},{"language":"en","tag":"Concepts","count":5}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"treatment","enabled":true,"payload":{"type":"string","value":"treatment"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"starterQuestions":[],"googleFontsInlined":false},"customCss":[]}
{"page":{"pagePath":"en/sdk/upgrading","slug":"/en/sdk/upgrading","pageMetadata":{"title":"Upgrade the SDK","description":"What changes when you upgrade @routa-chat/sdk, from 0.2.0 to 0.5.0: what stops working or compiling and how to migrate.","href":"/en/sdk/upgrading"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"What changes when you upgrade @routa-chat/sdk, from 0.2.0 to 0.5.0: what stops working or compiling and how to migrate.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,em:`em`,li:`li`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Table,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`The SDK is 0.x. A change to a public type ships as a minor version. Nothing was removed or renamed in 0.3.0. The full list is in the `,_jsx(_components.a,{href:`https://github.com/routa-chat/routa-nodejs-sdk/blob/master/CHANGELOG.md`,children:`CHANGELOG`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`from-0-4-0-to-0-5-0`,children:`From 0.4.0 to 0.5.0`}),`\n`,_jsx(_components.p,{children:`0.5.0 adds the examples of template variables and the header and button parameters of a send. The new fields are optional in the types.`}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[`The API requires an example for each variable of a template. A version earlier than 0.5.0 does not have the field and drops a value passed anyway, so `,_jsx(_components.code,{children:`templates.submit()`}),` of a template with a variable gets `,_jsx(_components.code,{children:`422 template_variables_invalid`}),`. Upgrade the SDK and send the examples.`]})}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`8`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`8`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` routa`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`templates`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`submit`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` channel:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'chan_...'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` name:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'order_shipped'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` language:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'en_US'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` category:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'utility'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` bodyText:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'Your order {{1}} has shipped.'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` variableExamples:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'1234'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`], `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// new, one per body variable`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`})`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`what-is-new`,children:`What is new`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Examples.`}),` `,_jsx(_components.code,{children:`variableExamples`}),` in `,_jsx(_components.a,{href:`/en/sdk/templates#variables-and-examples`,children:_jsx(_components.code,{children:`templates.submit()`})}),` and `,_jsx(_components.code,{children:`example`}),` on the text header and on the URL button.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Template send.`}),` `,_jsx(_components.code,{children:`headerParameter`}),` and `,_jsx(_components.code,{children:`buttonParameters`}),` in `,_jsx(_components.a,{href:`/en/sdk/messages#send-a-template`,children:_jsx(_components.code,{children:`messages.send()`})}),`.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Reading.`}),` `,_jsx(_components.code,{children:`header_parameter`}),` and `,_jsx(_components.code,{children:`button_parameters`}),` in the content of a message, and `,_jsx(_components.code,{children:`example`}),` in `,_jsx(_components.code,{children:`template.variables`}),`, on the text header and on the URL button.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`New exported types.`}),` `,_jsx(_components.code,{children:`SendMessageTemplateHeaderParameter`}),`, `,_jsx(_components.code,{children:`SendMessageTemplateButtonParameter`}),`, `,_jsx(_components.code,{children:`MessageTemplateHeaderParameter`}),` and `,_jsx(_components.code,{children:`MessageTemplateButtonParameter`}),`.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`from-0-3-0-to-0-4-0`,children:`From 0.3.0 to 0.4.0`}),`\n`,_jsxs(_components.p,{children:[`The experimental `,_jsx(_components.a,{href:`/en/sdk/partner#receive-the-events-of-every-customer`,children:`Partner API`}),` gains `,_jsx(_components.code,{children:`partner.webhook.constructEvent()`}),`, which verifies an organization webhook delivery without a `,_jsx(_components.code,{children:`Routa`}),` instance.`]}),`\n`,_jsx(Heading,{level:`2`,id:`from-0-2-0-to-0-3-0`,children:`From 0.2.0 to 0.3.0`}),`\n`,_jsxs(_components.p,{children:[`0.3.0 aligns the SDK types with the current API contract and brings three new resources: `,_jsx(_components.a,{href:`/en/sdk/media`,children:_jsx(_components.code,{children:`media.upload()`})}),`, `,_jsxs(_components.a,{href:`/en/sdk/templates`,children:[_jsx(_components.code,{children:`components`}),` and `,_jsx(_components.code,{children:`templates.uploadMedia()`})]}),` and the `,_jsx(_components.a,{href:`/en/sdk/partner`,children:`Partner API`}),`, which is experimental.`]}),`\n`,_jsx(Heading,{level:`3`,id:`what-can-stop-compiling`,children:`What can stop compiling`}),`\n`,_jsxs(_components.p,{children:[_jsxs(_components.strong,{children:[_jsx(_components.code,{children:`TemplateStatus`}),` has a new member, `,_jsx(_components.code,{children:`'failed'`}),`.`]}),` Routa could not send the template to the provider. A `,_jsx(_components.code,{children:`switch`}),` on the status that ends in a `,_jsx(_components.code,{children:`never`}),` check needs the new case. `,_jsx(_components.code,{children:`failureCode`}),` and `,_jsx(_components.code,{children:`failureDetail`}),` say why.`]}),`\n`,_jsxs(_components.p,{children:[_jsxs(_components.strong,{children:[_jsx(_components.code,{children:`EventType`}),` goes from 13 to 17 members.`]}),` `,_jsx(_components.code,{children:`template.failed`}),`, `,_jsx(_components.code,{children:`template.category_changed`}),`, `,_jsx(_components.code,{children:`template.updated`}),` and `,_jsx(_components.code,{children:`template.deleted`}),` are new, and `,_jsx(_components.code,{children:`RoutaEvent`}),` has a member for each. An exhaustive `,_jsx(_components.code,{children:`switch (event.type)`}),` needs to handle them. See `,_jsx(_components.a,{href:`/en/sdk/webhooks#event-types`,children:`Webhooks`}),`.`]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`New required fields in the types you read.`}),` Reading a `,_jsx(_components.code,{children:`Template`}),`, a `,_jsx(_components.code,{children:`Message`}),` or an event works as before. Code that `,_jsx(_components.strong,{children:`builds`}),` one of these values, such as test data or a `,_jsx(_components.em,{children:`mock`}),` of the SDK, stops compiling until it provides the fields:`]}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Type`}),_jsx(_components.th,{children:`New fields`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`Template`})}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`bodyText`}),` (`,_jsx(_components.code,{children:`string | null`}),`), `,_jsx(_components.code,{children:`failureCode`}),`, `,_jsx(_components.code,{children:`failureDetail`}),`, `,_jsx(_components.code,{children:`deletionRequested`}),`, `,_jsx(_components.code,{children:`deletionFailureDetail`}),`, `,_jsx(_components.code,{children:`origin`}),`, `,_jsx(_components.code,{children:`readOnly`}),` and `,_jsx(_components.code,{children:`unsupportedComponents`}),`. `,_jsx(_components.code,{children:`components`}),` is optional and absent on a body-only template.`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`Message`})}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`origin`}),` (`,_jsx(_components.code,{children:`'api'`}),`, `,_jsx(_components.code,{children:`'business_app'`}),` or `,_jsx(_components.code,{children:`null`}),` on an inbound message) and `,_jsx(_components.code,{children:`failureCode`}),`.`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Every known event`}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`externalRef`}),`, the `,_jsx(_components.code,{children:`external_ref`}),` of the project or `,_jsx(_components.code,{children:`null`}),`.`]})]})]})]}),`\n`,_jsxs(_components.p,{children:[_jsxs(_components.strong,{children:[_jsx(_components.code,{children:`RoutaApiError`}),` gains `,_jsx(_components.code,{children:`type`}),` and `,_jsx(_components.code,{children:`details`}),`.`]}),` `,_jsx(_components.code,{children:`ErrorEnvelope`}),` and `,_jsx(_components.code,{children:`RoutaApiErrorDetails`}),` accept them, and both are optional: a response from a proxy has neither.`]}),`\n`,_jsxs(_components.p,{children:[_jsxs(_components.strong,{children:[_jsx(_components.code,{children:`402`}),` and `,_jsx(_components.code,{children:`409`}),` have their own classes.`]}),` `,_jsx(_components.code,{children:`RoutaBillingError`}),` (with `,_jsx(_components.code,{children:`limit`}),`, `,_jsx(_components.code,{children:`used`}),` and `,_jsx(_components.code,{children:`resetsAt`}),`) and `,_jsx(_components.code,{children:`RoutaConflictError`}),` (with `,_jsx(_components.code,{children:`reason`}),`) extend `,_jsx(_components.code,{children:`RoutaApiError`}),`. A `,_jsx(_components.code,{children:`catch`}),` on `,_jsx(_components.code,{children:`RoutaApiError`}),` keeps working. Only code that compared `,_jsx(_components.code,{children:`error.constructor === RoutaApiError`}),` for those statuses notices the difference. The retry policy does not change: a `,_jsx(_components.code,{children:`402`}),` is never retried, and a `,_jsx(_components.code,{children:`409`}),` only when it is `,_jsx(_components.code,{children:`idempotency_in_progress`}),`. See `,_jsx(_components.a,{href:`/en/sdk/error-handling`,children:`Error handling`}),`.`]}),`\n`,_jsxs(_components.p,{children:[_jsxs(_components.strong,{children:[_jsx(_components.code,{children:`HttpResponse`}),` has `,_jsx(_components.code,{children:`status`}),`.`]}),` Whoever implements the internal `,_jsx(_components.code,{children:`HttpClient`}),` interface, such as a transport `,_jsx(_components.em,{children:`test double`}),`, must return `,_jsx(_components.code,{children:`status`}),` from `,_jsx(_components.code,{children:`requestWithHeaders()`}),`. The interface is not exported, so code that only calls `,_jsx(_components.code,{children:`routa.*`}),` is not affected.`]}),`\n`,_jsxs(_components.p,{children:[_jsxs(_components.strong,{children:[_jsx(_components.code,{children:`new Routa('rt_partner_...')`}),` throws.`]}),` A partner key is only accepted by the partner routes, so a `,_jsx(_components.code,{children:`Routa`}),` built with one answered `,_jsx(_components.code,{children:`401`}),` to every call. Nothing that worked was affected. Use `,_jsx(_components.a,{href:`/en/sdk/partner`,children:_jsx(_components.code,{children:`RoutaPartner`})}),`.`]}),`\n`,_jsx(Heading,{level:`3`,id:`how-to-migrate`,children:`How to migrate`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`27`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`27`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`RoutaBillingError`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '@routa-chat/sdk'`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` type`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`Template`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '@routa-chat/sdk'`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// 1. Handle the new status.`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`function`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` report`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`template`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` Template`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` switch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`template`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`status`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // ...the cases you already have...`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` case`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'failed'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`template`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`failureCode`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`template`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`failureDetail`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` break`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:\" // 2. `components` can be absent: guard the read.\"})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`template`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`components`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`?.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`buttons`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`log`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`template`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`components`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`buttons`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#9CDCFE`},children:`length`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// 3. Tell a billing error apart.`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`try`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` routa`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`messages`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`send`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`params`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`} `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`catch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`!`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`error`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` instanceof`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` RoutaBillingError`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`throw`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` error`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // The free allowance or the plan allowance is used up. Stop sending.`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`code`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`used`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`limit`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`what-is-new-2`,children:`What is new`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Media.`}),` `,_jsx(_components.a,{href:`/en/sdk/media`,children:_jsx(_components.code,{children:`routa.media.upload()`})}),` stores a file, from bytes or from a URL. If you called `,_jsx(_components.code,{children:`POST /v1/media`}),` directly, you can migrate.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Templates with components.`}),` `,_jsx(_components.a,{href:`/en/sdk/templates`,children:_jsx(_components.code,{children:`templates.submit()`})}),` accepts `,_jsx(_components.code,{children:`components`}),`, with header, footer and up to 10 buttons. `,_jsx(_components.a,{href:`/en/sdk/templates#image-video-or-document-header`,children:_jsx(_components.code,{children:`templates.uploadMedia()`})}),` uploads the file of a media header.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`New fields.`}),` `,_jsx(_components.code,{children:`Template`}),` (`,_jsx(_components.code,{children:`bodyText`}),`, `,_jsx(_components.code,{children:`components`}),` and the others), `,_jsx(_components.code,{children:`Message`}),` (`,_jsx(_components.code,{children:`origin`}),`, `,_jsx(_components.code,{children:`failureCode`}),`) and the events (`,_jsx(_components.code,{children:`externalRef`}),`).`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`New exported types.`}),` `,_jsx(_components.code,{children:`MessageOrigin`}),`, `,_jsx(_components.code,{children:`TemplateFailureCode`}),`, `,_jsx(_components.code,{children:`TemplateOrigin`}),`, `,_jsx(_components.code,{children:`TemplateUnsupportedComponent`}),`, `,_jsx(_components.code,{children:`TemplateComponents`}),`, `,_jsx(_components.code,{children:`TemplateHeader`}),`, `,_jsx(_components.code,{children:`TemplateFooter`}),`, `,_jsx(_components.code,{children:`TemplateButton`}),`, `,_jsx(_components.code,{children:`TemplateHeaderMediaFormat`}),` and `,_jsx(_components.code,{children:`RoutaErrorDetailValues`}),`, plus `,_jsx(_components.code,{children:`TemplateMediaId`}),`, `,_jsx(_components.code,{children:`TemplateMedia`}),` and the `,_jsx(_components.code,{children:`*Input`}),` types of the components. See `,_jsx(_components.a,{href:`/en/sdk/typescript`,children:`Types and IDs`}),`.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Partner API.`}),` `,_jsx(_components.a,{href:`/en/sdk/partner`,children:_jsx(_components.code,{children:`RoutaPartner`})}),`, in `,_jsx(_components.code,{children:`@routa-chat/sdk/partner`}),`. Experimental.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`from-0-1-0-to-0-2-0`,children:`From 0.1.0 to 0.2.0`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`Message['content']`}),` became `,_jsx(_components.code,{children:`MessageContent | null`}),`, and `,_jsx(_components.code,{children:`Message`}),` gained `,_jsx(_components.code,{children:`contentRedactedAt: string | null`}),`.`]}),`\n`,_jsxs(_components.p,{children:[`Routa removes the content of a message after the retention period of your plan and returns `,_jsx(_components.code,{children:`content: null`}),` with `,_jsx(_components.code,{children:`content_redacted_at`}),`. On 0.1.0, `,_jsx(_components.code,{children:`messages.retrieve()`}),` and `,_jsx(_components.code,{children:`messages.list()`}),` threw `,_jsx(_components.code,{children:`TypeError: Cannot read properties of null`}),` when they met one of those messages, and a single one broke the whole listing. Now they are returned with the rest of the message intact.`]}),`\n`,_jsxs(_components.p,{children:[`This is a type change, so code that reads `,_jsx(_components.code,{children:`message.content`}),` without checking stops compiling. Guard the read:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`message`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`content`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`log`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`message`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`content`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`type`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`See `,_jsx(_components.a,{href:`/en/sdk/messages#messages-with-removed-content`,children:`Messages`}),` and `,_jsx(_components.a,{href:`/en/concepts/messages#content-removed-by-retention`,children:`Content removed by retention`}),`.`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Upgrade the SDK","description":"What changes when you upgrade @routa-chat/sdk, from 0.2.0 to 0.5.0: what stops working or compiling and how to migrate.","href":"/en/sdk/upgrading"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"From 0.4.0 to 0.5.0","slug":"from-0-4-0-to-0-5-0","depth":2,"children":[{"title":"What is new","slug":"what-is-new","depth":3,"children":[]}]},{"title":"From 0.3.0 to 0.4.0","slug":"from-0-3-0-to-0-4-0","depth":2,"children":[]},{"title":"From 0.2.0 to 0.3.0","slug":"from-0-2-0-to-0-3-0","depth":2,"children":[{"title":"What can stop compiling","slug":"what-can-stop-compiling","depth":3,"children":[]},{"title":"How to migrate","slug":"how-to-migrate","depth":3,"children":[]},{"title":"What is new","slug":"what-is-new-2","depth":3,"children":[]}]},{"title":"From 0.1.0 to 0.2.0","slug":"from-0-1-0-to-0-2-0","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"routa","siteName":"Routa","title":"Upgrade the SDK - Routa","contextualStarterQuestions":[],"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{"pt-BR":{"href":"/sdk/upgrading","matchLevel":1},"en":{"href":"/en/sdk/upgrading","matchLevel":0}}},"lastModified":"2026-11-30T02:17:08.993Z","originalFileLocation":"en/sdk/upgrading.mdx","locale":"en"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"What changes when you upgrade @routa-chat/sdk, from 0.2.0 to 0.5.0: what stops working or compiling and how to migrate.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Routa\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/routa/ah4A5NYreudYb8Yn/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/routa/ah4A5NYreudYb8Yn/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/routa/ah4A5NYreudYb8Yn/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/routa/ah4A5NYreudYb8Yn/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/routa/ah4A5NYreudYb8Yn/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/routa/ah4A5NYreudYb8Yn/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/routa/ah4A5NYreudYb8Yn/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/routa/ah4A5NYreudYb8Yn/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/routa/ah4A5NYreudYb8Yn/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Upgrade the SDK - Routa\">\u003cmeta data-mint-head property=\"og:description\" content=\"What changes when you upgrade @routa-chat/sdk, from 0.2.0 to 0.5.0: what stops working or compiling and how to migrate.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Routa\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.routa.chat/en/sdk/upgrading\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://routa.mintlify.site/_mintlify/api/og/v2?division=Guides\u0026amp;title=Upgrade+the+SDK\u0026amp;description=What+changes+when+you+upgrade+%40routa-chat%2Fsdk%2C+from+0.2.0+to+0.5.0%3A+what+stops+working+or+compiling+and+how+to+migrate.\u0026amp;theme=c5f5461f2951eb9b038e5f34\u0026amp;signature=1b4b74de3eeac5ba4f889623a2b7716a2094603095b07e6173a1998619f3cd87\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Upgrade the SDK - Routa\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"What changes when you upgrade @routa-chat/sdk, from 0.2.0 to 0.5.0: what stops working or compiling and how to migrate.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://routa.mintlify.site/_mintlify/api/og/v2?division=Guides\u0026amp;title=Upgrade+the+SDK\u0026amp;description=What+changes+when+you+upgrade+%40routa-chat%2Fsdk%2C+from+0.2.0+to+0.5.0%3A+what+stops+working+or+compiling+and+how+to+migrate.\u0026amp;theme=c5f5461f2951eb9b038e5f34\u0026amp;signature=1b4b74de3eeac5ba4f889623a2b7716a2094603095b07e6173a1998619f3cd87\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/routa/ah4A5NYreudYb8Yn/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Routa\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#5B3FD9\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.routa.chat/en/sdk/upgrading\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/en/sdk/upgrading.md\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"en\" href=\"https://docs.routa.chat/en/sdk/upgrading\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"pt-BR\" href=\"https://docs.routa.chat/sdk/upgrading\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"x-default\" href=\"https://docs.routa.chat/sdk/upgrading\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.routa.chat/#organization\",\"name\":\"Routa\",\"url\":\"https://docs.routa.chat\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/routa/ag603HEZUqTlzO0m/logo/light.svg?fit=max\u0026auto=format\u0026n=ag603HEZUqTlzO0m\u0026q=85\u0026s=6caea08d96f076dfed53bf350bae202a\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.routa.chat#website\",\"name\":\"Routa\",\"url\":\"https://docs.routa.chat\",\"publisher\":{\"@id\":\"https://docs.routa.chat/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.routa.chat/en/sdk/upgrading#webpage\",\"url\":\"https://docs.routa.chat/en/sdk/upgrading\",\"name\":\"Upgrade the SDK\",\"description\":\"What changes when you upgrade @routa-chat/sdk, from 0.2.0 to 0.5.0: what stops working or compiling and how to migrate.\",\"dateModified\":\"2026-11-30T02:17:08.993Z\",\"isPartOf\":{\"@id\":\"https://docs.routa.chat#website\"},\"breadcrumb\":{\"@id\":\"https://docs.routa.chat/en/sdk/upgrading#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.routa.chat/en/sdk/upgrading#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Guides\",\"item\":\"https://docs.routa.chat/en/sdk/error-handling\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Upgrade the SDK\",\"item\":\"https://docs.routa.chat/en/sdk/upgrading\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.routa.chat/en/sdk/upgrading#article\",\"headline\":\"Upgrade the SDK\",\"name\":\"Upgrade the SDK\",\"description\":\"What changes when you upgrade @routa-chat/sdk, from 0.2.0 to 0.5.0: what stops working or compiling and how to migrate.\",\"url\":\"https://docs.routa.chat/en/sdk/upgrading\",\"mainEntityOfPage\":{\"@id\":\"https://docs.routa.chat/en/sdk/upgrading#webpage\"},\"dateModified\":\"2026-11-30T02:17:08.993Z\",\"publisher\":{\"@id\":\"https://docs.routa.chat/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.routa.chat#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Routa\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Routa\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/en/sdk/upgrading.md","siteName":"Routa","nav":{"global":null,"languages":[{"language":"pt-BR","default":true,"navbar":{"links":[{"href":"mailto:[email protected]","label":"Suporte"}],"primary":{"type":"button","label":"Abrir o painel","href":"https://app.routa.chat"}},"pages":[{"title":"pt-BR","href":"/sdk/upgrading"}]},{"language":"en","navbar":{"links":[{"href":"mailto:[email protected]","label":"Support"}],"primary":{"type":"button","label":"Open dashboard","href":"https://app.routa.chat"}},"tabs":[{"tab":"Documentation","pages":[{"title":"Documentation","href":"/en"}]},{"tab":"API reference","pages":[{"title":"API reference","href":"/en/api-reference/introduction"}]},{"tab":"Node.js SDK","groups":[{"group":"Get started","pages":[{"title":"Node.js SDK","href":"/en/sdk/overview"},{"title":"Configuration","href":"/en/sdk/configuration"}]},{"group":"Resources","pages":[{"title":"Messages","href":"/en/sdk/messages"},{"title":"Templates","href":"/en/sdk/templates"},{"title":"Media","href":"/en/sdk/media"},{"title":"Webhooks","href":"/en/sdk/webhooks"},{"title":"Pagination","href":"/en/sdk/pagination"},{"title":"Events, templates, media and usage","href":"/en/sdk/resources"},{"title":"Partners","href":"/en/sdk/partner"}]},{"group":"Guides","pages":[{"title":"Error handling","href":"/en/sdk/error-handling"},{"title":"Types and IDs","description":"How to use the SDK types, the branded IDs and the functions that validate and convert identifiers.","href":"/en/sdk/typescript"},{"title":"Upgrade the SDK","href":"/en/sdk/upgrading"}]}]}],"global":{"anchors":[{"anchor":"Dashboard","icon":"gauge","href":"https://app.routa.chat"},{"anchor":"SDK on GitHub","icon":"github","href":"https://github.com/routa-chat/routa-nodejs-sdk"},{"anchor":"Website","icon":"globe","href":"https://routa.chat"}]}}]},"basePath":"","title":"Upgrade the SDK - Routa","deploymentId":"dpl_Ab6nteg7kvyK8iL73naC2n7fmsWK","buildId":"dpl_Ab6nteg7kvyK8iL73naC2n7fmsWK","dynamics":[],"chunks":[]}