API Overview

https://web.plasgate.com/support/
PlasGate
PlasGate

Created: 12/26/2023 6:58 AM - Updated: 01/03/2024 8:48 AM

  • ** REST API **


    The RESTful API allows developers to expand and build their apps on Plasgate. The API makes it easy to send messages to one or many destinations as well as enabling bulk messaging.

    If you need to use a stateful tcp protocol (SMPP), please refer to SMPP Server API.

    SMS Messages can be transmitted using the RESTful api, the following requirements must be met to enable the service:

    • You need to have valid API Key, which you can generate
    • You need to have balance, which you can request to topup

    Send a single message

    Send a single message to one destination address.

    In order to deliver SMS messages, Data is transferred using HTTP POST request at the following URL:

    https://cloudapi.plasgate.com/rest/send

    Params:

    • private_key : copy and past your private key that you generate

    Header:

    • X-Secret : copy and past your secret key that you generate

    Body:

    • JSON Data

    ParameterValue/PatternExample
    senderTextSMS Info
    toNumber85512345678
    contentTextHello World

    There is an additional option to mask content. Place two keywords #ma# around any text you want to mask in the content field.

    • The keyword #ma# will not appear on the recipient’s device.
    • The masked text will be displayed as ****** in the transaction report.
    • Supported multimask area.
    Example
    curl --location --request POST 'https://cloudapi.plasgate.com/rest/send?private_key=Private Key' --header 'X-Secret: Secret' --header 'Content-Type: application/json' --data-raw '{ "sender": "SMS Info", "to": "855123456789", "content": "Hello from rest API" }'

    Request with masked content

    curl --location --request POST 'https://cloudapi.plasgate.com/rest/send?private_key=Private Key' --header 'X-Secret: Secret' --header 'Content-Type: application/json' --data-raw '{ "sender": "SMS Info", "to": "855123456789", "content": "Hello from rest #ma#API#ma#" }'

    The recipient’s device will get the message as Hello from rest API and Hello from rest *** will be displayed in the transaction report in this situation.


    Send multiple messages

    Send multiple messages to one or more destination addresses.

    In order to deliver SMS messages, Data is transferred using HTTP POST request at the following URL:

    https://cloudapi.plasgate.com/rest/batch-send

    Params:

    • private_key : copy and past your private key that you generate (To get private_key Click here)

    Header:

    • X-Secret : copy and past your secret key that you generate (To get X-Secret Click here)

    Body:

    • JSON Data

    ParameterExample(s)Description
    messages[{“to”: ["85512345678", "85597123456"], “content”: “Hello World”}]Require
    globals{“sender”: “SMS Info”}Require
    batch_config{“callback_url”: “http://example.com/callback”, “schedule_at”: “2021-09-30 09:00:00”}Optional

    Example

    curl --location --request POST 'https://cloudapi.plasgate.com/rest/batch-send?private_key=Private Key' --header 'X-Secret: Secret' --data-raw '{ "globals": { "sender": "SMS Info" }, "messages": [ { "to": ["855123456780", "855123456781"], "content": "Hello from rest API" } ] }'



    For more example, please visit +Gate REST API document!


      

    ** HTTP API **


    This document is targeted at software designers/programmers wishing to integrate SMS messaging as a function into their applications using HTTP protocol, e.g. in connection with WEB-server, unified messaging, information services etc…

    If you need to use a stateful tcp protocol (SMPP), please refer to SMPP Server API.

    SMS Messages can be transmitted using HTTP protocol, the following requirements must be met to enable the service:

    You need a Plasgate user account You need sufficient credit on your user account

    Sending

    In order to deliver SMS messages, Data is transferred using HTTP POST request at the following URL:

    https://cloudapi.plasgate.com/api/send

    ParameterValue / PatternExample(s)
    toDestination address (required)855
    senderOriginating address (required)SMS Info
    usernamePlasgate account login emailexample@email.com
    passwordAccount passwordStr0ng3P@$$W0rd
    dlryes or noyes
    dlr_urlHTTP(s) callback URL (optional)http://example.com/callback
    dlr_level1, 2 or 32
    dlr_methodGET or POSTGET
    contentTextHello world !

    Example

    curl --location --request POST 'https://cloudapi.plasgate.com/api/send' --form 'to="855123456789"' --form 'sender="SMS Info"' --form 'content="Hello from +Gate SMS Cloud"' --form 'username="example@email.com"' --form 'password="Str0ng3P@$$W0rd"'

    For more example, please visit +Gate HTTP API document!


    ** SMPP API **


    This document is targeted at software designers/programmers wishing to integrate SMS messaging through a stateful tcp protocol SMPP v3.4, if you feel this does not fit your needs and that you are more “web-service-guy” then you still can try HTTP o REST API.

    SMS Messages can be transmitted using SMPP protocol, the following requirements must be met to enable the service:

    You need a Plasgate user account You need sufficient credit on your Plasgate user account

    Binding to SMPP Server

    Using a proper SMPP Client application, the following parameters must be considered:

    ParameterValue / PatternExample(s)
    usernameText (30 char. max)pg_smpp (To get username & password, Click here! )
    passwordText (30 char. max)pg_smppppwd
    bindcloudsmpp.plasgate.comThe SMPP Server API listener will only bind to this specified address, given cloudsmpp.plasgate.com the listener will bind on all interfaces.
    port2775The binding TCP port.

    Supported SMPP PDUs

    Plasgate SMPP Server is supporting the following PDUs:

    • bind_transmitter
    • bind_transceiver
    • bind_receiver
    • unbind
    • submit_sm
    • deliver_sm
    • enquire_link

    Example

    Download the following library:

    How to run the example

    1. Credential and content
    • In sendsms.php, on line 17 $smpp->bindTransmitter(“test1khsmpp”, “Test@018”):
    • replace test1khsmpp with your SMPP username
    • replace Test@018 with your SMPP password
    • On line 25, change $message variable to your own content.
    1. Install dependencies

           In the root directory run composer install (make sure compose is ready installed on your PC).

    1. Send SMS

    • php sendsms.php

Was this article helpful?

1 Out of 1 Marked As Helpfull

Have more questions? Please Contact Us