Adding a topic to an existing contact list (NotFoundException - List doesn't contain Topic)

0

I have a contact list where each contact has a list of topic preferences, e.g.

// aws sesv2 get-contact-list --contact-list-name my_contact_list

{
  "ContactListName": "my_contact_list",
  "Topics": [
    {
      "TopicName": "transactional_emails_1",
      "DisplayName": "...",
      "Description": "...",
      "DefaultSubscriptionStatus": "OPT_IN"
    },
    {
      "TopicName": "transactional_emails_2",
      "DisplayName": "...",
      "Description": "...",
      "DefaultSubscriptionStatus": "OPT_IN"
    }
  ],
  "CreatedTimestamp": "2022-04-12T11:40:48.061000+01:00",
  "LastUpdatedTimestamp": "2022-05-12T11:01:13.596000+01:00",
  "Tags": []
}

And when I list the contacts:

// aws sesv2 list-contacts --contact-list-name my_contact_list

{
      "EmailAddress": "name.surname@example.com",
      "TopicPreferences": [
        {
          "TopicName": "transactional_emails_1",
          "SubscriptionStatus": "OPT_IN"
        }
      ],
      "TopicDefaultPreferences": [
        {
          "TopicName": "transactional_emails_2",
          "SubscriptionStatus": "OPT_IN"
        }
      ],
      "UnsubscribeAll": false,
      "LastUpdatedTimestamp": "2022-05-16T09:14:16.483000+01:00"
    }

I would now need to add a new topic to the contact list. However, I can't find any way to update the list, or the existing contacts in that list.

When I try to send an email to that list with a new topic, I get this error:

"An error occurred (NotFoundException) when calling the SendEmail operation: List: my_contact_list doesn't contain Topic: transactional_emails_3

What I would end up with is a situation where the contact list contains the new topic (transactional_emails_3) and each user in that list is subscribed to it:

// aws sesv2 get-contact-list --contact-list-name my_contact_list

{
  "ContactListName": "my_contact_list",
  "Topics": [
    {
      "TopicName": "transactional_emails_1",
      "DisplayName": "...",
      "Description": "...",
      "DefaultSubscriptionStatus": "OPT_IN"
    },
    {
      "TopicName": "transactional_emails_2",
      "DisplayName": "...",
      "Description": "...",
      "DefaultSubscriptionStatus": "OPT_IN"
    },
   {
      "TopicName": "transactional_emails_3",
      "DisplayName": "...",
      "Description": "...",
      "DefaultSubscriptionStatus": "OPT_IN"
    }
  ],
  "CreatedTimestamp": "2022-04-12T11:40:48.061000+01:00",
  "LastUpdatedTimestamp": "2022-05-12T11:01:13.596000+01:00",
  "Tags": []
}

Can it be done using the AWS SDK (SESv2 API)?

1개 답변
0

Hello,

I was looking over the Simple Email Service (SES) V2 available APIs on our documentation, https://docs.aws.amazon.com/ses/latest/APIReference-V2/API_Operations.html , and I believe the APIs you’ll want to take a look over are the following:

As far as the next steps I’d recommend creating a simple contact list with a few test contacts to iron out the solution you’re going for, just so that users aren’t accidently sent some items and the production system is intact while getting the solution engineered.

If those two APIs above aren’t able to complete what you need then the first link has the remaining other available APIs where you might be able to find a more precise one.

AWS
지원 엔지니어
Tim_P
답변함 2년 전
  • Thank you, I saw that API but it actually replaces a contact list, rather than just making additive/subtractive updates. My understanding is that, in order to simply add a new topic to an existing contact list, one would have to:

    1. Get the current contact list with GetContactList
    2. Make a new contact list (e.g. in memory) with the new topic on top
    3. Replace the old contact list with the new one with UpdateContactList
    4. Get all the contacts with ListContacts (it involves pagination, so multiple calls)
    5. Update each contact with UpdateContact (to subscribe them to the new topic)
    6. Hope that no one else made any similar change at the same time

    Is my understanding correct, or is there a better way to achieve that?

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠