Website
Home
Database
News
Submissions queue
Community
Forum
Clubs
Discord
Members
Tools
ROM Patcher
ROM Hasher
Pages
Support us
Learn Romhacking
About
Contact Us
Help & Legal Pages
Guest
Login
Forum
Entries
News
Settings
Documentations
API Documentation
Webhooks usage
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Benjamin" data-source="post: 6933" data-attributes="member: 192"><p>Romhack Plaza's webhooks let you stay up to date in real time on new content and updates to entries on the site. This can be useful for your personal website or your projects.</p><p></p><p><span style="font-size: 22px"><strong>How do I sign up for this service?</strong></span></p><p></p><p>First, you must have an account on the site. Next, in the Settings menu on the top bar, you'll find “Webhooks Subscriptions.”</p><p></p><p>[ATTACH=full]385[/ATTACH]</p><p></p><p>This will take you to a page where you can manage your current subscriptions or add new ones.</p><p></p><p>[ATTACH=full]384[/ATTACH]</p><p></p><p>When you create a subscription, you must specify the URL where the subscription information will be sent. You can also enter a name and choose the scope of your subscription.</p><p></p><p>[ATTACH=full]383[/ATTACH]</p><p></p><p>For scopes, you can choose by type, a specific entry, or even your own entries.</p><p></p><p>Once you’ve created your subscription, you’ll receive a secret that will allow you to verify any information transmitted.</p><p></p><p>[ATTACH=full]382[/ATTACH]</p><p></p><p><span style="font-size: 22px"><strong>How to Use Webhooks</strong></span></p><p></p><p>You must set up a system to verify and process the data that is sent.</p><p></p><p>To verify the data, you must perform the following operation:</p><p>Calculate the SHA-256 hash of the response/payload using the secret, then construct the following string:</p><p></p><p>‘sha256=<HASH>’</p><p></p><p>And you must verify that this string matches the one in the ‘X-Webhook-Signature’ header.</p><p></p><p>If you’re using PHP, here’s a sample code snippet:</p><p></p><p>[CODE=php]function romhackPlaza_VerifyWebhookSignature(</p><p> string $X_Webhook_Signature,</p><p> string $payload,</p><p> string $secret</p><p>): bool</p><p>{</p><p> $expected = 'sha256=' . hash_hmac('sha256', $payload, $secret);</p><p> return hash_equals($expected, $X_Webhook_Signature);</p><p>}[/CODE]</p><p></p><p>The transmitted information will be in this format:</p><p></p><p>[CODE=json][</p><p> 'action': 'published,version-updated',</p><p> 'entry_id': 0,</p><p> 'entry_title': "",</p><p> 'entry_version': "",</p><p> 'entry' => Entry (More details on getEntry API Endpoint)</p><p>][/CODE]</p><p></p><p><span style="font-size: 22px"><strong>What are the limitations of webhooks?</strong></span></p><p></p><p>Three attempts will be made if your first request fails. After that, the information will no longer be sent. If we see that a webhook with an invalid URL has not been deactivated, the webhook will be suspended.</p><p></p><p>If you haven’t financially supported Romhack Plaza, you’re limited to two separate webhooks. To get more webhooks, we invite you to support Romhack Plaza; more information is available on the webhook management page.</p><p>Additionally, you don’t have access to the “any” scope, which covers all entries.</p><p></p><p>Any use of multiple accounts to circumvent this limit may result in a permanent ban of your accounts, as well as the removal of all your content from the site.</p><p></p><p></p><p><strong>If you have any questions about the API, please post your questions below the documentation.</strong></p></blockquote><p></p>
[QUOTE="Benjamin, post: 6933, member: 192"] Romhack Plaza's webhooks let you stay up to date in real time on new content and updates to entries on the site. This can be useful for your personal website or your projects. [SIZE=6][B]How do I sign up for this service?[/B][/SIZE] First, you must have an account on the site. Next, in the Settings menu on the top bar, you'll find “Webhooks Subscriptions.” [ATTACH type="full"]385[/ATTACH] This will take you to a page where you can manage your current subscriptions or add new ones. [ATTACH type="full"]384[/ATTACH] When you create a subscription, you must specify the URL where the subscription information will be sent. You can also enter a name and choose the scope of your subscription. [ATTACH type="full"]383[/ATTACH] For scopes, you can choose by type, a specific entry, or even your own entries. Once you’ve created your subscription, you’ll receive a secret that will allow you to verify any information transmitted. [ATTACH type="full"]382[/ATTACH] [SIZE=6][B]How to Use Webhooks[/B][/SIZE] You must set up a system to verify and process the data that is sent. To verify the data, you must perform the following operation: Calculate the SHA-256 hash of the response/payload using the secret, then construct the following string: ‘sha256=<HASH>’ And you must verify that this string matches the one in the ‘X-Webhook-Signature’ header. If you’re using PHP, here’s a sample code snippet: [CODE=php]function romhackPlaza_VerifyWebhookSignature( string $X_Webhook_Signature, string $payload, string $secret ): bool { $expected = 'sha256=' . hash_hmac('sha256', $payload, $secret); return hash_equals($expected, $X_Webhook_Signature); }[/CODE] The transmitted information will be in this format: [CODE=json][ 'action': 'published,version-updated', 'entry_id': 0, 'entry_title': "", 'entry_version': "", 'entry' => Entry (More details on getEntry API Endpoint) ][/CODE] [SIZE=6][B]What are the limitations of webhooks?[/B][/SIZE] Three attempts will be made if your first request fails. After that, the information will no longer be sent. If we see that a webhook with an invalid URL has not been deactivated, the webhook will be suspended. If you haven’t financially supported Romhack Plaza, you’re limited to two separate webhooks. To get more webhooks, we invite you to support Romhack Plaza; more information is available on the webhook management page. Additionally, you don’t have access to the “any” scope, which covers all entries. Any use of multiple accounts to circumvent this limit may result in a permanent ban of your accounts, as well as the removal of all your content from the site. [B]If you have any questions about the API, please post your questions below the documentation.[/B] [/QUOTE]
Insert quotes…
Verification
Post reply
Documentations
API Documentation
Webhooks usage
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.
Accept
Learn more…
Back
Top