‎2023 Dec 27 12:31 PM
Hi Experts,
Anyone worked in SAP building API with ABAP for using Twilio services to send SMS.
I have Account SID and Token for Twilio account.
Just need to send SMS(Reponse) not required. We have s4 Hana on-premise system.
Please give the steps and code if anyone already did.
‎2023 Dec 27 1:25 PM
I guess you mean using SAP Business Accelerator Hub - Twilio SMS - Messaging API for SMS for communication. It's all documented there.
‎2023 Dec 28 10:07 AM
Please use the COMMENT button for comments, asking for complements, adding details, replying to a comment or a proposed solution or to the OP question, etc., ANSWER is only to propose a solution, dixit SAP text at the right of the answer area.
(or just edit your question via menu Actions > Edit)
‎2023 Dec 28 10:15 AM
You should first try with Postman or whatever software to make sure which exact HTTP requests send SMS successfully and then you do the same HTTP requests with ABAP.
‎2023 Dec 28 10:15 AM
It is not Business Accelerator hub, Just normal ABAP code to send SMS using Twilio.
I'm not sure about Business Accelerator hub, if we have it.
I tried using the class cl_http_client=>create_by_url and http_client->send, but not sure how to fill the url in the first method for Twilio services.
‎2023 Dec 28 10:18 AM
I'm trying to test with postman, can you help me the url details, i think i need to use POST for this, as i just need to send SMS. I have the Account SID and Test Auth Token.
‎2023 Dec 28 10:29 AM
You don't need Business Accelerator hub. I was just asking.
There should be all required information at Twilio.
Send messages with Messaging Services | Twilio
CURL is an easy way (via Cmd or Powershell).
Only after a successful run you can write the ABAP code.
‎2023 Dec 28 10:43 AM
curl -X POST "https://api.twilio.com/2010-04-01/Accounts/$TWILIO_ACCOUNT_SID/Messages.json"
--data-urlencode "Body=Hello from your Messaging Service$EXCLAMATION_MARK"
--data-urlencode "MessagingServiceSid=MG9752274e9e519418a7406176694466fa"
--data-urlencode "To=+15553332222"
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
--data-urlencode : to be appended to the URL (i.e. ...Messages.json?Body=Hello...&To=%2B15553332222)
(urlencode of + gives %2B)
-u : user and password (set_authorization)