Required role: | User |
POST | /sessions/{sessionId}/messages | ||
---|---|---|---|
All Verbs | /messages |
import java.math.*;
import java.util.*;
import java.io.InputStream;
import net.servicestack.client.*;
public class dtos
{
public static class SendMessage
{
/**
* The ID of the session you want to post a message to. Specify either this or EndpointId+ToAddress
*/
@ApiMember(Description="The ID of the session you want to post a message to. Specify either this or EndpointId+ToAddress")
public String sessionId = null;
/**
* The ID of the endpoint you want to post a message to. Typically the ID of a phone number endpoint. Not used if SessionId is specified
*/
@ApiMember(Description="The ID of the endpoint you want to post a message to. Typically the ID of a phone number endpoint. Not used if SessionId is specified")
public String endpointId = null;
/**
* The address of the party you want to send a message to, e.g. +15556667777. Not used if SessionId is specified
*/
@ApiMember(Description="The address of the party you want to send a message to, e.g. +15556667777. Not used if SessionId is specified")
public String toAddress = null;
/**
* The body of the message
*/
@ApiMember(Description="The body of the message")
public String body = null;
public String getSessionId() { return sessionId; }
public SendMessage setSessionId(String value) { this.sessionId = value; return this; }
public String getEndpointId() { return endpointId; }
public SendMessage setEndpointId(String value) { this.endpointId = value; return this; }
public String getToAddress() { return toAddress; }
public SendMessage setToAddress(String value) { this.toAddress = value; return this; }
public String getBody() { return body; }
public SendMessage setBody(String value) { this.body = value; return this; }
}
public static class MessageInfo
{
public String id = null;
public String accountId = null;
public String customerId = null;
public String endpointId = null;
public String endpointDisplayName = null;
public String date = null;
public MessageDirections direction = null;
public String otherAddress = null;
public String sender = null;
public String text = null;
public Boolean isUnread = null;
public String getId() { return id; }
public MessageInfo setId(String value) { this.id = value; return this; }
public String getAccountId() { return accountId; }
public MessageInfo setAccountId(String value) { this.accountId = value; return this; }
public String getCustomerId() { return customerId; }
public MessageInfo setCustomerId(String value) { this.customerId = value; return this; }
public String getEndpointId() { return endpointId; }
public MessageInfo setEndpointId(String value) { this.endpointId = value; return this; }
public String getEndpointDisplayName() { return endpointDisplayName; }
public MessageInfo setEndpointDisplayName(String value) { this.endpointDisplayName = value; return this; }
public String getDate() { return date; }
public MessageInfo setDate(String value) { this.date = value; return this; }
public MessageDirections getDirection() { return direction; }
public MessageInfo setDirection(MessageDirections value) { this.direction = value; return this; }
public String getOtherAddress() { return otherAddress; }
public MessageInfo setOtherAddress(String value) { this.otherAddress = value; return this; }
public String getSender() { return sender; }
public MessageInfo setSender(String value) { this.sender = value; return this; }
public String getText() { return text; }
public MessageInfo setText(String value) { this.text = value; return this; }
public Boolean getIsUnread() { return isUnread; }
public MessageInfo setIsUnread(Boolean value) { this.isUnread = value; return this; }
}
public static enum MessageDirections
{
Incoming,
Outgoing;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /sessions/{sessionId}/messages HTTP/1.1
Host: team.evovoice.io
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length
{"sessionId":"String","endpointId":"String","toAddress":"String","body":"String"}
HTTP/1.1 200 OK Content-Type: text/jsonl Content-Length: length {"id":"String","accountId":"String","customerId":"String","endpointId":"String","endpointDisplayName":"String","date":"String","direction":"Incoming","otherAddress":"String","sender":"String","text":"String","isUnread":false}