1

I am working on a pinpoint integration that will hopefully use the java sdk to create a segment and launch a campaign in one shot. I am having trouble determining how to do this. If I use ImportJobRequest to import a CSV/JSON file from S3 and use the segment id when creating the campaign then I get an error Segment specified in SegmentId is not found

I have verified that the segment is created with the id I am attempting to use.

This may be the same as this unanswered question: Python: Passing a variable to another function

Is there a way to import a segment and create a campaign at once is a single lambda function? Polling for the imported segment in a separate function seems like bad design.

dreamwagon
  • 1,219
  • 1
  • 15
  • 17

1 Answers1

0

So after a day or two of trying different things, I believe the issue is that there is no way to tie into the import job file upload events. If a ProgressListener is used only the job submission events are returned, not the progress of the file upload, which is what actually determines when the segment is available for use.

I solved this by creating a SQS queue and creating a message with some details about the campaign I would like to create (such as name, the segment ID etc) and set message delay of 5 minutes. If the Import Job has not completed in that time, the lambda that creates the campaign from SQS will fail on create and the process will retry until the message is deleted from the queue.

I am still curious if there is some other way to tie to the Import Job file upload, but from what I have seen and have tested, there is not.

dreamwagon
  • 1,219
  • 1
  • 15
  • 17