SMS Applications via Bundles
To create SMS Applications via Bundles, you can either just send boolean true
, or specify the name of the SMS Application.
SMS Applications can be added together with subprojects, and a Conversation Application, in which case the application(s) will be associated to the subproject.
Note that, for this guide, we provide node.js code samples. However, the principles apply to any language you use to make requests to the API.
Creating a SMS Application using boolean
The following code sample creates a subproject using the Provisioning API Bundles:
import fetch from 'node-fetch';
async function createSubproject() {
const resp = await fetch(
`https://provisioning.api.sinch.com/v1/projects/${PROJECT_ID}/bundles`,
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization:
'Basic ' +
Buffer.from(ACCESS_KEY + ':' + ACCESS_SECRET).toString('base64'),
},
body: JSON.stringify({
name: 'Small bundle example',
region: 'US',
smsApp: true,
})
);
const data = await resp.json();
return data;
}
If set to true
, a SMS Application will be created under the project or subproject specified, with the name of the root object. If neither this value or the name in the root is set, then the request will fail.
If set to false
or left undefined, a SMS Application will not be created.
Creating a SMS Application with custom name
The following code sample creates a subproject using the Provisioning API Bundles:
import fetch from 'node-fetch';
async function createSubproject() {
const resp = await fetch(
`https://provisioning.api.sinch.com/v1/projects/${PROJECT_ID}/bundles`,
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization:
'Basic ' +
Buffer.from(ACCESS_KEY + ':' + ACCESS_SECRET).toString('base64'),
},
body: JSON.stringify({
name: 'Small bundle example',
region: 'US',
smsApp: {
name: 'SMS Application name',
},
})
);
const data = await resp.json();
return data;
}
An SMS Application will be created under the project or subproject specified, with given name.
If set to false
or left undefined, a SMS Application will not be created.