• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Call a webhook in Messagebird with RSFormPro

Call a webhook in Messagebird with RSFormPro 5 years 4 months ago #39839

  • thefbi
  • thefbi's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 3
  • Thank you received: 1
Hello,

I try to make a webhook flow. I am not a programmer, so my knowledge in php are limited.
I have a website on Joomla. In this website, I knoe that i can perform an action (PHP script) after the submission of the form.

So now I understand I can call a webhook in a flow, send in this webhook information, like phone number of the client for example, and send a sms to this client. Messagebird is a sms plateform.

The part I cant figure out, is how I have to put this code ? (this is an test webhook code i have to call to perform the function) :
$ curl -X POST -H 'Content-Type: application/json' -d '{
  "recipient": "exampleValue1",
  "message": "exampleValue2"
}' https://flows.messagebird.com/flows/1e934820-c1cd-4a80-8289-da5a406e9865/invoke

So if somebody can just explain or type an example code I have to put in my form to do it ?

Because I know in my form how i can get the fields information, so I know how get “recipient value” for example, but I don’t know how to format the code in example “$ curl -X POST…..” and the url….

So I know I don't need much to make these webhooks work.

Thanks for help,
Regards
The administrator has disabled public write access.

Call a webhook in Messagebird with RSFormPro 5 years 3 weeks ago #40185

  • matt.hankosky
  • matt.hankosky's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 4
  • Thank you received: 1
Were you able to figure anything out on this?
The administrator has disabled public write access.

Call a webhook in Messagebird with RSFormPro 5 years 3 weeks ago #40187

  • thefbi
  • thefbi's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 3
  • Thank you received: 1
Hello, yes, with a friend programmer :)

I have put the code in the php script tab in the "Script called after processing the form" field.

With this code, it work for subscribe members, see my form here formation.energie-sante.ch/index.php?opt...iew=rsform&formId=14 :
// this is your form's action URL
$url = 'https://flows.messagebird.com/flows/NUMBER_OF_YOUR_FLOW/invoke';
$ch = curl_init();
 
// set user agent
//$useragent = 'YahooSeeker-Testing/v3.9 (compatible; Mozilla 4.0; MSIE 5.5; http://search.yahoo.com/)';
//curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
 
///////////////////----------------- NE PLUS RIEN MODIFIER CI-DESSOUS
curl_setopt($ch, CURLOPT_POST, 1);
 
// set the target URL which contains scripts that accepts post request
curl_setopt($ch, CURLOPT_URL, $url);
 
// set the variables to be sent
// the format of the variables is var1=value1&var2=value2&var3=value3
$data = array();
foreach ($_POST['form'] as $post => $value)
{
	if (is_array($value))
		foreach ($value as $post2 => $value2)
			$data[] = $post.'[]='.urlencode($value2);
	else
		$data[] = $post.'='.urlencode($value);
}
curl_setopt($ch, CURLOPT_POSTFIELDS, implode('&', $data));
 
// execute curl,fetch the result and close curl connection
$result = curl_exec($ch);
curl_close($ch);

And for unsubscribe by webhook too, the same code in this form formation.energie-sante.ch/index.php?opt...iew=rsform&formId=15.
The administrator has disabled public write access.
The following user(s) said Thank You: matt.hankosky
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!