Message Archiving

Message Archiving allows you to preserve campaign messages across various channels for customer service and regulatory compliance purposes. When enabled, each message sent during a campaign is archived and stored in your external storage bucket (e.g., Amazon S3 or GCS).

How It Works

Once you've set up your storage credentials, message archiving happens automatically:

  1. Your campaign messages are automatically captured when sent
  2. Messages are archived to your configured storage location
  3. Files are organized according to your path configuration

The process happens seamlessly in the background without affecting campaign performance. As long as valid credentials are configured, all eligible messages will be archived.

Configuring Message Archiving

To enable message archiving:

  1. Navigate to Settings
  2. Select the Credentials in the Message Archiving section
  3. Configure your storage credentials and path settings

Path Configuration

You can customize how archived messages are organized in your storage by configuring the order of path components in the Path builder section under Credentials. This determines the folder structure in which your files will be stored in your bucket.

The Path builder shows available components like:

  • brand/
  • customerId/
  • campaignType/
  • campaignId/campaignSeriesId/
  • channel/
  • contact

You can drag these components to change their order in the path. For example, if you arrange them as shown in the screenshot (brand → customerId → campaignType → campaignId/campaignSeriesId → channel → contact), your archived messages would be stored in a path structure like:

/brandname/hashedcustomerid/campaigntype/campaignid_or_seriesid/channel/hashedcontact/message_filename.json

You can customize how archived messages are organized in your storage by configuring path components in the Path builder section under Credentials. For example, you might organize files by:

  • Campaign ID
  • Campaign Series ID
  • Channel
  • Brand
  • Other available parameters

Identifier Hashing

Customer ID and contact values are hashed to ensure compatibility with storage folder naming restrictions:

  • We hash customerId and contact values using SHA-1
  • Implementation: createHash('sha1').update(data).digest('hex')

Note for searching archived messages: To locate messages for a specific customer or contact, you'll need to generate the same SHA-1 hash of the identifier before searching in your storage system.


Example Archived Messages

Messages will follow this structure:

{
  "version": 1,
  "tenantId": 3013,
  "customerId": "exampleCustomerId",
  "channel": "optitext_sms",
  "sentAt": "2025-03-20T12:22:06Z",
  "metadata": {
    "brand": "Your Brand Name",
    "campaignId": 32,
    "campaignSeriesId": 32,
    "campaignType": "scheduled",
    "templateId": 1741687511620,
    "templateName": "Test Sms Template"
  },
  "content": {
    "from": "000000000000",
    "to": "000000000000",
    "payload": {
      "body": "Hello. This is an example sms message."
    }
  }
}
{
    "version": 1,
    "tenantId": 3013,
    "customerId": "exampleCustomerId",
    "channel": "optimobile_push",
    "sentAt": "2025-04-16T10:27:21Z",
    "metadata": {
      "brand": "Your Brand Name",
      "campaignId": 12345,
      "campaignSeriesId": 1999,
      "campaignType": "triggered",
      "templateId": 1744799126438,
      "templateName": "Test push template",
      "actionId": 789
    },
    "content": {
      "platform": "ios",
      "to": "examplePushToken...",
      "payload": {
        "headers": {
          "apns_push_type": "alert",
          "apns_expiration": 1745058441,
          "apns_priority": 10,
          "apns_topic": "com.optimove.sdk.optimovemobileclientnofirebase",
          "apns_collapse_id": null
        },
        "body": {
          "aps": {
            "sound": "default",
            "content_available": null,
            "alert": {
              "title": "Push notification title",
              "body": "Push notification body"
            },
            "mutable_content": 1,
            "category": null,
            "interruption_level": null,
            "relevance_score": null,
            "badge": null
          },
          "attachments": {
            "pictureUrl": "https://someimageurl.com/image.png"
          },
          "custom": "{\"a\":{\"k.message\":{\"type\":1,\"data\":{\"id\":4195}}}}"
        }
      }
    }
  }

Error Handling

The Message Archiving Errors page displays issues that you can resolve, such as:

  • Storage authentication failures
  • Permission errors
  • Configuration issues

Each error includes details to help you troubleshoot and resolve the issue.


Best Practices

  • Regularly verify your storage credentials
  • Implement appropriate retention policies for archived messages
  • Test the archiving configuration before running large campaigns