v0.0.5
Pre-release
Pre-release
What's Changed
- [Feature][All APIs] Support hostname override in SinchClient parameters (#51)
- OAuth2:
authHostname
- Conversation:
conversationHostname
andconversationTemplatesHostname
- Fax:
faxHostname
- Numbers:
numbersHostname
- Sms:
smsHostname
- Verification:
verificationHostname
- Voice:
voiceHostname
andvoiceApplicationManagementHostname
- OAuth2:
- [Tech][All APIs] Support plugins addition in SinchClient parameters (preparation work for E2E tests) (#52)
- [Tech] Export the
AdditionalHeaders
request plugin (preparation work for E2E tests) (#57) - [Feature][Breaking Change] Flexible enums for regions (#54)
- The generic
Region
enum has been deleted in favor of API specific enums - Conversation:
ConversationRegion
- Fax:
FaxRegion
- Sms:
SmsRegion
- Voice:
VoiceRegion
- Note the enums are now "flexible": any string value is also accepted and will be used to build the URL (only is the hostname has not been overridden)
- The generic
- [Feature][Breaking Change] Change package exports - see migration guide below (#55)
Conversation API
- [Feature][Conversation API] Align Conversation SDK with latest documentation (#49)
- Support
channel_specific_message
property in theAppMessage
interface and the WhatsApp flow messages - Support
channel_specific_message
andproduct_response_message
properties in theContactMessage
interface and the WhatsApp interactive NFM reply - [Bugfix][Breaking Change] Remove
AppMessageMessage
interface and reconciliate the model in theAppMessage
interface
- Support
- [Feature][Conversation API] Enhance DX for
ttl
field in SendMessageRequest: it's now allowed to input directly a number or a string representing a number. The SDK will take care of the formatting expected by the backend (#56) - [Feature][Conversation API] Add
setRegion()
method on the ConversationService (#57)
Fax API
- [Bugfix][Fax API] Fix Fax API issues (#50)
- Fix pagination
- Fix
faxes.send()
when using multipart/form-data: boolean was not allowed in the request
- [Feature][Fax API] Support regions for Fax API (#53)
- [Feature][Fax API] Add
setRegion()
method on the FaxService (#57)
Numbers API
- [Breaking Change] Change body property for activeNumber.update() from
activeNumberRequestBody
toupdateActiveNumberRequestBody
(#59)
Sms API
- [Feature][Sms API] Add
setRegion()
method on the SmsService (#57)
Verification API
- [Breaking Change] Split the helper per action (#61)
- The
verificationsHelper
does not exist anymore - New helpers are:
startVerificationHelper
,reportVerificationByIdHelper
,reportVerificationByIdentityHelper
- The
Voice API
- [Bugfix][Voice API] Fix the
setRegion()
method on the VoiceService to update the region on all the subdomains that support it (#57)
Documentation
- [Examples] Refactor webhooks examples to showcase the usage of Services (#48)
Migration guide - new package exports
Due to the increasing number of APIs supported in the SDK and the variety of concepts that can be cross-domains (Email
for Fax can conflict with Email
for Mailgun APIs), all the model interfaces are now exported under the API namespace.
- There is no need to import all the interfaces one by one from
@sinch/sdk-core
, only the namespace is required - To use an interface or a helper, it needs to be prefixed by the imported namespace: e.g.:
messageBuilder.text()
->Conversation.messageBuilder.text()
MOText
->Sms. MOText
Fax
->Fax.Fax
Here is an example of code before and after the migration:
Before
import {
SinchClient, // This import will stay: it's a class defined in the sdk-core
Region, // This import will change: the generic Region is replaced by API specific flexible enums
ContactId, // This model interface can't be imported: it must use the API's namespace
SendTextMessageRequestData, // Same as above
messageBuilder, // Same thing for the helpers
} from '@sinch/sdk-core';
(async() => {
const sinch = new SinchClient({
keyId: 'myProjectId',
keySecret: 'myKeyId',
projectId: 'myKeySecret',
});
const conversationService = sinch.conversation;
// Sets the region for the message API only. The method to set the region for the whole API is missing in v0.0.4
conversationService.messages.setRegion(Region.EUROPE);
const requestData: SendTextMessageRequestData<ContactId> = {
sendMessageRequestBody: {
app_id: 'myConversationAppId',
recipient: {
contact_id: 'theContactId',
},
message: messageBuilder.text({
text: 'Hello from Sinch',
}),
},
};
const response = await conversationService.messages.sendTextMessage(requestData);
console.log(response);
})();
After
import {
SinchClient,
ConversationRegion, // This is the new flexible enum for the Conversation API
Conversation, // This is the namespace for the Conversation API
} from '@sinch/sdk-core';
(async() => {
const sinch = new SinchClient({
keyId: 'myProjectId',
keySecret: 'myKeyId',
projectId: 'myKeySecret',
conversationRegion: ConversationRegion.EUROPE, // Set the region for the whole Conversation API
});
const conversationService = sinch.conversation;
// The region can also be set at service level in v0.0.5
// conversationService.setRegion(ConversationRegion.EUROPE);
// Note the `Conversation.` prefix in front of the types
const requestData: Conversation.SendTextMessageRequestData<Conversation.ContactId> = {
sendMessageRequestBody: {
app_id: 'myConversationAppId',
recipient: {
contact_id: 'theContactId',
},
// Note the `Conversation.` prefix in front of the helper
message: Conversation.messageBuilder.text({
text: 'Hello from Sinch',
}),
},
};
const response = await conversationService.messages.sendTextMessage(requestData);
console.log(response);
})();
Full Changelog: v0.0.4...v0.0.5