Loading...
API Management

SMS Marketing

Sms API Integration

An API (Application Programming Interface) is a set of rules and protocols that allow two software applications to communicate with each other. In practice, an API defines how an application can request data or services from another application and how that data or those services should be provided.

APIs are often used to enable developers to access functionalities or data from an external service, such as retrieving weather information, sending messages, or accessing databases.

How to Integrate an API with cURL

cURL is a command-line tool that allows you to send HTTP requests to a server and receive responses. It is very useful for testing and integrating APIs.

To communicate with GenioSms, you must first create your API.

These settings can be configured from the user control panel after associating at least one phone number for SMS management.

1

Choose the phone with which to send Sms.

2

Set the url of your site

3

Enter the ip of your server

4

Choose the IP mode based on how you want to configure message sending: either only from your IP or from all IPs.

Once you set these values you will get the tokens needed for proper integration with Genio Sms servers

  • GET request: To get data from an API.
  •                
                    curl -X GET "https://api.example.com/data" -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
                   
                   
    • -X GET: Specifies that the request is of type GET.
    • "https://api.example.com/data": URL API.
    • -H "Authorization: Bearer YOUR_ACCESS_TOKEN": Adds a header to the request, in this case an authorization token.
  • POST request: To send data to an API.
  •                
                    curl -X POST "https://api.example.com/data" -H "Content-Type: application/json" -d '{"key1":"value1", "key2":"value2"}'
                   
                   
    • -X POST: Specifies that the request is of type POST.
    • -H "Content-Type: application/json": Indicates that the data sent is in JSON format.
    • -d '{"key1":"value1", "key2":"value2"}': The data to be sent in the body of the request.

    With the SMS sending APIs, you can integrate the Instant Notification Center (INC) service.

    The Instant Notification Center (INC) is a service that manages real-time notifications, similar to PayPal's IPN (Instant Payment Notification). This service provides instant updates on SMS marketing activities, such as sending surveys, promotional campaigns, and more—whether sent directly or integrated with the API service.

    Use Case: Two-Factor Authentication (2FA) via GENIOSMS API

    A common use case for using an API to manage the sending of OTP (One-Time Password) via SMS is two-factor authentication (2FA) for web or mobile applications. Here's how it works:

    Scenario

    A company wants to enhance the security of access to its online services (e.g., an e-commerce website or a banking app). To achieve this, it decides to implement two-factor authentication (2FA) using OTPs sent via SMS.

    Workflow

    1. Request for access:
      • The user enters their username and password in the login form.
      • If the credentials are correct, the system requests a second level of authentication.
    2. Generation of the OTP:
      • The server generates an OTP code (e.g., a 6-digit number) that is valid for a short period of time (e.g., 5 minutes).
    3. Sending the OTP via SMS:
      • The Genio Sms API server sends the OTP code to the phone number registered by the user.
      • Example of API request with cURL:
                        
                        curl -X POST "https://api.geniosms.com/send" \
                        -H "Authorization: Bearer YOUR_API_KEY" \
                        -H "Content-Type: application/json" \
                        -d '{
                              "to": "+391234567890",
                              "message": "Your OTP code is 123456. Valid for 5 minutes."
                            }'
                       
                       
    4. Confirmation of OTP:
      • The user receives the SMS with the OTP code and enters it into the application form.
      • The server checks whether the entered OTP code matches the generated one and whether it is still valid..
    5. Access permitted:
      • If the OTP code is correct, the user is authenticated and can access the service.

    Benefits of Using an API for Sending OTP via SMS

    1. Security: Genio SMS increases the certainty of OTP message delivery. Before sending, the system verifies and identifies active and functioning devices associated with the customer's account, ensuring greater delivery reliability.
      The OTP adds an extra layer of protection, making unauthorized access more difficult..
    2. Ease of Integration: Genio SMS APIs are easy to integrate with various programming languages.
    3. Scalability: SMS sending services handle large volumes of messages, making them suitable for applications with many users.
    4. User Experience: Sending OTP via SMS is a familiar and reliable method for users.
    Top