如何使用axios从API调用获取的值中设置fulfillmentText?

时间:2019-03-24 18:50:55

标签: node.js facebook api axios fetch

我能够使用axios检索数据,但似乎无法将其发布到dialogflow的managementText

const getData = async () => {
    try {
        return await fetch.get(url)
    } catch (error) {
        console.error(error)
    }
}

const countBreeds = async () => {
    const breeds = await getData();
}

responseJson.fulfillmentText = countBreeds().body;
}

1 个答案:

答案 0 :(得分:0)

感动

responseJson.fulfillmentText = countBreeds().body;

紧接着

const breeds = await getData();

应该是

responseJson.fulfillmentText  = breeds.data.body;