Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't figure out how to create a playable ad using SDK #253

Open
15bubbles opened this issue Jul 9, 2023 · 0 comments
Open

Can't figure out how to create a playable ad using SDK #253

15bubbles opened this issue Jul 9, 2023 · 0 comments

Comments

@15bubbles
Copy link

15bubbles commented Jul 9, 2023

Which SDK version are you using?

"facebook-nodejs-business-sdk": "^16.0.2",

What's the issue?

Can't figure out how to create playable Ad with SDK

Steps/Sample code to reproduce the issue

I've tried to create a playable Ad using the SDK. I took this document and another document from the official documentation for reference. These documents show examples with source and source_zip fields, telling that I can upload playable ad in such way. I decided to use source_zip because it seems that I can pass binary content there, however when I'm trying to use these fields from the SDK, I get an error from the API:

FacebookRequestError: (#100) Invalid file or file handle. Double check the 'file' parameter

Here's example code I'm using:

export default class FacebookAdsPublisher {
  adAccount: AdAccount;

  constructor(config: IFacebookAdsPublisherConfig) {
    FacebookAdsApi.init(config.accessToken);
    this.adAccount = new AdAccount(config.accountId);
  }

  async uploadPlayable(campaign: ICampaign, data: Buffer) {
    const asset = await this.adAccount.createAdPlayable([], {
      name: `${campaign.name}_playable.zip`,
      source_zip: data,
    });

    return asset.id;
  }
}

Observed Results:

GraphQL API returns an error

FacebookRequestError: (#100) Invalid file or file handle. Double check the 'file' parameter

Expected Results:

I was expecting that playable ad will get uploaded via the API.

Can we add some example to the examples directory?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant