Use applyOffers on JSON Offer | Community
Skip to main content
Level 2
August 17, 2021
Solved

Use applyOffers on JSON Offer

  • August 17, 2021
  • 1 reply
  • 1259 views

Is it possible to apply a JSON Offer in the `response.prefetch.mboxes` path in `applyOffers`? I am able to see the offer using `getOffers` but the offer is not applying.

 

I am also getting an error message of:

 

 

 

message: "Expected an array of promises"

 

 

 

 

I am doing exactly as the example shows in the getOffers documentation. Here is my code:

 

 

 

adobe.target.getOffers({ request: { prefetch: { mboxes: [ { "index": 0, "name": "testMbox" }, ] } } }).then(response => { const mboxes = response.prefetch.mboxes; mboxes.forEach(mbox => { adobe.target.applyOffers({ selector: '#headerWrapper', response: { prefetch: { mboxes: [mbox] } } }); }); });

 

 

 

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by nithinis

Hi @bmendez,

As per this Experience league article on create JSON offer,

JSON offers are not applied automatically as opposed to other offers (such as HTML offers) because JSON offers are non-visual offers. Developers must write code to explicitly get the offer using getOffer().

1 reply

nithinisAccepted solution
Level 2
September 1, 2021

Hi @bmendez,

As per this Experience league article on create JSON offer,

JSON offers are not applied automatically as opposed to other offers (such as HTML offers) because JSON offers are non-visual offers. Developers must write code to explicitly get the offer using getOffer().