This topic was automatically generated from Slack. You can find the original thread here.
Need some Help. I am running the following code and it refuses to pull the list options for Outbound phone number or the Flow SID. This was working earlier today but stopped working:
import { axios } from “@pipedream/platform”
export default defineComponent({
props: {
twilio: {
type: “app”,
app: “twilio”,
},
phoneNumber: {
type: “string”,
label: “Phone Number”,
description: “The phone number to call, in E.164 format”,
},
outboundPhoneNumber: {
type: “string”,
label: “Twilio Outbound Phone Number or Alphanumeric Sender ID”,
description: “The Twilio phone number or alphanumeric sender ID to use for the outbound call”,
},
flowSid: {
type: “string”,
label: “Twilio Flow SID”,
description: “The SID of the Twilio Studio Flow to execute”,
},
parameters: {
type: “object”,
label: “Flow Parameters”,
description: “JSON object containing parameters to pass to the flow”,
optional: true,
},
},
async run({ steps, $ }) {
console.log(“Starting execution of Twilio Studio Flow”);
console.log(Phone Number (To): ${this.phoneNumber}
);
console.log(Twilio Outbound Number (From): ${this.outboundPhoneNumber}
);
console.log(Twilio Flow SID: ${this.flowSid}
);
console.log(Parameters: ${JSON.stringify(this.parameters || {})}
);
try {
const formData = new URLSearchParams();
formData.append('To', this.phoneNumber);
formData.append('From', this.outboundPhoneNumber);
formData.append('Parameters', JSON.stringify(this.parameters || {}));
console.log("Prepared form data for request.");
const response = await axios($, {
method: "POST",
url: `https://studio.twilio.com/v2/Flows/${this.flowSid}/Executions`,
auth: {
username: `${this.twilio.$auth.AccountSid}`,
password: `${this.twilio.$auth.AuthToken}`,
},
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
data: formData.toString(),
});
console.log('Studio Flow execution started with SID:', response.sid);
} catch (error) {
console.error('Error initiating Studio Flow execution:');
if (error.response) {
console.error(`Response Status: ${error.response.status}`);
console.error(`Response Data: ${JSON.stringify(error.response.data)}`);
} else {
console.error(error.message);
}
}
},
})