SMS Gateway API

<back to all web services

SMSSend

Saves the specified SMS and sends it for background processing

Requires Authentication
The following routes are available for this service:
POST/api/sendmessage
POST/api/sendmessage/immediate
POST/api/send
POST/api/sms/send
POST/api/send/immediate
POST/api/sms/send/immediate
import 'package:servicestack/servicestack.dart';

class CommResponse implements IConvertible
{
    String? CommId;
    String? Reference;
    bool? Status;
    String? Message;

    CommResponse({this.CommId,this.Reference,this.Status,this.Message});
    CommResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        CommId = json['CommId'];
        Reference = json['Reference'];
        Status = json['Status'];
        Message = json['Message'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'CommId': CommId,
        'Reference': Reference,
        'Status': Status,
        'Message': Message
    };

    getTypeName() => "CommResponse";
    TypeContext? context = _ctx;
}

class BaseLicenseeEnforcedServiceModel implements IConvertible
{
    String? LicenseeId;

    BaseLicenseeEnforcedServiceModel({this.LicenseeId});
    BaseLicenseeEnforcedServiceModel.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        LicenseeId = json['LicenseeId'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'LicenseeId': LicenseeId
    };

    getTypeName() => "BaseLicenseeEnforcedServiceModel";
    TypeContext? context = _ctx;
}

class SMSContact implements IConvertible
{
    String? Name;
    String? PhoneNumber;
    String? ContactId;

    SMSContact({this.Name,this.PhoneNumber,this.ContactId});
    SMSContact.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Name = json['Name'];
        PhoneNumber = json['PhoneNumber'];
        ContactId = json['ContactId'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Name': Name,
        'PhoneNumber': PhoneNumber,
        'ContactId': ContactId
    };

    getTypeName() => "SMSContact";
    TypeContext? context = _ctx;
}

class SMSModel extends BaseLicenseeEnforcedServiceModel implements IConvertible
{
    SMSContact? From;
    List<SMSContact>? To;
    String? MessageBody;
    bool? ReplyIsAllowed;
    bool? ReplyIsRequired;
    String? Notes;
    String? LinkedObjectId;
    String? SuiteId;

    SMSModel({this.From,this.To,this.MessageBody,this.ReplyIsAllowed,this.ReplyIsRequired,this.Notes,this.LinkedObjectId,this.SuiteId});
    SMSModel.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        From = JsonConverters.fromJson(json['From'],'SMSContact',context!);
        To = JsonConverters.fromJson(json['To'],'List<SMSContact>',context!);
        MessageBody = json['MessageBody'];
        ReplyIsAllowed = json['ReplyIsAllowed'];
        ReplyIsRequired = json['ReplyIsRequired'];
        Notes = json['Notes'];
        LinkedObjectId = json['LinkedObjectId'];
        SuiteId = json['SuiteId'];
        return this;
    }

    Map<String, dynamic> toJson() => super.toJson()..addAll({
        'From': JsonConverters.toJson(From,'SMSContact',context!),
        'To': JsonConverters.toJson(To,'List<SMSContact>',context!),
        'MessageBody': MessageBody,
        'ReplyIsAllowed': ReplyIsAllowed,
        'ReplyIsRequired': ReplyIsRequired,
        'Notes': Notes,
        'LinkedObjectId': LinkedObjectId,
        'SuiteId': SuiteId
    });

    getTypeName() => "SMSModel";
    TypeContext? context = _ctx;
}

/**
* Saves the specified SMS and sends it for background processing
*/
// @Api(Description="Saves the specified SMS and sends it for background processing")
class SMSSend implements IConvertible
{
    SMSModel? SMSModel;
    bool? CreateCommunicationReferencesImmediately;

    SMSSend({this.SMSModel,this.CreateCommunicationReferencesImmediately});
    SMSSend.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        SMSModel = JsonConverters.fromJson(json['SMSModel'],'SMSModel',context!);
        CreateCommunicationReferencesImmediately = json['CreateCommunicationReferencesImmediately'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'SMSModel': JsonConverters.toJson(SMSModel,'SMSModel',context!),
        'CreateCommunicationReferencesImmediately': CreateCommunicationReferencesImmediately
    };

    getTypeName() => "SMSSend";
    TypeContext? context = _ctx;
}

TypeContext _ctx = TypeContext(library: 'production_eros_gateway_api_sms_wa.azurewebsites.net', types: <String, TypeInfo> {
    'CommResponse': TypeInfo(TypeOf.Class, create:() => CommResponse()),
    'BaseLicenseeEnforcedServiceModel': TypeInfo(TypeOf.Class, create:() => BaseLicenseeEnforcedServiceModel()),
    'SMSContact': TypeInfo(TypeOf.Class, create:() => SMSContact()),
    'SMSModel': TypeInfo(TypeOf.Class, create:() => SMSModel()),
    'List<SMSContact>': TypeInfo(TypeOf.Class, create:() => <SMSContact>[]),
    'SMSSend': TypeInfo(TypeOf.Class, create:() => SMSSend()),
});

Dart SMSSend DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other

HTTP + OTHER

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /api/sendmessage HTTP/1.1 
Host: production-eros-gateway-api-sms-wa.azurewebsites.net 
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length

{"SMSModel":{"From":{"Name":"String","PhoneNumber":"String","ContactId":"00000000000000000000000000000000"},"To":[{"Name":"String","PhoneNumber":"String","ContactId":"00000000000000000000000000000000"}],"MessageBody":"String","ReplyIsAllowed":false,"ReplyIsRequired":false,"Notes":"String","LinkedObjectId":"00000000000000000000000000000000","SuiteId":"00000000000000000000000000000000","LicenseeId":"00000000000000000000000000000000"},"CreateCommunicationReferencesImmediately":false}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

{"CommId":"00000000000000000000000000000000","Reference":"String","Status":false,"Message":"String"}