Skip to main content
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.

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.

From 0.2.0 to 0.3.0

0.3.0 aligns the SDK types with the current API contract and brings three new resources: media.upload(), components and templates.uploadMedia() and the Partner API, which is experimental.

What can stop compiling

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: 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

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:
See Messages and Content removed by retention.