{"id":16674414,"url":"https://github.com/settermjd/mini-inbound-webhook-parser","last_synced_at":"2025-08-13T15:43:22.377Z","repository":{"id":249927304,"uuid":"832976959","full_name":"settermjd/mini-inbound-webhook-parser","owner":"settermjd","description":"This is a small project built with Slim PHP that shows how to work with SendGrid's Inbound Webhook Parser.","archived":false,"fork":false,"pushed_at":"2024-07-31T05:48:05.000Z","size":421,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-19T20:29:49.046Z","etag":null,"topics":["php","sendgrid","slim-framework"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/settermjd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-24T05:48:26.000Z","updated_at":"2024-07-31T05:48:07.000Z","dependencies_parsed_at":"2024-07-29T05:45:47.438Z","dependency_job_id":"d28b6185-5fe0-4f3e-bb5c-ca504251e06d","html_url":"https://github.com/settermjd/mini-inbound-webhook-parser","commit_stats":null,"previous_names":["settermjd/mini-inbound-webhook-parser"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/settermjd%2Fmini-inbound-webhook-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/settermjd%2Fmini-inbound-webhook-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/settermjd%2Fmini-inbound-webhook-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/settermjd%2Fmini-inbound-webhook-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/settermjd","download_url":"https://codeload.github.com/settermjd/mini-inbound-webhook-parser/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243330319,"owners_count":20274039,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["php","sendgrid","slim-framework"],"created_at":"2024-10-12T12:43:08.011Z","updated_at":"2025-03-13T03:16:03.641Z","avatar_url":"https://github.com/settermjd.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Example PHP Web App That Interacts With SendGrid's Inbound Parse Webhook\n\n![Test workflow](https://github.com/settermjd/mini-inbound-webhook-parser/actions/workflows/php.yml/badge.svg)\n\nThis is a small PHP web-based application that shows how to interact with SendGrid's [Inbound Parse Webhook](https://www.twilio.com/docs/sendgrid/for-developers/parsing-email/setting-up-the-inbound-parse-webhook).\nIt creates a note on a fictitious user's account with details from an email send in a POST request to the application.\n\nThe application supports an upcoming tutorial on [the Twilio blog](https://www.twilio.com/en-us/blog).\n\n## Prerequisites/Requirements\n\nTo run the code, you will need the following:\n\n- PHP 8.3 (or above, if later versions are stable) with the following extensions:\n  - [ctype](https://www.php.net/manual/en/book.ctype.php)\n  - [dom](https://www.php.net/manual/en/book.dom.php)\n  - [json](https://www.php.net/manual/en/book.json.php)\n  - [libxml](https://www.php.net/manual/en/book.libxml.php)\n  - [mailparse](https://www.php.net/manual/en/book.mailparse.php)\n  - [mbstring](https://www.php.net/manual/en/book.mbstring.php)\n  - [phar](https://www.php.net/manual/en/book.phar.php)\n  - [tokenizer](https://www.php.net/manual/en/book.tokenizer.php)\n  - [xml](https://www.php.net/manual/en/book.xml.php)\n  - [xmlwriter](https://www.php.net/manual/en/book.xmlwriter.php)\n- [Composer](https://getcomposer.org) installed globally\n- [Docker Desktop](https://www.docker.com/products/docker-desktop/)\n- A network testing tool such as [curl](https://curl.se/) or [Postman](https://www.postman.com/)\n- [Ngrok](https://ngrok.com/)\n- A Twilio account (free or paid) with an active phone number that can send SMS. \n  If you are new to Twilio, [create a free account](https://www.twilio.com/try-twilio).\n\n### How to install the mailparse extension\n\nIf the mailparse extension is not provided by your operating system's package manager, then the next best way to install it is with Pecl.\nTo install it that way, assuming that you have Pecl installed and available in your system path, run the following command\n\n```bash\npecl install --alldeps mailparse\n```\n\nAfter the command completes, check that the extension is installed and enabled by running the following command.\n\n```bash\nphp -m | grep mailparse\n```\n\nIf you see `mailparse` printed to the terminal, then it is installed and enabled.\n\nAlternatively, you could use the included Docker Compose configuration.\n\n## How to set up the application\n\n### Set the required environment variables\n\nAfter cloning the code, copy _.env.example_ as _.env_.\nThen, retrieve your Twilio _Account SID_, _Auth Token_, and _phone number_, and set them as the values of `TWILIO_ACCOUNT_SID`, `TWILIO_AUTH_TOKEN`, and `TWILIO_PHONE_NUMBER` respectively.\nYou can find all three in the **Account Info** panel of [the Twilio Console's dashboard](https://console.twilio.com).\nThe fourth environment variable will be set shortly.\n\n### Set up the application's database\n\nAt the bottom of database/dump.sql, are two `INSERT` commands.\nChange the default values of the first one to your name, email address, and your mobile/cell phone number (which must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164)).\n\nThen, in _email/sendgrid-example.eml_, you'll see the following line.\n\n```eml\nFrom: [[YOUR NAME]] \u003c[[YOUR EMAIL ADDRESS]]\u003e\n```\n\nReplace `[[YOUR NAME]]` with your name, and `[[YOUR EMAIL ADDRESS]]` with your email address. \n\n# How to use the application\n\n### Start the application\n\nTo run the project, you can either use Composer or the included Docker Compose configuration.\n\n```bash\n# Start the project with Composer\ncomposer serve\n\n# Start the project with Docker Compose\ndocker compose up -d\n```\n\n### Expose the application to the public internet \n\nStart ngrok, to expose the application to the public internet on port 8080, by running the following command.\n\n```bash\nngrok http 8080\n```\n\nThis will print output to the terminal similar to the following:\n\n```bash\nngrok                                                                                                  (Ctrl+C to quit)\n                                                                                                                       \nFound a bug? Let us know: https://github.com/ngrok/ngrok                                                               \n                                                                                                                       \nSession Status                online                                                                                   \nAccount                       Awesome User (Plan: Free)                                                               \nUpdate                        update available (version 3.13.0, Ctrl-U to update)                                      \nVersion                       3.10.0                                                                                   \nRegion                        Australia (au)                                                                           \nWeb Interface                 http://127.0.0.1:4040                                                                    \nForwarding                    https://cca2-1-146-99-255.ngrok-free.app -\u003e http://localhost:8080\n```\n\nCopy the **Forwarding URL** and set it in _.env_ as the value for `APP_BASE_URL`.\n\n## How to use the application\n\nOnce up and running, use a network testing tool such as curl or Postman to make a POST request to the default route, providing two POST parameters: \n\n- **subject:** This is the email's subject.  \n  It must match one of the following two, case-insensitive, formats: `Reference ID: \u003c\u003cREF_ID\u003e\u003e` or `Ref ID: \u003c\u003cREF_ID\u003e\u003e`. \n  `REF_ID` is a 14 character string, which can contain lower and uppercase letters from A to Z (inclusive) and any digit between 0 and 9 (inclusive).\n- **email:** This is the plain text version of an email (or a .eml file). You can find a sample one in the _email_ directory named _sendgrid-example.eml_.\n\nHere is an example of making a request with curl:\n\n```bash\ncurl \\\n  --form \"subject=Reference ID: MSAU2407240001\" \\\n  --form \"email=@email/sendgrid-example.eml\" \\\n  \u003c\u003cNGROK FORWARDING URL\u003e\u003e\n```\n\nAlternatively, you could use Postman, if you prefer a GUI.\n\n![](docs/images/postman-request.png)\n\nSet the request type to `POST` and the Ngrok Forwarding URL as the URL.\nThen, under **Body**, set the request type to `x-www-form-urlencoded`.\nAdd two keys:\n\n- `subject`: Set this to `Reference ID: MSAU2407240001`\n- `email`: Set this to the contents of _email/sendgrid-example.eml_\n\nThen, make the request by pressing **Send**.\n\nIf the request is successful, you'll see `{\"status\":\"success\",\"data\":{\"reference id\":\"MSAU2407240001\"}}` printed as the response body, and you'll receive an SMS.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsettermjd%2Fmini-inbound-webhook-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsettermjd%2Fmini-inbound-webhook-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsettermjd%2Fmini-inbound-webhook-parser/lists"}