How to Opt-In for SMS Notifications via API

To enhance your communication with users and ensure they receive timely updates, consider integrating SMS notification opt-in at various touchpoints throughout your user journey. Ideal places to insert this feature include during the booking process, at checkout, upon final payments through the guest portal, or within any contact form on your website where a mobile number is requested. Integrating the SMS opt-in feature in these areas not only streamlines the communication process but also significantly improves user engagement and satisfaction by keeping them informed every step of the way. Follow the steps below to seamlessly incorporate SMS notification opt-in into your user interactions.

Step 1: Prepare the PUT Request Payload

To opt-in a user for SMS notifications, you will need to send a PUT request with specific user details. Ensure you have the following information:

  • Mobile Phone Number: The user’s mobile phone number in E164 format (e.g., “+11234567890”).
  • IP Address: The IP address of the user’s device (e.g., “123.123.123.123”).
  • User Agent: The user agent string of the user’s browser or device (e.g., “Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36”).
  • Opt-In Number ID: The identifier for the number or campaign the user is opting into. This will usually be set for you based on the campaign’s configuration.

Here is a template of the payload you will need to construct:

{ 
  "mobile_phone": "+11234567890", 
  "ip_address": "123.123.123.123", 
  "user_agent": "Your User Agent Here", 
  "opt_in_number_id": "your opt in number id here" 
}

Step 2: Set the API Endpoint and Authorization Header

Send the prepared PUT request to the following endpoint:

https://app-api.sendsquared.com/v1/public/opt-in/

To authenticate your request, you must include an x-api key in the header. Here is an example of how your header should look:

x-api: your-uuid-here

Step 3: Send the Request

Using your preferred HTTP client or tool, send the PUT request with the payload and headers as described above. If the request is successful, the user will be opted into the SMS notifications for the specified campaign.

Need Further Assistance?

If you encounter any issues or have questions about this process, please don’t hesitate to reach out to our support team. We’re here to help you make the most out of your SendSquared experience.

Thank you for choosing SendSquared for your communication needs!