I have two function. One is responsible for creating audience for the engaged page of Facebook and the other is for creating a custom audience for Instagram business account. I am using step functions to call my lambdas function. But whenever I try to create audience of Facebook and Instagram simultaneously, so I received an error of permission
No permission on event source: You do not have permission to create an audience on one or more event sources
But when I try to create a single audience for example just only for Facebook or just only for Instagram there is no error for the permissions but when I try to create audience simultaneously for the Facebook and for the Instagram business account I got this error
const createSocialAudience = async ({ name, pageId, adsAccountId, } ) => { if (!name || !adsAccountId || !pageId) { throw new Error('Marketing API call missing required params'); } const requestData = { name, description: 'Recent page visitors (from 360 days) visiting given page', rule: { inclusions: { operator: 'or', rules: [ { event_sources: [ { type: "page", id: pageId, }, ], retention_seconds: 60* 60* 24 * 360, filter: { operator: 'and', filters: [ { field: 'event', operator: 'eq', value: 'page_engaged', }, ], }, }, ], }, }, access_token: params.marketingApiToken, }; const { data } = await httpClient.post( `https://graph.facebook.com/v19.0/act_${adsAccountId}/customaudiences`, JSON.stringify(requestData) ); return data; }; const createInstagramAudience = async ({ name, igUserId, adsAccountId, }) => { if (!name || !adsAccountId || !igUserId) { throw new Error('Marketing API call missing required params'); } const requestData = { name, description: 'Recent page visitors (from 360 days) visiting given page', rule: { inclusions: { operator: 'or', rules: [ { event_sources: [ { type: 'ig_business', id: igUserId, }, ], retention_seconds: 60 *60 * 24 * 360, filter: { operator: 'and', filters: [ { field: 'event', operator: 'eq', value: 'ig_business_profile_engaged', }, ], }, }, ], }, }, access_token: params.marketingApiToken, }; const { data } = await httpClient.post( `https://graph.facebook.com/v19.0/act_${adsAccountId}/customaudiences`, JSON.stringify(requestData) ); return data; };
Expecting to create both of my audience at the same time for example I want two type of event_sources
one for page of Facebook and one for ig_business