Integrating 1Byte SMS Service Into Your App Is Simple

Intergrate 1Byte SMS Service in your app is simple

Welcome back my valued viewers, you will learn how to leverage the API Key of 1Byte SMS Service and how to integrate this amazing key into your application, program, or whatever else you desire in this tutorial from 1Byte.

Intergrate 1Byte SMS Service in your app is simple

What Is API Key?

To save the post from getting too long and to appeal to people who are unfamiliar with IT knowledge, I will describe it as simply as possible.

Assume you’ve recently launched an application that you developed yourself. You now want your application to be able to deliver bulk SMS messages. But you have no idea how to code and implement this functionality.
→ Your solution is to find a way to integrate 1Byte SMS service into your application.

Because of the presence of 1Byte API Key, you now may utilize API Key integrated into your own applications.
→ As a result, you don’t need to utilize the 1Byte platform to send SMS messages (login into 1Byte account, and sending SMS from 1Byte); instead, your application may use the built-in 1Byte SMS service functionality.

Prerequisites

1) You need to have a cool-sounding Brandname

→ If you don’t have a BrandName yet, see the instructions for creating a BrandName from 1Byte.

2) You need to have API Key

→ Select API Key Management from the User Dashboard page. You’ll find the SMS API Key there.

INTERGRATE 1BYTE SMS SERVICE IN YOUR APP IS SIMPLE
1Byte SMS API Key

3) A list of receivers in JSON format, normally this list comes with 3 main fields of information: Name, Phone Number, and Date of Birth.

→ You can use Convertio to convert from excel to JSON format

General Info

1Byte’s API only works on HTTPS protocol

→ No one can spoof your message content

Limit API calls to 100 times per minute. 

→ The objective of this is to prevent evil actors from exploiting and brute-forcing API Key

API response data will be in JSON format

The APIs will respond with the following appropriate HTTP status code

API STATUS CODE
HTTP Code 200 4XX 5XX
Explanation - Send SMS Successfully - Your balance is insufficient
- Invalid Brandname
- ...etc
- Internal Server Errors
- ...etc

+ API Send SMS

API SEND SMS
Description API Send SMS
URL {{API_BASE_URL}}/external/sms
Method POST
Authorization API Key
Body JSON
{
{
	"timezone": "string",
	"brandName": "string",
	"subject": "string",
	"content": "string",
	"type": "NOW",
	"sendingTime": "2022-02-14T08:10:26.730Z",
	"sendBefore": {
		"day": 0,
		"at": "string"
	},
	"listUser": [
		{
			"birthday": "string",
			"name": "string", //(Optional)
			"phoneNumber": "string"
		}
	]
}
}
  • Success Response
    • Code: 200
    • Content
{
  "messageCode": "SEND_SMS_SUCCESSFUL",
  "message": "Your request has been sent to queue"
  "id": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
}
  • Error Response
    • Code: `404
    • Content
{
 "statusCode": 404,
 "message": string ,
 "messageCode": string
}
  • Error Response
    • Code: `400
    • Content
{
 "statusCode": 400,
 "message": [],
 "error": string
}

BODY

  • brandName: (Obligatory) SMS Brandname.
  • subject: (Obligatory)the header of the SMS command.
  • content: (Obligatory) SMS content sent to the recipient.
  • type: (Obligatory) accepts only the following values:
    • NOW: sent immediately.
    • BIRTHDAY: sent by date of birth.
    • TIMER: sent at a future date.
  • sendingTime: (required when type is TIME) Datetime type with ISO 8601 format.
  • timezone: (required when type is BIRTHDAY) time zone of the message recipient. See a list of time zones here.
  • sendBefore: (required when type is BIRTHDAY) includes two values:
    • day: (Obligatory) indicates how many days before the recipient’s birthday the message was sent. Up to 7 days.
    • at: (Obligatory) time to send the message. 24-hour format HH:ss
  • listUser: (Obligatory) message recipient list. Each recipient contains the following information:
  • name: Recipient’s name [Optional]
  • phoneNumber: (Obligatory) phone number, starting with +855
  • birthday: (required when type is BIRTHDAY) date of birth, format dd/mm/yyyy

Step by Step

+ Step 1: Using POST request, and this POST request will be sent to this URL:

https://api.1byte.com/external/sms

+ Step 2: Putting your API Key into the Headers section of a POST request

API Key must be used in the Headers section of a POST request

+ Step 3: Putting your SMS messages (data) in raw + JSON format in the Body section of a POST request

INTERGRATE 1BYTE SMS SERVICE IN YOUR APP IS SIMPLE
Follow the instruction of the image

NOTE: Please remove all comments in your SMS messages

Sms Data (JSON Format)

Case 1: Send Type Is “Now” (Send Immediately)

//This is the HEADER section of POST request
X-API-KEY: 6b085be6d3df56c4ac9xxxxxxxxx9e51    //insert your SMS API KEY here
//This is the BODY section of POST request
{
  "brandName": "1Byte-Demo",              //insert your SMS Brandname in here
  "subject": "Warning about COVID-19 ",   //insert your SMS title in here
  "content": "Require all employees of company A to wear masks when working ", //insert your SMS content in here
  "type": "NOW",
  "listUser": [
    {
      "name": "Person A",                 //insert your customer name in here (Optional)
      "phoneNumber": "+855123123123"      //insert your customer phone in here
    },
    {
      "name": "Person B",                 //insert your customer name in here (Optional)
      "phoneNumber": "+855123456789"      //insert your customer phone in here
    }
  ]
}

Case 2: Send Type Is “Birthday” (Send Based On Birthday)

//This is the HEADER section of POST request
X-API-KEY: 6b085be6d3df56c4ac9xxxxxxxxx9e51     //insert your SMS API KEY here
{
  "brandName": "1Byte-Demo",          //insert your SMS Brandname in here
  "subject": "Happy Brithday",        //insert your SMS title in here
  "content": "1Byte would like to wish you happy brithday!!!",   //insert your SMS content in here
  "type": "BIRTHDAY",
  "timezone": "Asia/Phnom_Penh",
  "sendBefore": {
    "day": 0,                           //From the date of birth of the recipient, send 0 days before
    "at": "24:00"                       //Send at 24:00 (midnight - 12PM)
  },
  "listUser": [
    {
      "name": "Person A",               //insert your customer name in here (Optional)
      "phoneNumber": "+855123123123",   //insert your customer phone in here
      "birthday": "22/02/1992"          //insert your customer DOB in here
    },
    {
      "name": "Person B", // (Optional)
      "phoneNumber": "+855123456789",
      "birthday": "22/02/1992"
    }
  ]
}'

Case 3: Send Type Is “Timer” (Send Based On A Certain Day In Future)

//This is the HEADER section of POST request
X-API-KEY: 6b085be6d3df56c4ac9xxxxxxxxx9e51     //insert your SMS API KEY here
//This is the BODY section of POST request
{
  "brandName": "1Byte-Demo",            //insert your SMS Brandname in here
  "subject": "Change of workplace",     //insert your SMS title in here
  "content": "We will no longer work here, but will move to Building B instead ",
  "type": "TIMER",
  "sendingTime": "2022-02-22T08:00:00.000Z",   //will be send on 22-Feb-2022 at 8AM
  "listUser": [
    {
      "name": "Person A",                 //insert your customer name in here (Optional)
      "phoneNumber": "+855123123123"      //insert your customer phone in here
    },
    {
      "name": "Person B", // (Optional)
      "phoneNumber": "+855123456789"
    }
  ]
}'

Conclusion

  • Congratulations, you’ve made it this far; now you know how to integrate 1Byte’s API Key into your site or application without actually logging into 1Byte’s site
  • If you have any more concerns or need assistance, you can reach out to 1Byte’s LiveChat customer support at any time.