SMS Opt In/Out Queue

Knowledge Base Home

Search the Omeda Knowledge Base

Summary

The Opt In/Out Queue API allows our client to opt in or out their subscribers or customers to their SMS Message Types at the message type level.

Base Resource URI

For Production, use: https://ows.omeda.com/webservices/rest/brand/{brandAbbreviation}/messageoptqueue/* For Testing, use: https://ows.omedastaging.com/webservices/rest/brand/{brandAbbreviation}/messageoptqueue/*

brandAbbreviation is the abbreviation for the brand who is posting the data.

Technical Requirements

The HTTP header must contain the following elements: x-omeda-appid a unique id provided to you by Omeda to access your data. The request will fail without a valid id. content-type a content type supported by this resource. See Supported Content Types for more details. If omitted, the default content type is application/json.

Supported Content Types

There are three content types supported. If omitted, the default content type is application/json. JSON application/json

JSON is the preferred data exchange format, because it is lightweight and, in most cases, faster to process and utilizes less bandwidth. There are many available open-source JSON libraries available. See json.org for details.

Supported HTTP Methods

There is one HTTP method supported: POST See W3C’s POST specs for details.

Field Definition

The following tables describe the data elements that can be included in the POST method to store data in the database.

Opts Elements

Attribute Name

Required?

Data Type

Description

Attribute Name

Required?

Data Type

Description

SiteId

Optional

Integer

The Form ID of where the message type opt in/out is posting from.

SiteSessionId

Optional

String

The site session id of the request.

CountryCallingCode

Required

Integer

The country calling code of the customer’s cell phone number for which the message type opt in/out is requested.

PhoneNumber

Required

Integer

The customer’s cell phone number for which the message type opt-in/out is requested.

MessageOpts

Optional

Array

Array element containing one or multiple MessageOpts elements (see below)

MessageOpts Elements

Attribute Name

Required?

Data Type

Description

Attribute Name

Required?

Data Type

Description

Status

Required

Integer

Value of the opt in/out requested. 0 or 1.

1 = opt in
0 = opt out

MessageTypeId

Required

Integer

The message type id for which the opt in/out is requested.

DeleteOptOut

optional

integer

0 or 1, 0 = No delete, 1 = Delete.

Request Examples

In these examples, we’re submitting:

A Message Type-level OptIn for Message Type Id 6 for cell phone number +16303303039, and we want to delete all corresponding OptOuts for that cell phone number (DeleteOptOut=1) A Message Type-level OptIn for Message Types 7 for cell phone number +17083303909, but do not delete all corresponding OptOuts for that cell phone number (no DeleteOptOut)

JSON Example

{ "SiteId": 498, "SiteSessionId": "ECD8906C31075A7A44F98F39E5F57671", "PhoneNumber": "6303303039", "CountryCallingCode": 1, "MessageOpts": [ { "Status": 1, "DeleteOptOut": 1, "MessageTypeId": [ 6 ] } ] }

 

Response Examples

Two responses are possible: a successful POST (200 OK Status) or a failed POST (400 Bad Request/403 Forbidden/404 Not Found/405 Method Not Allowed Statuses). See W3C’s Status Codes.

Successful Submission

A successful POST submission may create Opt in/out entries. Messages may be returned in some cases.

JSON Example

If all Opts have been processed Without any messages returned, you will get the following response:

If you submit a request Without “DeleteOptOut”:1, it may be possible that zero, one or more OptIns have not been processed. A “Message” element will describe the reason why the specific OptIn has not been processed.

Failed Submission

A failed POST submission may be due to several factors:

Status

Description

Status

Description

400 Bad Request

Typically, this error occurs when the request does not follow the specifications.

403 Forbidden

Typically, this error occurs when the credentials are erroneous. Potentially, an incorrect x-omeda-appid.

404 Not Found

Typically, this error occurs with a malformed URL or the resource that is searched for is not found.

405 Method Not Allowed

Typically, this error occurs when the resource accessed is not allowed by the HTTP Method utilized. Make sure you employ the correct HTTP Method (POST) for this request.

This is not an exhaustive list of errors, but common ones. If an error occurs repeatedly, please contact your Omeda representative.

IMPORTANT: If an error occurs, NONE of the Opts submitted will be processed. The errors array simply indicates the reason why the request was rejected. Fixing the errors in the error array and resubmitting the request should work, provided no new errors have been re-introduced. Please contact your Omeda representative if you need assistance.

JSON Example

For each MessageTypeId submitted, our system verifies that it belongs to a BrandId, and that the BrandId is authorized to receive Opts for the x-omeda-appid submitted. If this occurs, you would get the error message below.

Additional Information

DeleteOptOut Rules

By convention, we use “DeleteOptOut” to determine whether an ‘IN’ submission will override an existing ‘OUT’ submission.

Rule

Action

Rule

Action

DeleteOptOut not set to 1 or omitted

If an ‘OUT’ entry exists in the database for the given submission, then the ‘IN’ is not written for this submission. The ‘OUT’ remains.

DeleteOptOut = 1

If an ‘OUT’ entry exists for a submission, it will be overwritten with the ‘IN’ that is being submitted.