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 Foundation
import ServiceStack

/**
* Saves the specified SMS and sends it for background processing
*/
// @Api(Description="Saves the specified SMS and sends it for background processing")
public class SMSSend : Codable
{
    public var smsModel:SMSModel
    public var createCommunicationReferencesImmediately:Bool

    required public init(){}
}

public class SMSModel : BaseLicenseeEnforcedServiceModel
{
    public var from:SMSContact
    public var to:[SMSContact]
    public var messageBody:String
    public var replyIsAllowed:Bool
    public var replyIsRequired:Bool
    public var notes:String
    public var linkedObjectId:String
    public var suiteId:String

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case from
        case to
        case messageBody
        case replyIsAllowed
        case replyIsRequired
        case notes
        case linkedObjectId
        case suiteId
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        from = try container.decodeIfPresent(SMSContact.self, forKey: .from)
        to = try container.decodeIfPresent([SMSContact].self, forKey: .to) ?? []
        messageBody = try container.decodeIfPresent(String.self, forKey: .messageBody)
        replyIsAllowed = try container.decodeIfPresent(Bool.self, forKey: .replyIsAllowed)
        replyIsRequired = try container.decodeIfPresent(Bool.self, forKey: .replyIsRequired)
        notes = try container.decodeIfPresent(String.self, forKey: .notes)
        linkedObjectId = try container.decodeIfPresent(String.self, forKey: .linkedObjectId)
        suiteId = try container.decodeIfPresent(String.self, forKey: .suiteId)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if from != nil { try container.encode(from, forKey: .from) }
        if to != nil { try container.encode(to, forKey: .to) }
        if messageBody != nil { try container.encode(messageBody, forKey: .messageBody) }
        if replyIsAllowed != nil { try container.encode(replyIsAllowed, forKey: .replyIsAllowed) }
        if replyIsRequired != nil { try container.encode(replyIsRequired, forKey: .replyIsRequired) }
        if notes != nil { try container.encode(notes, forKey: .notes) }
        if linkedObjectId != nil { try container.encode(linkedObjectId, forKey: .linkedObjectId) }
        if suiteId != nil { try container.encode(suiteId, forKey: .suiteId) }
    }
}

public class BaseLicenseeEnforcedServiceModel : Codable
{
    public var licenseeId:String

    required public init(){}
}

public class SMSContact : Codable
{
    public var name:String
    public var phoneNumber:String
    public var contactId:String

    required public init(){}
}

public class CommResponse : Codable
{
    public var commId:String
    public var reference:String
    public var status:Bool
    public var message:String

    required public init(){}
}


Swift 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"}