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!
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.
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.
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.
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
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?