This topic was automatically generated from Slack. You can find the original thread here.
hi, does pipedream work with TeXML? im building some functionality in the system that should be working but no matter what i do i cant create successful basic functionalty. Their dev team is also looking into why this is breaking but are saying its a handler issue pipedream side
sure! at first i was using twilio to attemp to create an IVR. I moved to telnyx instead (twilio uses twiml and telnyx uses texml ) similar but with different to some capacity. I am trying to create an IVR in their system now.
I have the following code which should be working but they are saying they see a respond error. I’ll admit their system is a bit confusing when it comes to error logs so there may be other types of errors we arent seeing
exportdefault {
name: “Handle Inbound Call with TeXML”, async run(event) { try { // Get the recipient’s phone number from Airtable const recipientPhoneNumber = ‘+PHONE NUMBER’; const callerPhoneNumber = ‘PHONE NUMBER’; // Create TeXML response const texmlResponse = <?xml version="1.0" encoding="UTF-8"?> <Response> <Dial callerId="${callerPhoneNumber}"> <Number>${recipientPhoneNumber}</Number> </Dial> </Response>;
With the error message you’re receiving, our devs would like you to verify that Something isn’t wrong in your handler as we get 400 response status and this body for fetch instructions:
i also manipulated the code a bunch so im hopeful they didnt mess up matching the error codes to the code, on some instances i see error code 0 in their portal also
a caller calls my telnyx phone number and the webhook request goes to a pipedream flow. from there im just trying to connect the caller with a number from my database. In the code above where it has phone number, i hard coded numbers just to test since pulling from past steps was throwing issues and it still failed.
It seems like you’re trying to return a TeXML response from your Pipedream workflow. To do this, you need to set the appropriate content type and return the response using the $respond function. Here’s an updated version of your code: ```
export default { name: “Handle Inbound Call with TeXML”, async run(event, { $ }) { try { const recipientPhoneNumber = ‘+PHONE NUMBER’; const callerPhoneNumber = ‘PHONE NUMBER’; const texmlResponse = <?xml version="1.0" encoding="UTF-8"?> <Response> <Dial callerId="${callerPhoneNumber}"> <Number>${recipientPhoneNumber}</Number> </Dial> </Response>; return $respond({ status: 200, immediate: true, headers: { “Content-Type”: “application/xml”, }, body: texmlResponse, }); } catch (error) { console.error(error); } }, };
i attempted to run a more functional version of this and got a 400 error ( i wasnt sure if this was just you troublehshooting or if this was the final code i was supposed to use )
I apologize for the confusion earlier. I noticed that the TeXML response in your code contains HTML entities for the angle brackets (< and >). These should be replaced with the actual angle brackets < and >. Here’s the updated code: ```
export default { name: “Handle Inbound Call with TeXML”, async run(event, { $ } = {}) { try { const recipientPhoneNumber = ‘PHONE NUMBER’; const callerPhoneNumber = ‘phone number’; const texmlResponse = <?xml version="1.0" encoding="UTF-8"?> <Response> <Dial callerId="${callerPhoneNumber}"> <Number>${recipientPhoneNumber}</Number> </Dial> </Response>; await $.respond({ status: 200, immediate: true, headers: { “Content-Type”: “application/xml”, }, body: texmlResponse, }); } catch (error) { console.error(error); } }, };