Update an SMS campaign

Code Examples

You can use as reference the code below to implement this call in your preferred language.
Check all our official API clients here

const SibApiV3Sdk = require('sib-api-v3-sdk');
const defaultClient = SibApiV3Sdk.ApiClient.instance;

let apiKey = defaultClient.authentications['api-key'];
apiKey.apiKey = 'YOUR API KEY';

let apiInstance = new SibApiV3Sdk.SMSCampaignsApi();

let updateSmsCampaign = new SibApiV3Sdk.UpdateSmsCampaign();

let campaignId = 1;

updateSmsCampaign = {
    name = 'string',
    sender = 'string',
    content = 'string',
    recipients = {
        'listIds' : [1]
    },
    scheduledAt = new Date('YYYY-MM-DDTHH:MM:ss+00:00')
}

apiInstance.updateSmsCampaign(campaignId, updateSmsCampaign).then(function() {
  console.log('API called successfully.');
}, function(error) {
  console.error(error);
});
<?php
require_once(__DIR__ . '/vendor/autoload.php');

$config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR API KEY');

$apiInstance = new SendinBlue\Client\Api\SMSCampaignsApi(
    new GuzzleHttp\Client(),
    $config
);
$campaignId = 1; 
$updateSmsCampaign = new \SendinBlue\Client\Model\UpdateSmsCampaign();
$updateSmsCampaign['name'] = 'My First Campaign';
$updateSmsCampaign['sender'] = 'senderName';
$updateSmsCampaign['content'] = 'This is a transactional SMS';
$updateSmsCampaign['recipients'] = array('listIds' => array(1));
$updateSmsCampaign['scheduledAt'] = new \DateTime('2021-01-01T00:00:00+00:00');

try {
    $apiInstance->updateSmsCampaign($campaignId, $updateSmsCampaign);
} catch (Exception $e) {
    echo 'Exception when calling SMSCampaignsApi->updateSmsCampaign: ', $e->getMessage(), PHP_EOL;
}
?>
from __future__ import print_function
import time
import sib_api_v3_sdk
from sib_api_v3_sdk.rest import ApiException
from pprint import pprint

configuration = sib_api_v3_sdk.Configuration()
configuration.api_key['api-key'] = 'YOUR API KEY'

api_instance = sib_api_v3_sdk.SMSCampaignsApi(sib_api_v3_sdk.ApiClient(configuration))
campaign_id = 1
name = "string"
sender = "string"
content = "string"
recipients = {"listIds": [1]}
scheduled_at = "YYYY-MM-DDTHH:MM:ss+00:00"
update_sms_campaign = sib_api_v3_sdk.UpdateSmsCampaign(name=name, sender=sender, content=content, recipients=recipients, scheduled_at=scheduled_at)

try:
    api_response = api_instance.update_sms_campaign(campaign_id, update_sms_campaign)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling SMSCampaignsApi->update_sms_campaign: %s\n" % e)
const SibApiV3Sdk = require('sib-api-v3-typescript');
 
let apiInstance = new SibApiV3Sdk.SMSCampaignsApi()

let apiKey = apiInstance.authentications['apiKey'];
apiKey.apiKey = 'YOUR API KEY';

let campaignId = 1;

let updateSmsCampaign = new SibApiV3Sdk.UpdateSmsCampaign();

updateSmsCampaign.name = 'My First Campaign';
updateSmsCampaign.sender = 'senderName';
updateSmsCampaign.content = 'This is a transactional SMS';
updateSmsCampaign.recipients = {'listIds' : [1]}
updateSmsCampaign.scheduledAt = new Date('2021-01-01T00:00:00+00:00');

apiInstance.updateSmsCampaign(campaignId, updateSmsCampaign).then(function(data) {
  console.log('API called successfully. Returned data: ' + JSON.stringify(data));
}, function(error) {
  console.error(error);
});
using sib_api_v3_sdk.Api;
using sib_api_v3_sdk.Client;
using sib_api_v3_sdk.Model;
using System;
using System.Collections.Generic;
using System.Diagnostics;

namespace Sendinblue
{
    class Program
    {
        static void Main(string[] args)
        {
            Configuration.Default.ApiKey.Add("api-key", "YOUR API KEY");

            var apiInstance = new SMSCampaignsApi();
            long? campaignId = 1;
            string name = "My First Campaign";
            string sender = "senderName";
            string content = "'This is a transactional SMS";
            List<long?> listIds = new List<long?>();
            listIds.Add(1);
            List<long?> exclusionListIds = new List<long?>();
            exclusionListIds.Add(2);
            CreateSmsCampaignRecipients recipients = new CreateSmsCampaignRecipients(listIds, exclusionListIds);
            string scheduledAt = "2021-01-01T00:00:00.000+05:30";
            try
            {
                var updateSmsCampaign = new UpdateSmsCampaign(name, sender, content, recipients, scheduledAt);
                apiInstance.UpdateSmsCampaign(campaignId, updateSmsCampaign);
                Console.ReadLine();
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.Message);
                Console.WriteLine(e.Message);
                Console.ReadLine();
            }
        }
    }
}
# load the gem
require 'sib-api-v3-sdk'
# setup authorization
SibApiV3Sdk.configure do |config|
  # Configure API key authorization: api-key
  config.api_key['api-key'] = 'YOUR API KEY'
end

api_instance = SibApiV3Sdk::SMSCampaignsApi.new

campaign_id = 789 # Integer | id of the SMS campaign

update_sms_campaign = SibApiV3Sdk::UpdateSmsCampaign.new # UpdateSmsCampaign | Values to update an SMS Campaign

update_sms_campaign = {
  'name'=> 'string',
  'sender'=> 'string',
  'content'=> 'string',
  'recipients'=> {
    'listIds'=> [1]
  },
  'scheduledAt'=> DateTime.iso8601('2021-02-03T04:05:06+07:00')
}

begin
  #Update an SMS campaign
  api_instance.update_sms_campaign(campaign_id, update_sms_campaign)
rescue SibApiV3Sdk::ApiError => e
  puts "Exception when calling SMSCampaignsApi->update_sms_campaign: #{e}"
end
Language
Credentials
Header
Click Try It! to start a request and see the response here!