{"command":{"effect":"write","timeoutSeconds":30,"inputSchema":{"type":"object","description":"Create a campaign message.<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m`\n\n**Scopes:**\n`campaigns:write`\n\n[OpenAPI Spec](https://raw.githubusercontent.com/klaviyo/openapi/main/openapi/stable/apis/create_campaign_message.json)","properties":{"query":{"type":"object","properties":{"fields[campaign-message]":{"type":"array","items":{"type":"string","enum":["created","definition","definition.ab_test","definition.ab_test.winner_metric","definition.ab_test.winner_percentage","definition.ab_test.winner_wait_hours","definition.name","definition.send_options","definition.send_options.is_ignoring_unsubscribes","definition.send_options.recipient_percentage","definition.send_options.send_strategy","definition.send_options.send_time","definition.send_options.send_times","definition.send_options.throttle_unit","definition.send_options.throttling_type","definition.status","definition.tracking_options","definition.tracking_options.is_add_utm","definition.tracking_options.is_tracking_clicks","definition.tracking_options.is_tracking_opens","definition.tracking_options.tracking_params","id","updated"]},"description":"For more information please visit https://developers.klaviyo.com/en/v2026-10-15/reference/api-overview#sparse-fieldsets"}},"required":[],"additionalProperties":false},"headers":{"type":"object","properties":{"revision":{"type":"string","default":"2026-10-15","enum":["2026-10-15"],"description":"API endpoint revision (format: YYYY-MM-DD[.suffix])"}},"required":["revision"],"additionalProperties":false},"body":{"$ref":"#/definitions/MessageCreateQuery"}},"required":["headers","body"],"additionalProperties":false,"definitions":{"MessageCreateQuery":{"type":"object","properties":{"data":{"$ref":"#/definitions/MessageCreateQueryResourceObject"}},"required":["data"]},"MessageCreateQueryResourceObject":{"type":"object","properties":{"type":{"$ref":"#/definitions/CampaignMessageEnum"},"attributes":{"type":"object","properties":{"definition":{"$ref":"#/definitions/MessageDefinition"},"variations":{"description":"The variations for this message","type":["array","null"],"items":{"$ref":"#/definitions/VariationInlineCreate"}}},"required":["definition"]},"relationships":{"type":"object","properties":{"campaign":{"type":"object","properties":{"data":{"type":"object","properties":{"type":{"$ref":"#/definitions/CampaignEnum"},"id":{"description":"The parent campaign","type":"string"}},"required":["type","id"]}}},"campaign-audience":{"type":"object","properties":{"data":{"type":"object","properties":{"type":{"$ref":"#/definitions/CampaignAudienceEnum"},"id":{"description":"The audience this message targets","type":"string"}},"required":["type","id"]}}}},"required":["campaign","campaign-audience"]}},"required":["type","attributes","relationships"]},"CampaignMessageEnum":{"type":"string","enum":["campaign-message"]},"MessageDefinition":{"type":"object","properties":{"name":{"description":"The name of the message","type":["string","null"]},"status":{"description":"The status of the message","type":["string","null"],"enum":["cancelled","draft","scheduled","sending","sent"]},"tracking_options":{"$ref":"#/definitions/MessageTrackingOptions"},"send_options":{"$ref":"#/definitions/MessageSendOptions"},"ab_test":{"$ref":"#/definitions/ABTestSettings"}}},"VariationInlineCreate":{"type":"object","properties":{"definition":{"$ref":"#/definitions/VariationDefinition"}},"required":["definition"]},"CampaignEnum":{"type":"string","enum":["campaign"]},"CampaignAudienceEnum":{"type":"string","enum":["campaign-audience"]},"MessageTrackingOptions":{"type":"object","properties":{"is_add_utm":{"type":["boolean","null"]},"is_tracking_clicks":{"type":["boolean","null"]},"is_tracking_opens":{"type":["boolean","null"]},"tracking_params":{"type":["array","null"],"items":{"oneOf":[{"$ref":"#/definitions/StaticMessageTrackingParam"},{"$ref":"#/definitions/DynamicMessageTrackingParam"}]}}}},"MessageSendOptions":{"type":"object","properties":{"send_time":{"description":"The UTC send time for this message","type":["string","null"],"format":"date-time","examples":["2022-11-08T00:00:00+00:00"]},"send_times":{"description":"Per-variation send times, keyed by variation ID. Populated for send-time optimization and AB send time test strategies.","type":["object","null"]},"send_strategy":{"description":"The scheduling strategy for this message.","type":["string","null"],"enum":["ab_send_time_test","content_variation","content_variation_local_timezone","local_timezone","personalized_send_time_optimization","send_time_optimization","static","throttled","variation_per_second_throttled"]},"recipient_percentage":{"description":"The percentage of recipients to send this message to","type":["integer","null"]},"throttling_type":{"description":"The throttling type for this message","type":["string","null"],"enum":["none","throttle-for-campaigns","throttle-for-campaigns-and-flows","throttle-for-flows"]},"throttle_unit":{"description":"The time unit each batch of recipients is sent over for throttled sends.","type":["string","null"],"enum":["hour","minute"]},"is_ignoring_unsubscribes":{"description":"Whether to ignore unsubscribes for this message","type":["boolean","null"]}}},"ABTestSettings":{"type":"object","properties":{"winner_metric":{"description":"The metric used to pick the winning variation.","type":["string","null"],"enum":["clicks_unique","opens_unique","placed_orders_unique"]},"winner_percentage":{"description":"The percentage of the audience that receives the winning variation. The remainder is split evenly across the variations under test.","type":["integer","null"]},"winner_wait_hours":{"description":"How long to collect results before picking a winner, in hours.","type":["integer","null"]}}},"VariationDefinition":{"type":"object","properties":{"name":{"description":"The name of the variation","type":["string","null"]},"details":{"description":"The channel-specific content details for this variation","oneOf":[{"$ref":"#/definitions/EmailChannelDetails"},{"$ref":"#/definitions/SMSChannelDetails"},{"$ref":"#/definitions/PushChannelDetails"},{"$ref":"#/definitions/WhatsappChannelDetails"}]}}},"StaticMessageTrackingParam":{"type":"object","properties":{"type":{"type":"string","default":"static","enum":["static"],"examples":["static"]},"name":{"type":"string"},"value":{"type":"string"}},"required":["name","value"]},"DynamicMessageTrackingParam":{"type":"object","properties":{"type":{"type":"string","default":"dynamic","enum":["dynamic"],"examples":["dynamic"]},"name":{"type":"string"},"value":{"type":"string"}},"required":["name","value"]},"EmailChannelDetails":{"type":"object","properties":{"channel":{"type":"string","default":"email","enum":["email"],"examples":["email"]},"template_id":{"type":["string","null"]},"from_label":{"type":"string","default":""},"from_email":{"type":"string","default":""},"reply_to_email":{"type":"string","default":""},"cc_email":{"type":"string","default":""},"bcc_email":{"type":"string","default":""},"subject":{"type":"string","default":""},"preview_text":{"type":"string","default":""}}},"SMSChannelDetails":{"type":"object","properties":{"channel":{"type":"string","default":"sms","enum":["sms"],"examples":["sms"]},"template_id":{"type":["string","null"]},"cost":{"description":"Not allowed on create.","type":["number","null"]},"mms_static_image_asset_id":{"type":["integer","null"]},"shorten_links":{"type":["boolean","null"]},"include_contact_card":{"type":["boolean","null"]},"body":{"type":"string","default":""},"add_org_prefix":{"type":["boolean","null"]},"add_info_link":{"type":["boolean","null"]},"add_opt_out_language":{"type":["boolean","null"]},"mms_dynamic_image_template":{"type":["string","null"]},"text_message_type":{"description":"A sms message variation's text message type.\n\nValues match the Django OmniSMSTextMessageType (MESSAGE_FORMAT_*)\n    constants.","type":"string","default":"SMS","enum":["MMS","RCS","SMS"],"examples":["SMS"]},"message_hierarchy":{"type":["array","null"],"items":{"oneOf":[{"$ref":"#/definitions/MessageHierarchyRcsItem"},{"$ref":"#/definitions/MessageHierarchySmsItem"}]}}}},"PushChannelDetails":{"type":"object","properties":{"channel":{"type":"string","default":"push","enum":["push"],"examples":["push"]},"title":{"type":"string","default":""},"body":{"type":"string","default":""},"badge":{"type":"boolean","default":false},"badge_config":{"description":"A push message variation's badge config.","type":"string","default":"increment-one","enum":["increment-one","set-count","set-property"],"examples":["increment-one"]},"badge_value":{"type":"string","default":"1","examples":["1"]},"sound_file_name":{"type":"string","default":""},"static_asset_id":{"type":["integer","null"]},"sound":{"type":"boolean","default":false},"open_action":{"type":"integer","default":0},"dynamic_media_template":{"type":"string","default":""},"kv_pairs":{"type":["object","null"]},"push_type":{"description":"A push message variation's push type.","type":"string","default":"standard","enum":["silent","standard"],"examples":["standard"]},"ios_deep_link":{"type":["string","null"]},"android_deep_link":{"type":["string","null"]},"web_url":{"type":["string","null"]},"content_available":{"type":["boolean","null"]},"send_to_inbox":{"type":["boolean","null"]},"mutable_content":{"type":["boolean","null"]},"video_asset_id":{"type":["string","null"]},"action_buttons":{"type":["array","null"],"items":{"$ref":"#/definitions/PushActionButtonV0"}},"push_platform_target":{"type":["integer","null"]},"send_to_primary":{"type":["boolean","null"]}}},"WhatsappChannelDetails":{"type":"object","properties":{"channel":{"type":"string","default":"whatsapp","enum":["whatsapp"],"examples":["whatsapp"]},"template_id":{"type":["string","null"]},"shorten_links":{"type":"boolean","default":true,"examples":[true]}}},"MessageHierarchyRcsItem":{"type":"object","properties":{"message":{"description":"The plain text message content. Often empty for RCS when rich_content is used.","type":"string","default":""},"message_format":{"description":"The format of this message (always 'RCS' for RCS entries).","type":"string","default":"RCS","enum":["RCS"],"examples":["RCS"]},"rich_content":{"$ref":"#/definitions/RCSRichContent"},"extra":{"description":"Additional metadata for RCS messages. Legacy placement. This is typically used in rich_content.cards.extra.","type":["object","null"]},"image":{"$ref":"#/definitions/SlimImageReference"}}},"MessageHierarchySmsItem":{"type":"object","properties":{"message":{"description":"The plain text SMS message content.","type":"string","examples":["Check out our latest deals: https://example.com"]},"message_format":{"description":"The format of this message (always 'SMS' for SMS entries).","type":"string","default":"SMS","enum":["SMS"],"examples":["SMS"]},"extra":{"description":"Additional metadata for SMS messages (e.g., should_use_same_content flag).","type":["object","null"]},"image":{"description":"Image reference for MMS messages. Mutually exclusive with media.","oneOf":[{"$ref":"#/definitions/StaticSMSImage"},{"$ref":"#/definitions/DynamicSMSImage"}]},"media":{"description":"Video media for MMS messages as either a hydrated MediaAsset or a reference-style payload. Mutually exclusive with image.","oneOf":[{"$ref":"#/definitions/MediaAsset"},{"$ref":"#/definitions/MediaAssetReference"}]}},"required":["message"]},"PushActionButtonV0":{"type":"object","properties":{"label":{"type":"string"},"action_type":{"description":"The action type for a push notification action button.","type":"string","enum":["deep_link","dismiss","open_app","open_url"]},"url":{"type":["string","null"]},"icon":{"type":["string","null"]},"custom_action_id":{"type":["string","null"]},"ios_deep_link":{"type":["string","null"]},"android_deep_link":{"type":["string","null"]}},"required":["label","action_type"]},"RCSRichContent":{"type":"object","properties":{"cards":{"description":"List of cards in this rich content. At most 10.","type":["array","null"],"items":{"$ref":"#/definitions/RCSCard"}},"suggestions":{"description":"List of suggestion buttons for user interaction. At most 11.","type":["array","null"],"items":{"$ref":"#/definitions/RCSSuggestion"}},"file":{"$ref":"#/definitions/MediaAssetReference"}}},"SlimImageReference":{"type":"object","properties":{"static_image_asset_id":{"description":"ID of the static image asset when the card uses a library image.","type":["integer","null"]},"dynamic_image_template":{"description":"Dynamic image template (e.g. Django tags) for the card image.","type":["string","null"]},"rendered_asset_url":{"description":"Pre-rendered image URL when available.","type":["string","null"]}}},"StaticSMSImage":{"type":"object","properties":{"dynamic":{"type":["boolean","null"],"default":false,"enum":[false]},"static_image_asset_id":{"description":"The ID of the static image asset to include.","type":"integer"}},"required":["static_image_asset_id"]},"DynamicSMSImage":{"type":"object","properties":{"dynamic":{"type":"boolean","default":true,"enum":[true],"examples":[true]},"dynamic_image_template":{"description":"Dynamic image template URL (e.g., {{product.image_url}}).","type":"string"}},"required":["dynamic_image_template"]},"MediaAsset":{"type":"object","properties":{"id":{"description":"The unique identifier for this media asset. Not allowed on update.","type":"string"},"company_id":{"description":"The company ID that owns this media.","type":"string","examples":["RyGRiN"]},"url":{"description":"The full URL to access the media.","type":"string","examples":["https://d3k81ch9hvuctc.cloudfront.net/company/RyGRiN/videos/01KG5BPQBSY8F12ZWTGYHPPRXC.mp4"]},"media_type":{"description":"The media type (e.g., 'video' for video assets).","type":"string","default":"video","examples":["video"]},"name":{"description":"The human-readable name of the media.","type":"string","examples":["demo video.1"]},"file_size":{"description":"The size of the media file in bytes.","type":"integer"},"thumbnail_url":{"description":"Optional thumbnail URL for video previews in RCS cards.","type":["string","null"]},"l10n_key":{"description":"Localization key for this media asset, if applicable.","type":["string","null"]}},"required":["id","company_id","url","name","file_size"]},"MediaAssetReference":{"type":"object","properties":{"static_asset_id":{"description":"Reference to a static media asset.","type":["string","null"]},"dynamic_template":{"description":"Dynamic template (e.g. Django tags) resolving to the media URL.","type":["string","null"]},"thumbnail":{"$ref":"#/definitions/SlimImageReference"}}},"RCSCard":{"type":"object","properties":{"id":{"description":"Unique identifier for this card.","type":"string","examples":["44214e8f-a2fb-43b1-a8e1-1170715ffcfa"]},"title":{"description":"Optional title for the card. 200 characters is the rendered-length budget; the stored value may be longer because it is template-evaluated before it reaches the carrier.","type":["string","null"],"examples":["Special Offer"]},"text":{"description":"The text content/description of the card. 2000 characters is the rendered-length budget; the stored value may be longer because it is template-evaluated before it reaches the carrier.","type":["string","null"],"examples":["Check out our new collection!"]},"extra":{"description":"Additional card-specific metadata (e.g., product info). Optional.","type":["object","null"]},"image":{"description":"Optional image for this card.","oneOf":[{"$ref":"#/definitions/ImageAsset"},{"$ref":"#/definitions/SlimImageReference"}]},"video":{"description":"Optional video for this card. May be a hydrated MediaAsset or a reference-style payload (e.g. static_asset_id), matching MMS ``MessageHierarchySmsItem.media`` behavior.","oneOf":[{"$ref":"#/definitions/MediaAsset"},{"$ref":"#/definitions/MediaAssetReference"}]},"buttons":{"description":"Optional action buttons for this card. At most 4.","type":["array","null"],"items":{"$ref":"#/definitions/RCSSuggestion"}}},"required":["id"]},"RCSSuggestion":{"type":"object","properties":{"id":{"description":"Unique identifier for this suggestion/button.","type":"string","examples":["quick-action-1767105662671"]},"text":{"description":"The display text for the suggestion button. 25 characters is the rendered-length budget; the stored value may be longer because it is template-evaluated before it reaches the carrier.","type":"string","examples":["Shop Now"]},"type":{"description":"The type of action this suggestion performs.","type":"string","enum":["OPEN_URL","REPLY"]},"url":{"description":"The URL to open (required for OPEN_URL type).","type":["string","null"],"examples":["https://www.example.com/shop"]},"open_mode":{"description":"How the URL opens on the device for OPEN_URL suggestions (browser vs webview size). Emitted to Infobip as openIn. Absent means browser.","type":["string","null"],"enum":["BROWSER","WEBVIEW_FULL","WEBVIEW_HALF","WEBVIEW_TALL"],"examples":["WEBVIEW_FULL"]}},"required":["id","text","type"]},"ImageAsset":{"type":"object","properties":{"id":{"description":"The unique identifier for this image asset. Not allowed on update.","type":"integer"},"file_path":{"description":"The file path of the image in Klaviyo's storage.","type":"string","examples":["images/aa1ee5c1-039e-4d20-9e98-345755214556.jpeg"]},"name":{"description":"The human-readable name of the image.","type":"string","examples":["product-image"]},"format":{"description":"The image file format.","type":"string","enum":["gif","jpeg","jpg","png","webp"]},"file_size":{"description":"The size of the image file in bytes.","type":"integer"},"updated":{"description":"Timestamp when the image was last updated.","type":"string","format":"date-time","examples":["2022-11-08T00:00:00+00:00"]},"origin":{"description":"The origin/source of the image (e.g., UI, API, AI, etc.).","type":["string","null"],"enum":["ADOPTION_SMS_FORM_FROM_EMAIL_FORM","ADOPTION_SMS_MULTI_STEP_FORM_FROM_EMAIL_FORM","AI","API","APPLICATION","CLONED","COMPOSER","COMPOSER_AI_EDITED","COMPOSER_AI_GENERATED","COMPOSER_USED_IN_KLAVIYO_OBJECT","COMPOSER_USER_UPLOADED","COMPOSER_WEB_SCRAPED","INTEGRATION","KLAVIYO","LIBRARY","MARKETING_AGENT","SANDBOX","SOCIAL_INSTAGRAM","SOCIAL_INSTAGRAM_OVERLAID","UI","WEB_SCRAPE"]},"url":{"description":"The full URL to access the image.","type":"string","examples":["https://d3k81ch9hvuctc.cloudfront.net/company/RyGRiN/images/aa1ee5c1-039e-4d20-9e98-345755214556.jpeg"]},"image_type":{"description":"The type of image (static or dynamic).","type":"string","enum":["dynamic","static"]},"l10n_key":{"description":"Localization key for this image asset, if applicable.","type":["string","null"],"examples":["sms::01KAPBZTQBAJFD5RG9NYXBWHMR::mms_static_image_asset_id"]}},"required":["id","file_path","name","format","file_size","updated","url","image_type"]}}},"name":"Create Campaign Message","id":"klaviyo.create_campaign_message","example":{"headers":{"revision":"2026-10-15"},"body":{"data":{"type":"campaign-message","attributes":{"definition":{}},"relationships":{"campaign":{},"campaign-audience":{}}}}},"maxRequests":1,"summary":false}}