Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

Get recipients from a API to delivery and send an email

ags
Level 2
Level 2

I have a requirement to send a personalized delivery, the data comes from an API call with HttpClientRequest("url");.

But I'm not sure if the workflow recognize the recipients in the inbound event, or the javascript allow me create a temp schema or only if I insert the data into recipient schema is enough or is impossible do this kind of things.

 

I don't now how the template derivery could recognize the recipients. 

 

ags_2-1616635659107.png

 

Thanks for your help.

1 Accepted Solution
Darren_Bowers
Correct answer by
Community Advisor
Community Advisor

Hi @ags - Yes you can do this but it would be up to you how you want to treat the incoming targets. You can choose to add them as Recipients in the Javascript, then load them from the Recipient table further in the workflow. You can also save the new targets into a temporary table and again retrieve them as your targets before the send. There are a few options you have available.

Typically what you also want to do (whichever way you choose) is have some way to identify them again, either by putting them in a specific recipient folder when you add them, or some unique identifier when you add them to a temporary table. This helps retrieve them later in the workflow

Cheers

Darren

View solution in original post

4 Replies
Darren_Bowers
Correct answer by
Community Advisor
Community Advisor

Hi @ags - Yes you can do this but it would be up to you how you want to treat the incoming targets. You can choose to add them as Recipients in the Javascript, then load them from the Recipient table further in the workflow. You can also save the new targets into a temporary table and again retrieve them as your targets before the send. There are a few options you have available.

Typically what you also want to do (whichever way you choose) is have some way to identify them again, either by putting them in a specific recipient folder when you add them, or some unique identifier when you add them to a temporary table. This helps retrieve them later in the workflow

Cheers

Darren

View solution in original post

wodnicki
Community Advisor
Community Advisor

Hi,

 

I once made a workflow activity that allows for arbitrary service enrichment ala the ootb enrichment activity, was not easy (temp schema manipulation is undocumented).

The easy way is to not manipulate the temp schema:

  1. Query for desired recipients, adding empty fields as desired. E.g. if your email is recipient + credit scores from service, add a field in Additional data called @creditScore with expr=''
  2. Use JS to batch query the service to populate the blank cols with xtk. The temp schema is called {vars.schema}

NB hardcoding the fields is essentially 'throw away' work as it can't be reused past whatever's implemented.

If data is static or non-time-sensitive consider using ETL processes to populate permanent tables instead.

 

Thanks,

-Jon

ags
Level 2
Level 2

Hi @wodnicki @Darren_Bowers  I have a one more question the workflow works really well, sent the emails for each recipient, but when the delivery add 0 recipients to send it enter in "pending" status 

ags_1-1618323801791.png

 

Or when a error occurred enter in "retry pendding"  and I reduce the validity duration, but I need to avoid this and display "finished",

Is possible do the status always "finished"?