In the message for the Body (within twilio), I have: {{flow.data.parameters.message}}
In the message for From, I have:
{{flow.data.parameters.From}}
In the message for To, I have:
{{flow.data.parameters.To}}
Now back to klayvio - as mentioned, I am trying to send the webhook to that URL (I have also tried sending it to their webhook URL and I have been unsuccessful).
Originally, I was passing my AccountSID and Auth Token as base64 encoded, but then I noticed Klayvio was ##### a lot of the numbers. Upon further checking with Klayvio, they said they hash it….so I tried sending it without it being encoded.
Ultimately, every time it gets to the webhook in my flow it skips it. I have tried doing it via postman and was able to do it when its x-www-form-urlencoded but ultimately, when sending by JSON (which I believe is what Klayvio does) I can’t get it to work.
This is new to me and I am of course using GPT to help me (although as mentioned, I was able to make it work through postman in certain scenarios).
Anyway if anyone cna provide some input on how to properly send a webhook to Twilio to send an SMS, that would be very much appreciated.
Thank you,
Shane
Page 1 / 1
To integrate Klaviyo with Twilio using webhooks in a flow, follow these steps:
Set Up Twilio:
In Twilio Studio, create a flow that accepts incoming HTTP requests.
Configure the flow to send SMS messages using parameters for 'To', 'From', and 'Body'.
Configure Klaviyo Webhook:
In your Klaviyo flow, add a webhook action.
Set the request URL to your Twilio Studio flow's HTTP endpoint.
Use the POST method and set the content type to application/json.
In the request body, include the necessary parameters:
Additionally, consider reviewing Twilio's API documentation for specifics on handling incoming HTTP requests and sending SMS messages.
By following these steps, you can successfully set up a webhook in Klaviyo to send SMS messages through Twilio.
Hi there,
Thank you very much for your response.
I am not sure what I am doing wrong here - but I am still having trouble. I am attaching images of my configuration both in Twilio and in Klayvio
Note that I changed the from phone number to 5555555 for the purposes of the screenshot.
I keep getting a 400 error
My Authorization Key is encoded
Sorry reposting these images incase they didn’t come through the first time.
It seems like there might be an issue with either the configuration or the way the request is being made. Here are a few things to check:
Double-check API Credentials: Ensure that your Twilio SID and Auth Token are correct and properly encoded.
Verify the 'From' Number: While you've changed the 'From' number for the screenshot, make sure that the number you're using is a valid Twilio phone number. A 400 error can occur if the 'From' number isn’t correctly set up in Twilio.
Check the Endpoint: Ensure you're sending the request to the correct API endpoint and that the payload is properly formatted according to Twilio’s documentation.
Ensure Proper URL Encoding: Sometimes, improper encoding of the URL or parameters can cause issues. Make sure everything is URL-encoded correctly.
Authorization: Double-check that the Authorization header is formatted correctly and that it's base64-encoded, if necessary.
If you're still facing issues, feel free to share the specific error message or any additional logs, and I can assist you further.
Thank you Mansir. I have sent you a PM!
haven’t recieved it yet!
You are welcome, Hope you found that helpful?
Sorry Mansir - I just noticed it didn’t send and even now I tried to resend it and it didn’t work. Let me post here:
I have been trying to make the connection in Postman, however I am unable to make a successful connection...I am getting:
{
"code": 20001,
"message": "Missing required parameter From in the post body",
"To": "+16045555555", (edited for posting public - but my cell phone)
"message": "This is a test message."
}
Please Note that our From number IS set up to work on another flow for an autoresponder. When you do text it, you get a response back saying its not monitored. So the number does work / can send SMS.
My headers include
Authorization (and then my encoded accountsid:authtoken)
Content-Type = application/json
As mentioned, within Twilio, I am already using the number on another flow for an autoresponder (so if you text that number, it will tell you its not monitored)
In my flow set up, i have
Message body: {{flow.data.parameters.message}}
from: {{flow.data.parameters.From}}
to: {{flow.data.parameters.To}}
And I am sending this to the REST API endpoint
Does anything jump out as being incorrect?
It’s fine Fastkey!
The error indicates the "From" parameter is missing in the POST body. Based on your payload, here’s a potential fix:
Ensure Correct Parameter Name: In Twilio, the "From" field is case-sensitive. Double-check that your payload includes "From", not any variation like "from".
Update the Endpoint URL: Make sure you’re using the correct Twilio REST API endpoint for sending SMS. It should look like:
Payload Format: Verify that your payload matches Twilio’s requirements:
json
Copy code
{ "From": "+16045555555", "To": "+16045555555", "Body": "This is a test message." }
Note: The key should be "Body", not "message".
Headers: Your headers seem correct, but ensure the Authorization value is properly base64-encoded.
If these adjustments don’t resolve the issue, feel free to reach out to me directly via WhatsApp at +234 9151237531, and I’ll help you troubleshoot further!