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
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Use applyOffers on JSON Offer

bmendez
Level 2
Level 2

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]
            }
          }
        });
      });
    });

 

 

 

 

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution
nithinis
Correct answer by
Level 2
Level 2

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().

View solution in original post

1 Reply
nithinis
Correct answer by
Level 2
Level 2

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().