Webhook calls into Suite?

Hi y’all!

So I’m trying to write up a webhook from Stripe that will call into my SuiteCRM instance and create a new user. I have basic testing right now where the webhook calls and fires just a mail.php file within SuiteCRM which then sends an email to me saying it worked. However, it seems I can’t get access to anything really within the SuiteCRM file system such as beans to create the user and such. I’ve seen a few references to Webhooks, though most are setting them up to call from within SuiteCRM to another app using a webhook. Can I use it this way, or do I have to go API route? If I can, what’s missing to be able to create a bean record. I have built a few Logic hooks and such, so I know my way around actually creating the record, just not sure what’s missing… Assuming something simple, an include, or creating as a custom entry point possible? Any help would be appreciated!


See the docs for custom entry-points. Or use a custom API call (a bit harder to do).

I may have found another solution… Still testing it for functionality and reliability though.

From within my webhook file that receives the payload, I’m creating a connection to the database and just inserting a record into a custom module’s table. From there, I’ll have to build out a scheduler to monitor these records, add in a status (new, processed, duplicate, etc) and build out the logic around it. First pass - if user doesn’t exist, create new user, assign appropriate role, email new user with login info, etc. Though later ideas will include checking current subscription level for customer and updating if need be.

As of now - the webhook file just uses php and a new Mysqli connection to the database and does correctly insert a record so I think it’s a workable path.

Thank you

Custom entry-points are easy to do and bring you all the advantages of working with SuiteCRM objects - the database objects, Beans, all the libraries, etc. Plus, security is handled.

I don’t see a reason to do vanilla PHP when a much better option is right there for you to use, it will only take you 5 minutes to make your PHP a registered entry-point.

1 Like

I didn’t spend as much time as I should have on that part of the documentation then! I will have to revisit it for sure to check it out. Thank you for the follow up and pointing out the benefits.

1 Like

okay then so now I’m going to bug ya again.

Followed docs: Created custom entry point in custom/Extension/Ext/EntryPointRegistry file named webhook_entry.php which contains

  $entry_point_registry['webhooks'] = array(
      'file' => 'custom/WebHooks/webhooktest.php',
      'auth' => false,

Did a rebuild, and I see the file as expected after rebuild in custom/application/Ext/EntryPointRegistry, file named entry_point_registry.ext.php which contains my expected custom entry point.

in my webhooktest.php file I tried both with and without

if(!defined('sugarEntry') || !sugarEntry) die($status = 'Not A Valid Entry Point');

$GLOBALS['log']->debug('Test_WebHooks work!' );

Now when I call from Stripe to the webhook, nothing happens. if I comment out anything for Global or SuiteCRM related coding (sugarEntry), then it works as expected, but it’s still seeming that it’s not set as a valid entry point.

Only thing different than docs - no mention aside from your comments on another post about auth => false, but all other examples have it as true… From what I’m seeing, if auth=>false, it should just skip over authorization.

Also - I’m running all of these tests currently just logging out status and data to a file it writes. I’ve toyed with phpStorm a bit, but never fully set it up… Any good, free IDE/debugger options out there to dig into so I can step through this and see where it’s breaking? :slight_smile:

Much appreciated!

Your url will be
Crm url/index.php?entryPoint=webhooks

Is this the url your are using to call the entrypoint ?

1 Like

My call is coming from a webhook on Stripe that is calling to the /custom/WebHooks/webhooktest.php file.

Should it be calling to url/index.php?entryPoint=webhooks instead you’re saying?

Yes the url that stripe is calling should the like the one that I mentioned

1 Like

That was it! Thank you