Content - WhatsApp Session Message (Connect API)

POST Create WhatsApp session message content

POST /services/data/{apiVersion}/connect/cms/contents/whatsappSession

Operation ID: createWhatsAppSession. Tags: WhatsApp Session Content.

Creates a WhatsApp session message content item. The content body includes the message title, type, and content block configuration.

Request body (required)

Media type: application/json. Schema: WhatsAppSessionContentRequest.

Example: textMessage Text session message.

{
  "contentSpaceOrFolderId": "0Zuxx00000003M5CAI",
  "contentType": "sfdc_cms__whatsappSession",
  "contentBody": {
    "sfdc_cms:title": "WhatsApp Session Message",
    "description": "WhatsApp Session Message for Testing.",
    "messageType": "Text",
    "contentBlock": {
      "type": "block",
      "definition": "sfdc_cms__whatsappMessageTypeText",
      "attributes": {
        "sfdc_cms:whatsappMessageBody": "This is a test message.",
        "type": "Text"
      }
    }
  }
}

Example: textWithPersonalization Text message with Handlebars personalization.

{
  "contentSpaceOrFolderId": "0Zuxx00000003M5CAI",
  "contentType": "sfdc_cms__whatsappSession",
  "contentBody": {
    "sfdc_cms:title": "Personalized Welcome Message",
    "description": "Welcome message with customer name.",
    "messageType": "Text",
    "contentBlock": {
      "type": "block",
      "definition": "sfdc_cms__whatsappMessageTypeText",
      "attributes": {
        "sfdc_cms:whatsappMessageBody": "Hello {{$unifiedIndividual.FirstName}}, welcome to our service!",
        "type": "Text"
      }
    },
    "lightning:dataProviders": [
      {
        "sfdcExpressionKey": "$unifiedIndividual",
        "definition": "sfdc_cms__unifiedIndividualDataProvider",
        "attributes": {
          "objectApiName": "UnifiedIndividual__dlm"
        }
      }
    ]
  }
}

Example: imageMessage Image session message.

{
  "contentSpaceOrFolderId": "0Zuxx00000003M5CAI",
  "contentType": "sfdc_cms__whatsappSession",
  "contentBody": {
    "sfdc_cms:title": "Promotional Image Message",
    "description": "Image message with product photo.",
    "messageType": "Image",
    "contentBlock": {
      "type": "block",
      "definition": "sfdc_cms__whatsappMessageTypeImage",
      "attributes": {
        "type": "Image",
        "header": {
          "type": "block",
          "definition": "sfdc_cms__whatsappMessageHeaderImage",
          "attributes": {
            "link": {
              "source": {
                "type": "imageReference",
                "ref": {
                  "contentKey": "MC5IEGQZHII5GEJLZW5DVSAZHSRI"
                }
              },
              "url": "/services/data/{apiVersion}/connect/cms/media/MC5IEGQZHII5GEJLZW5DVSAZHSRI?version=1.1&fileName=promo.png"
            }
          }
        }
      }
    }
  }
}

Example: videoMessage Video session message.

{
  "contentSpaceOrFolderId": "0Zuxx00000003M5CAI",
  "contentType": "sfdc_cms__whatsappSession",
  "contentBody": {
    "sfdc_cms:title": "Product Demo Video",
    "description": "Video message with product demonstration.",
    "messageType": "Video",
    "contentBlock": {
      "type": "block",
      "definition": "sfdc_cms__whatsappMessageTypeVideo",
      "attributes": {
        "type": "Video",
        "header": {
          "type": "block",
          "definition": "sfdc_cms__whatsappMessageHeaderVideo",
          "attributes": {
            "link": {
              "source": {
                "type": "videoReference",
                "ref": {
                  "contentKey": "MC5VIDQZHII5GEJLZW5DVSAZHSRI"
                }
              },
              "url": "/services/data/{apiVersion}/connect/cms/media/MC5VIDQZHII5GEJLZW5DVSAZHSRI?version=1.0&fileName=demo.mp4"
            }
          }
        }
      }
    }
  }
}

Example: documentMessage Document session message.

{
  "contentSpaceOrFolderId": "0Zuxx00000003M5CAI",
  "contentType": "sfdc_cms__whatsappSession",
  "contentBody": {
    "sfdc_cms:title": "Invoice Document",
    "description": "Document message with PDF attachment.",
    "messageType": "Document",
    "contentBlock": {
      "type": "block",
      "definition": "sfdc_cms__whatsappMessageTypeDocument",
      "attributes": {
        "type": "Document",
        "header": {
          "type": "block",
          "definition": "sfdc_cms__whatsappMessageHeaderDocument",
          "attributes": {
            "link": {
              "source": {
                "type": "documentReference",
                "ref": {
                  "contentKey": "MC5DOCQZHII5GEJLZW5DVSAZHSRI"
                }
              },
              "url": "/services/data/{apiVersion}/connect/cms/media/MC5DOCQZHII5GEJLZW5DVSAZHSRI?version=1.0&fileName=invoice.pdf"
            }
          }
        }
      }
    }
  }
}

Example: audioMessage Audio session message.

{
  "contentSpaceOrFolderId": "0Zuxx00000003M5CAI",
  "contentType": "sfdc_cms__whatsappSession",
  "contentBody": {
    "sfdc_cms:title": "Audio Greeting",
    "messageType": "Audio",
    "contentBlock": {
      "type": "block",
      "definition": "sfdc_cms__whatsappMessageTypeAudio",
      "attributes": {
        "type": "Audio",
        "header": {
          "type": "block",
          "definition": "sfdc_cms__whatsappMessageHeaderAudio",
          "attributes": {
            "link": {
              "source": {
                "type": "audioReference",
                "ref": {
                  "contentKey": "MC5AUDQZHII5GEJLZW5DVSAZHSRI"
                }
              },
              "url": "/services/data/{apiVersion}/connect/cms/media/MC5AUDQZHII5GEJLZW5DVSAZHSRI?version=1.0&fileName=greeting.mp3"
            }
          }
        }
      }
    }
  }
}

Example: locationRequestMessage Location request session message.

{
  "contentSpaceOrFolderId": "0Zuxx00000003M5CAI",
  "contentType": "sfdc_cms__whatsappSession",
  "contentBody": {
    "sfdc_cms:title": "Request Customer Location",
    "description": "Ask for delivery location.",
    "messageType": "Location Request",
    "contentBlock": {
      "type": "block",
      "definition": "sfdc_cms__whatsappMessageTypeLocationRequest",
      "attributes": {
        "type": "Location Request"
      }
    }
  }
}

Example: ctaUrlButtonMessage CTA URL Button session message.

{
  "contentSpaceOrFolderId": "0Zuxx00000003M5CAI",
  "contentType": "sfdc_cms__whatsappSession",
  "contentBody": {
    "sfdc_cms:title": "Visit Our Website CTA",
    "description": "CTA button linking to website.",
    "messageType": "CTA URL Button",
    "contentBlock": {
      "type": "block",
      "definition": "sfdc_cms__whatsappMessageTypeCtaUrlButton",
      "attributes": {
        "type": "CTA URL Button",
        "sfdc_cms:whatsappMessageBody": "Check out our latest offers!",
        "footer": {
          "type": "block",
          "definition": "sfdc_cms__whatsappMessageFooter",
          "attributes": {
            "text": "Tap below to visit"
          }
        },
        "ctaButton": {
          "type": "block",
          "definition": "sfdc_cms__whatsappMessageCtaButton",
          "attributes": {
            "displayText": "Visit Website",
            "url": "https://example.com/offers"
          }
        }
      }
    }
  }
}

Responses

  • 201 WhatsApp session message content created successfully.

    Media type: application/json. Schema: WhatsAppSessionContentResponse.

    Example: complete Complete response.

    {
      "apiName": "MCJUR5WKNRHZFP7NAUQOMMNJ7CI4",
      "contentBody": {
        "sfdc_cms:title": "WhatsApp Session Message",
        "description": "WhatsApp Session Message for Testing.",
        "messageType": "Text",
        "contentBlock": {
          "type": "block",
          "definition": "sfdc_cms__whatsappMessageTypeText",
          "attributes": {
            "sfdc_cms:whatsappMessageBody": "This is a test message.",
            "type": "Text"
          }
        }
      },
      "contentFqn": "marketing--Default_Content_Workspace.sfdc_cms__whatsappSession--MCJUR5WKNRHZFP7NAUQOMMNJ7CI4",
      "contentKey": "MCJUR5WKNRHZFP7NAUQOMMNJ7CI4",
      "contentSpace": {
        "id": "0ZuSB000002FYzW0AW",
        "resourceUrl": "/services/data/v68.0/connect/cms/spaces/0ZuSB000002FYzW"
      },
      "contentType": {
        "fullyQualifiedName": "sfdc_cms__whatsappSession"
      },
      "createdBy": {
        "id": "005SB00000eaki1YAA",
        "name": "Admin User",
        "resourceUrl": "/services/data/v68.0/chatter/users/005SB00000eaki1YAA"
      },
      "createdDate": "2026-06-16T20:34:56.000Z",
      "externalId": null,
      "folder": {
        "id": "9PuSB000002KUDo0AO",
        "resourceUrl": "/services/data/v68.0/connect/cms/folders/9PuSB000002KUDo0AO"
      },
      "isPublished": false,
      "language": "en_US",
      "lastModifiedBy": {
        "id": "005SB00000eaki1YAA",
        "name": "Admin User",
        "resourceUrl": "/services/data/v68.0/chatter/users/005SB00000eaki1YAA"
      },
      "lastModifiedDate": "2026-06-16T20:34:56.000Z",
      "managedContentId": "20YSB000004SkOz2AK",
      "managedContentVariantId": "9PsSB0000045XAj0AM",
      "managedContentVersionId": "5OUSB000004K7np4AC",
      "status": {
        "label": "Draft",
        "status": "Draft"
      },
      "title": "WhatsApp Session Message",
      "urlName": "whatsapp-session-message",
      "versionNumber": "1.1"
    }
  • 400 Invalid request body.

    Media type: application/json. Schema: Error.

    Example: missingTitle Missing required sfdc_cms:title.

    {
      "error": "VALIDATION_ERROR",
      "message": "Required field 'sfdc_cms:title' is missing",
      "details": [
        {
          "field": "contentBody.sfdc_cms:title",
          "message": "Title: Complete this field."
        }
      ]
    }

    Example: missingMessageType Missing required messageType.

    {
      "error": "VALIDATION_ERROR",
      "message": "Required field 'messageType' is missing",
      "details": [
        {
          "field": "contentBody.messageType",
          "message": "Message Type: Complete this field."
        }
      ]
    }

    Example: invalidMessageType Invalid message type value.

    {
      "error": "VALIDATION_ERROR",
      "message": "Invalid value for field 'messageType'",
      "details": [
        {
          "field": "contentBody.messageType",
          "message": "Type must be one of: Text, Image, Video, Document, Audio, Location Request, CTA URL Button"
        }
      ]
    }

    Example: additionalProperties Additional properties not allowed.

    {
      "error": "VALIDATION_ERROR",
      "message": "Additional properties are not allowed",
      "details": [
        {
          "field": "contentBody.invalidProperty",
          "message": "You can't add the invalidProperty property because additionalProperties is set to false."
        }
      ]
    }

    Example: bodyTooLong The message body exceeds the maximum length.

    {
      "error": "VALIDATION_ERROR",
      "message": "Field exceeds maximum length",
      "details": [
        {
          "field": "contentBody.contentBlock.attributes.sfdc_cms:whatsappMessageBody",
          "message": "Message body must be 2000 characters or fewer"
        }
      ]
    }
  • 401 Unauthorized.

    Media type: application/json. Schema: Error.

    Example: response Example response.

    {
      "error": "UNAUTHORIZED",
      "message": "Authentication credentials are missing or invalid"
    }
  • 403 Forbidden.

    Media type: application/json. Schema: Error.

    Example: response Example response.

    {
      "error": "FORBIDDEN",
      "message": "Insufficient permissions to create WhatsApp session message content"
    }
  • 500 Internal server error.

    Media type: application/json. Schema: Error.

    Example: response Example response.

    {
      "error": "INTERNAL_SERVER_ERROR",
      "message": "An unexpected error occurred while processing the request"
    }
  • 503 Service unavailable.

    Media type: application/json. Schema: Error.

    Example: response Example response.

    {
      "error": "SERVICE_UNAVAILABLE",
      "message": "The service is temporarily unavailable. Please try again later"
    }