SMS feedback after form submission
Hi, I am newbie to chronoform. i am trying to setup SMS sending along with thank you after submission of form. I am using gate way of SMS4BD (There documentation is : http://www.sms4bd.com/Uploads/SMS4BD_API_HELP_GUIDE.pdf)
I am following their instruction as like below;
[
The base address for the service is :www.SMS4BD.net/OutboundChannel.svc
You need to send a POST request to this address with addition End point info and POST
parameters. The POST data is expected as a JSON serialized data. Please check our example
code below to understand how that is done.
]
They also provided a sample code:
[
Url: http://www.sms4bd.net/OutboundChannel.svc/SendSingleSMS
Json:
{"Username":"test", "Password":"123456",
"MobileNumber":"01717579731", "MessageBody":"Testing the single message.",
"ID":"e98ae32f-1e1a-cea6-ad28-08c faa46015d","SendTime":"\/Date(1355732212990)\/"}
]
I am using cURL action but could not configure out how to implement it. Like to hear from expert like you. Thanks in advance to my friend.
I am following their instruction as like below;
[
The base address for the service is :www.SMS4BD.net/OutboundChannel.svc
You need to send a POST request to this address with addition End point info and POST
parameters. The POST data is expected as a JSON serialized data. Please check our example
code below to understand how that is done.
]
They also provided a sample code:
[
Url: http://www.sms4bd.net/OutboundChannel.svc/SendSingleSMS
Json:
{"Username":"test", "Password":"123456",
"MobileNumber":"01717579731", "MessageBody":"Testing the single message.",
"ID":"e98ae32f-1e1a-cea6-ad28-08c faa46015d","SendTime":"\/Date(1355732212990)\/"}
]
I am using cURL action but could not configure out how to implement it. Like to hear from expert like you. Thanks in advance to my friend.
Hi nahiyan404,
This should work using cURL - though it's not easy to be sure from their documentation. Create the JSON package in a Custom Code action before the cURL action:
The in the cURL use http://www.sms4bd.net/OutboundChannel.svc in the Target URL and
If this doesn't work then you can probably download their PHP library and use that. If you intend to make a lot of use of the service then that may be the better approach. You can load and run the library from a ChronoForms Custom Code action.
Bob
This should work using cURL - though it's not easy to be sure from their documentation. Create the JSON package in a Custom Code action before the cURL action:
<?php
$json = array(
'Username' => 'your username',
'Password' => 'your password,
'MobileNumber' => $form->data['mobile_number',
'MessageBody' => $form->data['message'],
'ID' => $form->data['uid'],
'SendTime' => '???'
);
$form->data['SendSingleSMS'] = json_encode($json);
?>
I have no real idea what the correct values for the ID and SendTime need to be
The in the cURL use http://www.sms4bd.net/OutboundChannel.svc in the Target URL and
SendSingleSMS=SendSingleSMS
in the params box
If this doesn't work then you can probably download their PHP library and use that. If you intend to make a lot of use of the service then that may be the better approach. You can load and run the library from a ChronoForms Custom Code action.
Bob
Thank you for your kind reply. I have sent an email to customer support of sms4bd and they replied with following for simple implementation of cURL.
HTTP API EXAMPLE (SENDING A SINGLE SMS):
They also provided Two files, as How to documents and another is Some sample PHP api files for sms4bd.
Finally could tell me how to implement the follwoing line in chronoform for sms funtionality.
Thank you
HTTP API EXAMPLE (SENDING A SINGLE SMS):
HTTP API is very quick and easy. The easiest and fastest way to send SMS will be to use the
following URL format: You need to make a HTTP GET request in this URL.
You need to replace {username}, {password}, {phone}, {message} etc with actual value.
Your username and password will be provided to you. {phone} is the mobile number where
you need to send SMS, and {message} is the SMS text that you want to send.
http://www.sms4bd.net/OutboundChannel.svc/SendSingleSMSGET2?username={username
}&password={password}&phone={phone}&message={message}
They also provided Two files, as How to documents and another is Some sample PHP api files for sms4bd.
Finally could tell me how to implement the follwoing line in chronoform for sms funtionality.
http://www.sms4bd.net/OutboundChannel.svc/SendSingleSMSGET2?username={username
}&password={password}&phone={phone}&message={message}
Thank you
Below is the link of the two file they provided;
https://www.dropbox.com/sh/y0sqyl0eiytp8bs/AADXA0EukfAK19EPaX6VG-OSa?dl=0
I think this will not be needed for our simple implementation
https://www.dropbox.com/sh/y0sqyl0eiytp8bs/AADXA0EukfAK19EPaX6VG-OSa?dl=0
I think this will not be needed for our simple implementation
Hi nahiyan404,
If they will accept GET - that's a URL - then you can send the message using the ReDirect action instead of the cURL action.
The Custom code would be something like this:
and in the Extra Params box
Bob
If they will accept GET - that's a URL - then you can send the message using the ReDirect action instead of the cURL action.
The Custom code would be something like this:
<?php
$form->data['username'] = 'username';
$form->data['password'] = 'password';
?>
and then in the ReDirect action set the Target URL to http://www.sms4bd.net/OutboundChannel.svc/SendSingleSMSGET2
and in the Extra Params box
username=username
password=password
phone=phone
message=message
assuming that your inputs for the phone and message have those names.
Bob
after requering sms4bd service provider they sent me following url tht will do simple sms send by url
In above link
phone is 880171757973
Thanks to you again for your geat help
http://www.sms4bd.net/OutboundChannel.svc/SendSingleSMSGET2?username=xyz&password=abc&phone=880171757973&message=hello+world
In above link
phone is 880171757973
Thanks to you again for your geat help
I completed the task accordingly as you helped. I placed the custom code then redirect then display message actions.
Then when click the form at front end it redirected to the external site of sms4bdnet but does not show the thank you message. could you kindly tell me how to do the redirect at backdround not showing at front.Thnx
Then when click the form at front end it redirected to the external site of sms4bdnet but does not show the thank you message. could you kindly tell me how to do the redirect at backdround not showing at front.Thnx
Hi nahiyan404,
Sorry, I had a cold last week and wasn't thinking very clearly.
If you use cURL then that does the transfer in the background. I think it will work with the same settings as the ReDirect action.
Bob
Sorry, I had a cold last week and wasn't thinking very clearly.
If you use cURL then that does the transfer in the background. I think it will work with the same settings as the ReDirect action.
Bob
hi, i have designed a form by chronoform in joomla 3.0. There i have included a feature cURL and form submitted in post method for URL
http://www.sms4bd.net/OutboundChannel.svc/SendSingleSMSGET2.
but its not working and showing following message in debug mode.
[curl] => HTTP/1.1 405 Method Not Allowed
and when form submitted in get method I can't see thank u page.
please kindly help me to solve the issue. Thanks
http://www.sms4bd.net/OutboundChannel.svc/SendSingleSMSGET2.
but its not working and showing following message in debug mode.
[curl] => HTTP/1.1 405 Method Not Allowed
and when form submitted in get method I can't see thank u page.
please kindly help me to solve the issue. Thanks
is there any option to make cURL to work in get method or
can you say how I can do custom php code to send http request to the sms api in get method for above sscenario. thnx.
can you say how I can do custom php code to send http request to the sms api in get method for above sscenario. thnx.
Hi nahiyan404,
I think that cURL is sending the data using POST and the URL for the SMS service only accepts GET. There is presumably another URL that will accept POST.
Bob
I think that cURL is sending the data using POST and the URL for the SMS service only accepts GET. There is presumably another URL that will accept POST.
Bob
is it possible to use cURL with http get method?
i have followimg sample php code for sms sending
can you help me how to implement this example for chronoform, thanks
PHP CODE EXAMPLE (SENDING A SINGLE SM S):
<?php
require_once 'SmsAPI/ServiceClient.php';
require_once 'SmsAPI/TextMessageRequest.php';
require_once 'SmsAPI/Recipient.php';
require_once 'SmsAPI/CustomFieldNameValueContainer.php';
require_once 'SmsAPI/CampaignRequest.php';
// Creating the instance of the service client.
$serviceClient = new ServiceClient('http://www.sms4bd.net/OutboundChannel.svc',
'yourusername', 'yourpassword');
// Generating an unique id in specified format.
$uniqId = $serviceClient->getUniqId();
date_default_timezone_set('UTC');
$sendTime = gmmktime(Hour,Minute,Second,Month,Date,Year); // Hour should be
in 24 hour format
// Creating the request object for sending Single SMS
$request = new TextMessageRequest($uniqId, '880163333333', "Hello recipient, this
is my message", $sendTime);
$result = $serviceClient->SendSingleSMS($request);
echo $result->Message . " " . $result->Code;
?>
can you help me how to implement this example for chronoform, thanks
Hi nahiyan404,
I'm not sure if you can switch the CFv5 cURL action to use GET. You can do so using PHP in a Custom Code action to create the cURL command yourself.
But I expect that they can accept POST commands from cURL if you have the correct URL.
You can also use the PHP that you posted in a Csutom Code action but you need to install the libraries on your server first. It's similar to the way the Basecamp library in this FAQ is used.
Bob
I'm not sure if you can switch the CFv5 cURL action to use GET. You can do so using PHP in a Custom Code action to create the cURL command yourself.
But I expect that they can accept POST commands from cURL if you have the correct URL.
You can also use the PHP that you posted in a Csutom Code action but you need to install the libraries on your server first. It's similar to the way the Basecamp library in this FAQ is used.
Bob
i have the php library files of sms provider but in which location i have to copy those (joomla root or chronoform folder?), kindly advice me
Also tell me where the following code to write and how to get output / implement in chronoform submission
Thanks
Also tell me where the following code to write and how to get output / implement in chronoform submission
PHP CODE EXAMPLE (SENDING A SINGLE SM S):
<?php
require_once 'SmsAPI/ServiceClient.php';
require_once 'SmsAPI/TextMessageRequest.php';
require_once 'SmsAPI/Recipient.php';
require_once 'SmsAPI/CustomFieldNameValueContainer.php';
require_once 'SmsAPI/CampaignRequest.php';
// Creating the instance of the service client.
$serviceClient = new ServiceClient('http://www.sms4bd.net/OutboundChannel.svc',
'yourusername', 'yourpassword');
// Generating an unique id in specified format.
$uniqId = $serviceClient->getUniqId();
date_default_timezone_set('UTC');
$sendTime = gmmktime(Hour,Minute,Second,Month,Date,Year); // Hour should be
in 24 hour format
// Creating the request object for sending Single SMS
$request = new TextMessageRequest($uniqId, '880163333333', "Hello recipient, this
is my message", $sendTime);
$result = $serviceClient->SendSingleSMS($request);
echo $result->Message . " " . $result->Code;
?>
Thanks
finally received URL for POST method for cURL from sms srovider. it is working on chronoform v4 cURL(gh) but not working at cheonoform CURL.
Below is the post addres and query data:
Below is the post addres and query data:
http://www.sms4bd.net/OutboundChannel.svc/SendSingleSMSPOST
Username=xyz&Password=abc&MobileNumber=8801717579731&MessageBody=hello+world&ID=C9DB760E-F04F-447A-90E3-E32DD2A975DC&SendTime=1%2F1%2F2014
Hi nahiyan404,
What do you have in the Fields Map box? You can't use 'fixed' values in the current version of the CFv5 cURL action, they have to be added to the $form->data[''] array first.
Bob
What do you have in the Fields Map box? You can't use 'fixed' values in the current version of the CFv5 cURL action, they have to be added to the $form->data[''] array first.
Bob
MobileNumber, MessageBody
Hi nahiyan404,
You can't just make things up and expect them to work. The format for the Fields Map box id parameter_name=form_input_name with each entry on a separate line!
You need to use a Custom Code action to add the 'fixed' values to the $form->data[''] array:
Then in the cURL action you can set all the values:
Bob
You can't just make things up and expect them to work. The format for the Fields Map box id parameter_name=form_input_name with each entry on a separate line!
You need to use a Custom Code action to add the 'fixed' values to the $form->data[''] array:
<?php
$form->data['Username'] = 'xyz';
$form->data['Password'] = 'abc';
$form->data['ID'] = 'C9DB760E-F04F-447A-90E3-E32DD2A975DC'; // Is this fixed?
$form->data['SendTime'] = date('d-m-Y'); // do you need a time here?
?>
Then in the cURL action you can set all the values:
'Username=Username
Password=Password
ID=ID
SendTime=SendTime
MobileNumber=MobileNumber
MessageBody=MessageBody
Bob
This topic is locked and no more replies can be posted.