{  "openapi": "3.0.1",  "info": {    "title": "MESSAGING",    "description": "Zipabout Messaging API",    "contact": {},    "version": "1.0.9"  },  "security": [    {      "api_key": []    }  ],  "paths": {    "/message/send": {      "summary": "Send a message",      "post": {        "summary": "Send message with payload",        "parameters": [          {            "name": "sender-id",            "in": "query",            "required": true,            "description": "Identifier to represent who is sending this message",            "schema": {              "type": "string",              "description": "Identifier to represent who is sending this message"            },            "example": "nre|lner|scotrail"          },          {            "name": "msg-type",            "in": "query",            "required": true,            "description": "Type of message to be sent, in order for correct message template to be selected and populated with data in the payload.",            "schema": {              "type": "string",              "description": "Type of message to be sent, in order for correct message template to be selected and populated with data in the payload."            },            "example": "journeyplan|origindelay|stationinfo|platformupdate"          },          {            "name": "language",            "in": "query",            "required": false,            "description": "Language override of message to be sent. Defaults to user preference, or English.",            "schema": {              "type": "string",              "description": "Language override of message to be sent. Defaults to user preference, or English."            },            "example": "en-gb"          },          {            "name": "channel",            "in": "query",            "required": false,            "description": "Messaging provider identifier override. Defaults to user preference/agreed channel.",            "schema": {              "type": "string",              "description": "Messaging provider identifier override. Defaults to user preference/agreed channel."            },            "example": "facebook"          },          {            "name": "channel-id",            "in": "query",            "required": false,            "description": "Optional override specifying the exact channel to use for given platform",            "schema": {              "type": "string",              "description": "Optional override specifying the exact channel to use for given platform"            }          },          {            "name": "recipients",            "in": "query",            "required": true,            "description": "List of potential recipients for this message",            "schema": {              "type": "array",              "description": "List of potential recipients for this message",              "items": {                "type": "string"              }            },            "example": "user_id_1,user_id_2"          },          {            "name": "duplication-suppression",            "in": "query",            "required": false,            "description": "Defaults to true (duplicates are ignored), setting to false enables duplicate messages to be delivered",            "schema": {              "type": "boolean",              "description": "Mode for suppressing duplicate messages"            }          },          {            "name": "no-op-mode",            "in": "query",            "required": false,            "description": "Pass true to enter no operation mode, no messages will be delivered, only logged as if they were.",            "schema": {              "type": "boolean",              "description": "No operation mode"            }          },          {            "name": "delay-by",            "in": "query",            "required": false,            "description": "Duration to delay message delivery by in seconds",            "schema": {              "type": "number",              "description": "Delay message delivery by"            }          },          {            "name": "preserve-order",            "in": "query",            "required": false,            "description": "Guarantees messages are delivered in order",            "schema": {              "type": "boolean",              "description": "Preserve message ordering"            }          },          {            "name": "journeyId",            "in": "query",            "required": false,            "description": "Optional field to associate message with a journeyId, which will be logged alongside the message to allow history endpoint to access messages delivered for a specific journey.",            "schema": {              "type": "string",              "description": "Associate message with journey"            }          },          {            "name": "trace-id",            "in": "query",            "required": false,            "description": "Internal zipabout unique identifier to trace message send attempt (derived from part of system that wants to send a message)",            "schema": {              "type": "string",              "description": "Internal zipabout unique identifier to trace message send attempt (derived from part of system that wants to send a message)"            }          }        ],        "requestBody": {          "description": "JSON with key value pairs containing data to populate message template, format unique to msg-type\ne.g.\n{\n  \"my-key-1\": \"my-value-1\",\n\t\"my-key-2\": \"my-value-2\"\n}\n\nOR\n\nComma separated key-value pairs\ne.g.\nmy-key-1=my-value1,my-key-2=my-value-2",          "content": {            "application/json": {              "schema": {                "type": "object",                "description": "JSON with key value pairs containing data to populate message template, format unique to msg-type\ne.g.\n{\n  \"my-key-1\": \"my-value-1\",\n\t\"my-key-2\": \"my-value-2\"\n}\n\nOR\n\nComma separated key-value pairs\ne.g.\nmy-key-1=my-value1,my-key-2=my-value-2"              }            }          }        },        "responses": {          "200": {            "description": "Status 200",            "content": {              "application/json": {                "schema": {                  "type": "array",                  "items": {                    "$ref": "#/components/schemas/DeliveryAcceptanceInfo"                  }                }              }            }          },          "400": {            "description": "Status 400"          },          "401": {            "description": "Cannot deliver this message with given information"          },          "403": {            "description": "Incorrect api key provided or failed authentication"          }        },        "security": [          {            "api_key": []          }        ]      }    },    "/user/{userId}/history": {      "summary": "Retrieve user message history",      "get": {        "summary": "Get users message history",        "parameters": [          {            "name": "dateFrom",            "in": "query",            "required": false,            "description": "Retrieve messages that were delivered on or after this date. ISO-8601 date (YYYY-MM-DD). Defaults to 7 days ago.",            "schema": {              "type": "string",              "description": "Date that messages were delivered must be on or after this date."            },            "example": "2020-09-07"          },          {            "name": "dateTo",            "in": "query",            "required": false,            "description": "Retrieve messages that were delivered before this date. ISO-8601 date (YYYY-MM-DD). Defaults to today.",            "schema": {              "type": "string",              "description": "Date that messages were delivered must be before this date."            },            "example": "2020-09-08"          },          {            "name": "channel-id",            "in": "query",            "required": false,            "description": "Optional override specifying the exact channel to use for given platform",            "schema": {              "type": "string",              "description": "Optional override specifying the exact channel to use for given platform"            }          },          {            "name": "traceId",            "in": "query",            "required": false,            "description": "Unique identifier to trace request",            "schema": {              "type": "string",              "description": "Unique identifier to trace request"            }          }        ],        "responses": {          "200": {            "description": "Status 200",            "content": {              "application/json": {                "schema": {                  "type": "array",                  "description": "Array of messages sent related to this journey.",                  "items": {                    "$ref": "#/components/schemas/JourneyMessage"                  }                }              }            }          },          "400": {            "description": "Status 400"          },          "401": {            "description": "Cannot deliver this message with given information"          },          "403": {            "description": "Incorrect api key provided or failed authentication"          }        },        "security": [          {            "api_key": []          }        ]      },      "parameters": [        {          "name": "userId",          "in": "path",          "required": true,          "description": "User identifier for requested message history",          "schema": {            "type": "string",            "description": "User identifier for requested message history"          }        }      ]    },    "/message/deliverability": {      "get": {        "summary": "Query if message can be delivered through platform",        "parameters": [          {            "name": "sender-id",            "in": "query",            "required": true,            "description": "Identifier to represent who is sending this message",            "schema": {              "type": "string",              "description": "Identifier to represent who is sending this message"            },            "example": "nre|lner|scotrail"          },          {            "name": "channel",            "in": "query",            "required": false,            "description": "Messaging provider identifier override. Defaults to user preference/agreed channel.",            "schema": {              "type": "string",              "description": "Messaging provider identifier override. Defaults to user preference/agreed channel."            },            "example": "facebook"          },          {            "name": "recipients",            "in": "query",            "required": true,            "description": "List of potential recipients for this message",            "schema": {              "type": "array",              "description": "List of potential recipients for this message",              "items": {                "type": "string"              }            },            "example": "user_id_1,user_id_2"          }        ],        "responses": {          "200": {            "description": "Status 200",            "content": {              "application/json": {                "schema": {                  "type": "array",                  "items": {                    "$ref": "#/components/schemas/DeliverabilityInfo"                  }                }              }            }          },          "400": {            "description": "Status 400"          },          "401": {            "description": "Cannot deliver this message with given information"          },          "403": {            "description": "Incorrect api key provided or failed authentication",            "content": {              "application/json": {                "schema": {                  "type": "array",                  "items": {                    "$ref": "#/components/schemas/DeliveryAcceptanceInfo"                  }                }              }            }          }        },        "security": [          {            "api_key": []          }        ]      }    },    "/client/{source-id}/optin": {      "summary": "Opt in to messaging.",      "post": {        "summary": "Opt in to messaging with payload.",        "parameters": [          {            "name": "source-id",            "in": "path",            "required": true,            "description": "The source identifier for this opt-in. This value is provided by Zipabout and should be static for each data set.",            "schema": {              "type": "string",              "description": "The source identifier for this opt-in."            },            "example": "1"          },          {            "name": "user-id",            "in": "query",            "required": true,            "description": "The user id used in client system to uniquely identify a user.",            "schema": {              "type": "string",              "description": "The user id used in client system to uniquely identify a user."            },            "example": "a1b2c3d4e5"          }        ],        "requestBody": {          "description": "",          "content": {            "application/json": {              "schema": {                "type": "object",                "description": "Pre-agreed schema format for data to be delivered for this source. Any time-based data should be a epoch time in UTC (i.e. no time zone information). Seconds or Milliseconds accepted.",                "example": {                  "userData": {                    "yourCustomUserDataFormat": 123,                    "moreCustomDataFormat": "abc"                  },                  "serviceData": [                    {                      "originCode": "OXF",                      "originCodeType": "CRS",                      "destinationCode": "PAD",                      "destinationCodeType": "CRS",                      "isDeparture": true,                      "departureTime": 1571413982,                      "arrivalTime": 1571414882,                      "inbound": false,                      "mode": "bus|rail|metro",                      "timeZone": "+01:00"                    }                  ]                }              }            }          }        },        "responses": {          "200": {            "description": "Status 200",            "content": {              "application/json": {                "schema": {                  "type": "array",                  "items": {                    "$ref": "#/components/schemas/DataProcessingInfo"                  }                }              }            }          },          "400": {            "description": "Status 400 Bad request"          }        },        "security": [          {            "api_key": []          }        ]      }    },  },  "components": {    "schemas": {      "DeliveryAcceptanceInfo": {        "type": "object",        "required": [          "recipientId",          "status"        ],        "description": "Status representing acceptance for delivery of message to a user.",        "properties": {          "recipientId": {            "type": "string",            "description": "Recipient identifier."          },          "status": {            "type": "string",            "description": "text status representing ability or inability for message to be sent. \"[not ]accepted for delivery\"."          },          "uniqueMessageId": {            "type": "string",            "description": "Identifier representing the message to be delivered. Can be used in future correspondence/requests. Or \"deliveredExternally\" if not delivered by Zipabout."          }        },        "example": {          "recipientId": "123456",          "status": "accepted for delivery"        }      },      "DeliverabilityInfo": {        "type": "object",        "required": [          "recipientId",          "status"        ],        "description": "Status representing ability to deliver message to a user.",        "properties": {          "recipientId": {            "type": "string",            "description": "Recipient identifier."          },          "status": {            "type": "string",            "description": "text status representing ability or inability to deliver a message for given user. \"can[not] deliver\"."          }        },        "example": {          "recipientId": "123456",          "status": "can deliver"        }      },      "DataProcessingInfo": {        "type": "object",        "required": [          "uniqueDataId",          "status"        ],        "description": "Status representing acceptance of data processed.",        "properties": {          "uniqueDataIds": {            "type": "array",            "description": "GUIDs for data received in order to trace if required.",            "items": {              "type": "string"            }          },          "status": {            "type": "string",            "description": "Text status representing ability or inability process. \"ok|error\"."          },          "message": {            "type": "string",            "description": "Detail relating to any errors."          }        },        "example": {          "uniqueDataIds": [            "0024fece-7de0-42ec-aed7-94aafefe3e3a"          ],          "status": "ok"        }      },      "JourneyMessage": {        "type": "object",        "required": [          "messageType",          "platform",          "channelId",          "senderId",          "dataMappings",          "payload",          "dateCreated"        ],        "description": "Details of message delivered to a user",        "properties": {          "vehicleId": {            "type": "string",            "description": "Identifier representing vehicle that message was related to."          },          "messageType": {            "type": "string",            "description": "Type of message sent to user."          },          "platform": {            "type": "string",            "description": "Software platform that this message was generated for (facebook, whatsapp, etc)."          },          "channelId": {            "type": "string",            "description": "Identifier representing channel that this message was sent within."          },          "journeyId": {            "type": "string",            "description": "Identifier representing journey that this message was associated with."          },          "senderId": {            "type": "string",            "description": "Human readable identifier representing channel that message was sent to a user by."          },          "dataMappings": {            "type": "object",            "description": "JSON key value pairs reprsenting data used to construct message payload."          },          "payload": {            "type": "object",            "description": "JSON payload delivered to external messaging system (if applicable)."          },          "deliveryResponse": {            "type": "object",            "description": "Payload response returned by 3rd party for message delivery attempt."          },          "dateCreated": {            "type": "number",            "description": "Date/time that this message delivery attempt was made. Unix epoch time, in seconds since 1970."          },          "customData": {            "type": "object",            "description": "Free-form JSON containing additional data custom to specific client/use-case."          }        }      }    },    "securitySchemes": {      "api_key": {        "type": "apiKey",        "in": "header",        "name": "x-api-key"      }    }  }}