View a markdown version of this page

使用 API 或 CLI 创建出站营销活动 - Amazon Connect Customer

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

使用 API 或 CLI 创建出站营销活动

您可以使用 AWS CLI 或 Amazon Connect 出站广告系列 API 以编程方式创建和管理出站广告系列。本主题介绍如何使用 CLI 创建 Connect Customer 出站营销活动、定义活动流程以及引用生命周期命令。

先决条件

在使用 API 或 CLI 创建广告活动之前,请确保具备以下条件:

创建活动流程

活动流程定义了为每个收件人运行的操作顺序。您可以使用 CreateContactFlowAPI 创建流程,并将流程类型设置为CAMPAIGN。有关每种操作类型的详细信息,请参见旅程流程区块定义

流程简单(无需重试)

一个简单的流程无需检查传送状态即可向每个收件人发送一条通信。这是最简单的流程结构:

{ "Version": "2019-10-30", "StartAction": "SendSMS", "Actions": [ { "Identifier": "SendSMS", "Type": "SendSMS", "Parameters": { "Message": { "MessageSourceType": "TEMPLATE", "TemplatedMessage": { "WisdomKnowledgeBaseArn": "arn:aws:wisdom:us-east-1:123456789012:knowledge-base/your-kb-id", "WisdomMessageTemplateArn": "arn:aws:wisdom:us-east-1:123456789012:message-template/your-kb-id/your-template-id" } }, "SourceEndpoint": { "Address": "arn:aws:connect:us-east-1:123456789012:phone-number/your-phone-number-id", "Type": "CONNECT_PHONENUMBER_ARN" } }, "Transitions": { "NextAction": "EndFlow", "Conditions": [], "Errors": [ { "NextAction": "EndFlow", "ErrorType": "NoMatchingError" } ] } }, { "Identifier": "EndFlow", "Type": "EndFlowExecution", "Parameters": {} } ] }

配送状态检查和重试流程

对于检查交付状态并在失败时重试的流程,请使用以下结构。该流程发送通信,等待交付收据,检索通信状态,然后根据结果进行分支。

重试流程中的关键操作是:

  1. SendSMS SendOutboundEmail、或 PutDialRequest-发送出站通信。

  2. 等待-等待配送收据。

  3. GetOutboundCommunicationStatus— 检索最近一次通信的传送状态。

  4. 比较-根据结果评估交货收据和分支(例如,退回时重试,成功时结束)。

  5. EndFlowExecution— 终止流。所有流路径都必须以此操作结束。

以下示例显示了发送短信、等待送达收据、检查状态并在邮件被退回时重试电子邮件的MANAGED活动流程:

{ "Version": "2019-10-30", "StartAction": "SendSMS", "Actions": [ { "Identifier": "SendSMS", "Type": "SendSMS", "Parameters": { "Message": { "MessageSourceType": "TEMPLATE", "TemplatedMessage": { "WisdomKnowledgeBaseArn": "arn:aws:wisdom:us-east-1:123456789012:knowledge-base/your-kb-id", "WisdomMessageTemplateArn": "arn:aws:wisdom:us-east-1:123456789012:message-template/your-kb-id/your-sms-template-id" } }, "SourceEndpoint": { "Address": "arn:aws:connect:us-east-1:123456789012:phone-number/your-phone-number-id", "Type": "CONNECT_PHONENUMBER_ARN" } }, "Transitions": { "NextAction": "Wait", "Conditions": [], "Errors": [ { "NextAction": "EndFlow", "ErrorType": "NoMatchingError" } ] } }, { "Identifier": "Wait", "Type": "Wait", "Parameters": { "TimeLimitSeconds": "900" }, "Transitions": { "NextAction": "GetOutboundCommunicationStatus", "Conditions": [ { "NextAction": "GetOutboundCommunicationStatus", "Condition": { "Operator": "Equals", "Operands": ["WaitCompleted"] } } ], "Errors": [ { "NextAction": "EndFlow", "ErrorType": "NoMatchingError" } ] } }, { "Identifier": "GetOutboundCommunicationStatus", "Type": "GetOutboundCommunicationStatus", "Parameters": { "OutboundCommunicationIds": ["$.OutboundCommunication.Latest.Id"] }, "Transitions": { "NextAction": "Compare", "Conditions": [], "Errors": [ { "NextAction": "EndFlow", "ErrorType": "NoMatchingError" } ] } }, { "Identifier": "Compare", "Type": "Compare", "Parameters": { "ComparisonValue": "$.DeliveryReceipts['`$.OutboundCommunication.Latest.Id`'].Bounce" }, "Transitions": { "NextAction": "EndFlow", "Conditions": [ { "NextAction": "SendEmail", "Condition": { "Operator": "Exists", "Operands": [] } } ], "Errors": [ { "NextAction": "EndFlow", "ErrorType": "NoMatchingCondition" } ] } }, { "Identifier": "SendEmail", "Type": "SendOutboundEmail", "Parameters": { "EmailMessage": { "MessageSourceType": "TEMPLATE", "TemplatedMessage": { "WisdomKnowledgeBaseArn": "arn:aws:wisdom:us-east-1:123456789012:knowledge-base/your-kb-id", "WisdomMessageTemplateArn": "arn:aws:wisdom:us-east-1:123456789012:message-template/your-kb-id/your-email-template-id" } }, "FromEmailAddress": { "EmailAddress": "noreply@example.com" } }, "Transitions": { "NextAction": "EndFlow", "Conditions": [], "Errors": [ { "NextAction": "EndFlow", "ErrorType": "NoMatchingError" } ] } }, { "Identifier": "EndFlow", "Type": "EndFlowExecution", "Parameters": {} } ] }
重要
  • 如果您的流程使用多种渠道类型(例如,短信和电子邮件),请在创建广告系列时在--channel-subtype-config参数中包含所有渠道。

  • 对于在活动中使用的流程类型MANAGED为检查投放状态,所需的操作顺序为:等待 GetOutboundCommunicationStatus比较。该Wait操作会将流程暂停一段指定的持续时间,以便有时间让交货收据到达。该GetOutboundCommunicationStatus操作会检索配送状态。Compare操作根据结果进行分支。

  • 中的OutboundCommunicationIds参数GetOutboundCommunicationStatus必须引用$.OutboundCommunication.Latest.IdCompare操作中的配送收据引用必须使用相同的密钥。例如:$.DeliveryReceipts['`$.OutboundCommunication.Latest.Id`'].Bounce

  • MANAGED使用语音渠道的广告活动需要dialCriteriaRulesPutDialRequest执行以下操作:

    { "Identifier": "PutDialRequest", "Type": "PutDialRequest", "Parameters": { "dialCriteriaRules": [ { "type": "CheckSegmentMembershipForCustomerProfile", "segmentArn": "arn:aws:profile:us-east-1:123456789012:domains/your-domain/segments/your-segment" } ] }, ... }

创建活动流程版本

创建活动流程后,必须创建该流程的版本。创建活动时需要版本化流程 ARN。使用 CreateContactFlowVersionAPI 创建版本。

版本化流程 ARN 包含版本后缀。例如:arn:aws:connect:us-east-1:123456789012:instance/your-instance-id/contact-flow/your-flow-id:1

有关更多信息,请参阅 create-contact-flow-version C LI 参考。

创建出站活动

使用create-campaign命令创建战役。以下示例使用无代理出站模式创建短信活动:

aws connectcampaignsv2 create-campaign \ --name "My SMS Campaign" \ --connect-instance-id "your-instance-id" \ --type MANAGED \ --connect-campaign-flow-arn "arn:aws:connect:us-east-1:123456789012:instance/your-instance-id/contact-flow/your-flow-id:1" \ --source '{"customerProfilesSegmentArn": "arn:aws:profile:us-east-1:123456789012:domains/your-domain/segments/your-segment"}' \ --channel-subtype-config '{ "sms": { "outboundMode": {"agentless": {}}, "defaultOutboundConfig": { "connectSourcePhoneNumberArn": "arn:aws:connect:us-east-1:123456789012:phone-number/your-phone-number-id", "wisdomTemplateArn": "arn:aws:wisdom:us-east-1:123456789012:message-template/your-kb-id/your-template-id" } } }' \ --schedule '{"startTime": "2026-07-01T09:00:00", "endTime": "2026-07-01T17:00:00", "refreshFrequency": "PT30M"}' \ --communication-time-config '{ "localTimeZoneConfig": {"defaultTimeZone": "America/New_York"}, "sms": { "openHours": { "dailyHours": { "MONDAY": [{"startTime": "T09:00", "endTime": "T17:00"}], "TUESDAY": [{"startTime": "T09:00", "endTime": "T17:00"}], "WEDNESDAY": [{"startTime": "T09:00", "endTime": "T17:00"}], "THURSDAY": [{"startTime": "T09:00", "endTime": "T17:00"}], "FRIDAY": [{"startTime": "T09:00", "endTime": "T17:00"}] } } } }' \ --region us-east-1

成功后,该命令将返回活动 ID 和 ARN:

{ "id": "campaign-id", "arn": "arn:aws:connect-campaigns:us-east-1:123456789012:campaign/campaign-id" }
注意

--type参数指定了广告系列的类型。MANAGED用于出站广告系列。JOURNEY用于多步、多渠道的旅程,请参阅视觉旅程生成器

注意

您还可以指定--communication-limits-override控制可以联系收件人的次数。有关参数的完整列表,请参阅创建活动 CLI 参考。

要管理广告活动生命周期操作(开始、停止、暂停、恢复、删除),请参阅 c onnectcampaignsv2 的AWS CLI 参考