twilio - I can't get a list of flexflow - Stack Overflow

admin2025-04-17  3

I've a test account of Twilio and i've already created 3 flow in flex flow.But when i try to get a list of floxflow using client.flexApi.flexFlow.list() but i got a null array.

I checked my accountsid and authtoken is passed perfect and I've also assign a mobile number number to one of them and also pass same number as fromNumber

here is my code:

const client = require('twilio')(ACCOUNT_SID, AUTH_TOKEN);

  const getFlexFlowForNumber = async () => {
    let flexFlow;
    console.debug(`Looking for Flex Flow for fromNumber '${fromNumber}'`); 
    try {
      const flexFlows = await client.flexApi.flexFlow.list();
      console.log('flexFlows: ', flexFlows);
      
      flexFlow = flexFlows.find(
        flow => flow.integrationType === 'studio' && flow.contactIdentity === fromNumber
      );
    } catch (error) {
      console.error(`Error finding Flex Flow!`, error);
      throw error;      
    }

    console.debug(`Flow Flow is:\n ${JSON.stringify(flexFlow)}'`); 
    return flexFlow;
  }

转载请注明原文地址:http://anycun.com/QandA/1744876270a88873.html