Skip to content

messagemedia/enterprise-webhooks-php-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MessageMedia Enterprise Webhooks PHP Code Guide

Pull Requests Welcome

The MessageMedia Enterprise Webhooks code guide demonstrates how you can verify webhooks signed and sent to you by MessageMedia.

Isometric

Table of Contents

📰 Information

Slack and Mailing List

If you have any questions, comments, or concerns, please join our Slack channel: https://developers.messagemedia.com/collaborate/slack/

Alternatively you can email us at: developers@messagemedia.com

Bug reports

If you discover a problem with the code guide, we would like to know about it. You can raise an issue or send an email to: developers@messagemedia.com

Contributing

We welcome your thoughts on how we could best provide you with SDKs that would simplify how you consume our services in your application. You can fork and create pull requests for any features you would like to see or raise an issue

⭐ Prerequisite

To be able to use this SDK, you will need a public key provided by MessageMedia. You can find out how to do this by going through the Signature Key Management documentation. You can then make use of the Signature Key Management PHP SDK to create and manage your keys.

This SDK assumes that you have pre-configured a webhook that sends data to a url. If you haven't done this, you can read about how to set one up in the Webhooks API Documentation or the Webhooks PHP SDK. Alternatively, you can specify a callback_url in the message body of a send message request.

🎬 Get Started

To keep this guide simple and easy to understand, we've used XAMPP to set up a server which will monitor for incoming webhooks. You can setup your own production server and use it instead of the XAMPP one if needed.

Initialisation and Installation

Create an empty directory for your project, let’s name it “testApp”. Now, open up your command prompt and clone this repository into the directory created.

Adding in the public key

Open up the public_key.pem file and replace the placeholder that says ENTER_PUBLIC_KEY_HERE with your public key. The result should look like this:

  -----BEGIN PUBLIC KEY-----
  MIIabcdNBgkqhkiG9w0BAQ4AAOCA338AMIIBCgKCAQEAwISbN8vv0HeUCPN9o29xCUzCsh0ZUM+wdc3Gi3+DfyO4rPec1f/uxFbw0Dscw1iEA1dUfQ5eKhhsOIPdjk//gOGQbBVmQ8DhDcGVGWrHrE/n/K/x0ZkIae4n4eNobK96Ic/C4YmXf5LBUmgkOwUM+5VDPxe3rMnm/3TQdJzAcBMIzqNixzseCh4ICYMSahKnkNY5bJGf+8WbT0i+3mHQwvLacAub+wFH6hyT4I7FXOcXmR+HIyD8xwwYLmB4Yy+cMmiDcc1J9KX34C5apXM2A3f2mOtgfM0WSH2NpXmZmpXmzbkbIxEw90N3zERrDb2myJAHAD0MKQ7abcdxPen96dIDAQAB
  -----END PUBLIC KEY-----

Changing the request line

The request line will need to be changed according to your callback url and request type. For instance, if your callback url is /captureData and the method type was PATCH then the resulting request line would look like this:

  $data = "PATCH /captureData HTTP/1.1".$date.$body;

Testing

You are now ready to test the application. Run the web server on your computer that has PHP installed and configured. If all goes well, you should receive a Verification Successful response which indicates the verification was a success.

📕 API Reference Documentation

Check out the full API documentation for more detailed information.

😕 Need help?

Please contact developer support at developers@messagemedia.com or check out the developer portal at developers.messagemedia.com

📃 License

Apache License. See the LICENSE file.

Releases

No releases published

Packages

No packages published

Languages