![diagram showing Sinch portfolio](https://cdn.statically.io/img/www.sinch.com/sites/default/files/styles/small_hq/public/image/2023-08/sinch-portfolio-diagram.png?itok=3N_RTfbW)
1
of 4
1
of 4
![illustration of a globe with many connections](https://cdn.statically.io/img/www.sinch.com/sites/default/files/styles/small_hq/public/image/2023-09/sinch-global-super-network.png?itok=mjHfzZ6g)
1
of 4
package example;
import com.sinch.xms.ApiConnection;
import com.sinch.xms.SinchSMSApi;
import com.sinch.xms.api.GroupResult;
import com.sinch.xms.api.MtBatchTextSmsResult;
public class Example {
private static final String SERVICE_PLAN_ID = "SERVICE_PLAN_ID";
private static final String TOKEN = "SERVICE_TOKEN";
private static final String[] RECIPIENTS = {"1232323131", "3213123"};
private static final String SENDER = "SENDER";
public static void main(String[] args) {
try (ApiConnection conn =
ApiConnection.builder().servicePlanId(SERVICE_PLAN_ID).token(TOKEN).start()) {
// Sending a simple Text Message
MtBatchTextSmsResult batch =
conn.createBatch(
SinchSMSApi.batchTextSms()
.sender(SENDER)
.addRecipient(RECIPIENTS)
.body("Something good")
.build());
System.out.println("Successfully sent batch " + batch.id());
// Creating simple Group
GroupResult group = conn.createGroup(SinchSMSApi.groupCreate().name("Subscriber").build());
// Adding members (numbers) into the group
conn.updateGroup(
group.id(), SinchSMSApi.groupUpdate().addMemberInsertion("15418888", "323232").build());
// Sending a message to the group
batch =
conn.createBatch(
SinchSMSApi.batchTextSms()
.addRecipient(group.id().toString())
.body("Something good")
.build());
System.out.println("Successfully sent batch " + batch.id());
} catch (Exception e) {
System.out.println("Batch send failed: " + e.getMessage());
}
}
}
import clx.xms
import requests
client = clx.xms.Client(service_plan_id='{spid}', token='{token}')
create = clx.xms.api.MtBatchTextSmsCreate()
create.sender = '12345'
create.recipients = {'46123123123'}
create.body = 'Hello, world!'
try:
batch = client.create_batch(create)
except (requests.exceptions.RequestException,
clx.xms.exceptions.ApiException) as ex:
print('Failed to communicate with XMS: %s' % str(ex))
$client = new Clx\Xms\Client('{spid}', '{token}');
$batchParams = new \Clx\Xms\Api\MtBatchTextSmsCreate();
$batchParams->setSender('12345');
$batchParams->setRecipients(['46123123123']);
$batchParams->setBody('Hello, World!');
try {
$result = $client->createTextBatch($batchParams);
echo('Successfully sent batch ' . $result->getBatchId());
} catch (\Clx\Xms\ApiException $ex) {
echo('Failed to communicate with XMS: ' . $ex->getMessage() . "\n");
}
![illustration of the customer journey](https://cdn.statically.io/img/www.sinch.com/sites/default/files/styles/small_hq/public/image/2023-07/sinch-customer-journey-touchpoints.png?itok=EaEHxgO4)
![headshots of Sinch team](https://cdn.statically.io/img/www.sinch.com/sites/default/files/styles/small_hq/public/image/2023-07/sinch-partner-for-success.png?itok=bXpsOXwq)
Let's talk possibilities!
![illustration of person](https://cdn.statically.io/img/www.sinch.com/sites/default/files/styles/medium_hq/public/image/2023-03/sinch-cta-block-hero_0.png?itok=Dkf7JcZI)
Try out Sinch now - for free!
No credit card needed
Send free test messages
Easy integration with Sinch API
Access your API credentials and manage your settings and configuration