OptInPhoneNumberCommand

Use this request to opt in a phone number that is opted out, which enables you to resume sending SMS messages to the number.

You can opt in a phone number only once every 30 days.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { SNSClient, OptInPhoneNumberCommand } from "@aws-sdk/client-sns"; // ES Modules import
// const { SNSClient, OptInPhoneNumberCommand } = require("@aws-sdk/client-sns"); // CommonJS import
const client = new SNSClient(config);
const input = { // OptInPhoneNumberInput
  phoneNumber: "STRING_VALUE", // required
};
const command = new OptInPhoneNumberCommand(input);
const response = await client.send(command);
// {};

OptInPhoneNumberCommand Input

See OptInPhoneNumberCommandInput for more details

Parameter
Type
Description
phoneNumber
Required
string | undefined

The phone number to opt in. Use E.164 format.

OptInPhoneNumberCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.

Throws

Name
Fault
Details
AuthorizationErrorException
client

Indicates that the user has been denied access to the requested resource.

InternalErrorException
server

Indicates an internal service error.

InvalidParameterException
client

Indicates that a request parameter does not comply with the associated constraints.

ThrottledException
client

Indicates that the rate at which requests have been submitted for this action exceeds the limit for your Amazon Web Services account.

SNSServiceException
Base exception class for all service exceptions from SNS service.