Listen to events on Periskope and build your custom integrations
While building your own WhatsApp integrations with Periskope, you might want to listen to events in real time. You can do this with Periskopeβs Webhooks.
Simply register a Webhook endpoint with Periskope and start receiving different events occuring inside the Periskope platform.You can also receive events with our Typescript SDK
A Periskope account: To use the Periskope API, you need to have a Periskope account. If you donβt have one, you can sign up for a free trial here.
An HTTP POST / Endpoint: Prepare your server to start receiving POST requests. Your server should have an endpoint ready to catch data sent by Periskope when events are sent.
In order to start receiving webhooks, you need to have a server that can handle incoming HTTP POST requests. The POST request endpoint needs to be open and publicly accessible without any authentication.
You can access the webhook configuration through your Periskope settings or click here to visit. Here, you can manage and set up new webhooks.
1
Add webhook π
Click on the Add Webhook button. This opens a modal where you can enter
the URL that will receive the webhook POST requests.
Add webhook
2
Choose events π
Choose the events you want to subscribe to from the list below. Each event
corresponds to different actions or changes in Periskope and whatsapp that
you can receive notifications for.
3
Create a Signing Key π
Generate a Signing Key
Signing Keys are used to verify that the webhook events that you receive on your destination come from a trusted source.
You can generate a Signing Key on the Webhook Screen by clicking on the Generate button. After copying your Signing Key, do not
share it to keep it protected. Learn more about how to verify your Signing Key on your server here.
4
Done β
After configuring the URL and selecting the desired events, save your
settings to activate the webhook.
Webhooks are now setted up on your Periskope account. Your endpoint will now receive HTTP POST requests whenever the subscribed events occur on the Periskope platform.
You can test your webhook by triggering any selected event from the Periskope platform.
Youβll be receiving the data in the following format:
{ "event_type": "<event-type>", "data": "<event-data>", // complete data object as mentioned in Objects section "org_id": "<your-organisation-id>", "timestamp": "<timestamp>" // timestamp of the event creation}
A signing key is used to verify that the events received in your webhook endpoints are from a trusted source. Periskope generates an
encrypted HMAC key for every request and sends the key in the x-periskope-signature header. On your webhook endpoint, you can check
this signature by decrypting the secret key and verifying the legitimacy of a request.You can generate your Singing Key from Settings > Webhooks screen.
Your Signing Key
Follow the code snippet below to verify your signing key on your server:
import * as express from "express";import { createHmac } from "crypto";// Replace this with your actual signing key obtained from the Periskope dashboard (to be stored in .env)const SHARED_SECRET = "YOUR_SIGNING_SECRET"; const app = express();app.use(express.json());// Verification function to check the signature of the requestfunction verifySignature(rawBody: Record<string, any>, signature: string) { // Create an HMAC SHA256 hash using the shared secret key const hmac = createHmac("sha256", SHARED_SECRET); // Update the HMAC hash with the stringified payload hmac.update(JSON.stringify(rawBody)); // Calculate the HMAC digest in hexadecimal format const digest = hmac.digest("hex"); // Compare the calculated digest with the signature provided in the header return digest === signature;}// Webhook endpoint handler for POST requests to /webhookapp.post("/webhook", (req: express.Request, res: express.Response) => { // Extract the signature from the 'x-periskope-signature' header const signature = req.headers["x-periskope-signature"] as string; // Verify the signature of the incoming request. // It's important to use the raw request body before any parsing/modification // if your framework modifies the body. // Here, we assume `req.body` contains the parsed JSON object. const isValid = verifySignature(req.body, signature); // If the signature is invalid, respond with an Unauthorized status if (!isValid) { return res.status(401).send("Invalid signature"); } // If the signature is valid, process the webhook event console.log("Received valid webhook event:", req.body); // Add your custom logic here to handle the event (e.g., update database, send notifications) res.status(200).send("ok");});const PORT = 3000;app.listen(PORT, () => { console.log(`Webhook server listening on port ${PORT}`);});
Was this page helpful?
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Periskope Docs","colors":{"primary":"#15803D","light":"#15803D"},"logo":{"light":"https://mintcdn.com/bharatkumarramesh/Sq5VlnE2OgDOCH8s/logo/periskope-logo-full.svg?fit=max\u0026auto=format\u0026n=Sq5VlnE2OgDOCH8s\u0026q=85\u0026s=cace2e822ea7c0cd2a98b9d946baa593","dark":"https://mintcdn.com/bharatkumarramesh/Sq5VlnE2OgDOCH8s/logo/periskope-logo-full.svg?fit=max\u0026auto=format\u0026n=Sq5VlnE2OgDOCH8s\u0026q=85\u0026s=cace2e822ea7c0cd2a98b9d946baa593"},"favicon":"https://mintcdn.com/bharatkumarramesh/4Au0rGi6EzWXLRIt/logo/periskope-logo.svg?fit=max\u0026auto=format\u0026n=4Au0rGi6EzWXLRIt\u0026q=85\u0026s=275c52e578008a630d9a4c6e150100a0","api":{"playground":{"display":"none"}},"appearance":{"strict":true},"navbar":{"links":[{"href":"https://www.postman.com/periskope/workspace/periskope-platform-api","label":"Postman API collection"},{"href":"https://what.sapp.link/periskope","label":"Support"}],"primary":{"type":"button","label":"Dashboard","href":"https://console.periskope.app"}},"footer":{"socials":{"twitter":"https://twitter.com/periskope_app","linkedin":"https://www.linkedin.com/company/periskope-app","youtube":"https://www.youtube.com/@PeriskopeApp"}},"integrations":{"gtm":{"tagId":"GTM-N9SPZLGR"}},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"bharatkumarramesh","hasAudioNarration":false,"actualSubdomain":"bharatkumarramesh","customDomains":["docs.periskope.app"],"gitSource":{"type":"github","owner":"periskope-org","repo":"docs-mintlify","deployBranch":"main","contentDirectory":"","isPrivate":false,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6ace2b08a71bd07e07006d57","collectionId":"48f31024-df92-485a-8d57-54cf320a1a90","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6ace2b08a71bd07e07006d57"},"feedback":{"thumbs":true},"entitlements":{},"buildId":"6ace2b08a71bd07e07006d57","clientVersion":"0.0.3908","searchFilterCounts":[{"language":"default","tag":"APIs \u0026 Webhooks","count":133},{"language":"default","tag":"Documentation","count":68},{"language":"default","tag":"Webhooks","count":21},{"language":"default","tag":"Message APIs","count":14},{"language":"default","tag":"API","count":13},{"language":"default","tag":"Chat APIs","count":13},{"language":"default","tag":"AI Agent","count":11},{"language":"default","tag":"Manage WhatsApp Groups, 1:1 Chats \u0026 Communities","count":11},{"language":"default","tag":"Group Settings APIs","count":9},{"language":"default","tag":"Objects","count":9}]},"assistantConfig":{},"hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-v7-file-tree","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"pause-universal-search-reconcile","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"per-site-search-delta","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-branches-v2-autocommit","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-branches-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-private-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"teamspace","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-nav-generations","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"byok-sep-25","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-agent-model-picker","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"client-snapshot-docs-config","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"isAtlas":false,"googleFontsInlined":false},"customCss":[{"filePath":"style.css","content":".image-container{max-width:50%;margin:0 auto}"}],"page":{"pagePath":"api-reference/webhooks/introduction","slug":"/api-reference/webhooks/introduction","pageMetadata":{"title":"Introduction","description":"Listen to events on Periskope and build your custom integrations","href":"/api-reference/webhooks/introduction"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Listen to events on Periskope and build your custom integrations\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,ol:`ol`,p:`p`,pre:`pre`,span:`span`,..._provideComponents(),...props.components},{CodeBlock,Frame,Heading,Info,OptimizedImage,Step,Steps,Tip}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Frame)_missingMdxReference(`Frame`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Info)_missingMdxReference(`Info`,true);if(!OptimizedImage)_missingMdxReference(`OptimizedImage`,true);if(!Step)_missingMdxReference(`Step`,true);if(!Steps)_missingMdxReference(`Steps`,true);if(!Tip)_missingMdxReference(`Tip`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`While building your own WhatsApp integrations with Periskope, you might want to listen to events in real time. You can do this with Periskopeβs Webhooks.\nSimply register a Webhook endpoint with Periskope and start receiving different events occuring inside the Periskope platform.`}),`\n`,_jsxs(_components.p,{children:[`You can also receive events with our `,_jsx(_components.a,{href:`/api-reference/sdk`,children:`Typescript SDK`})]}),`\n`,_jsx(Heading,{level:`2`,id:`prerequisites`,children:`Prerequisites`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`A `,_jsx(_components.code,{children:`Periskope account`}),`: To use the Periskope API, you need to have a Periskope account. If you donβt have one, you can sign up for a free trial `,_jsx(_components.a,{href:`https://console.periskope.app`,children:`here`}),`.`]}),`\n`,_jsxs(_components.li,{children:[`An `,_jsx(_components.code,{children:`HTTP POST /`}),` Endpoint: Prepare your server to start receiving POST requests. Your server should have an endpoint ready to catch data sent by Periskope when events are sent.`]}),`\n`]}),`\n`,_jsx(Info,{children:_jsx(_components.p,{children:`In order to start receiving webhooks, you need to have a server that can handle incoming HTTP POST requests. The POST request endpoint needs to be open and publicly accessible without any authentication.`})}),`\n`,_jsx(Heading,{level:`2`,id:`setting-up-webhooks-on-periskope-`,children:`Setting up webhooks on Periskope π§`}),`\n`,_jsxs(_components.p,{children:[`You can access the webhook configuration through your Periskope settings or click `,_jsx(_components.a,{href:`https://console.periskope.app/settings/integrations/webhooks`,children:`here`}),` to visit. Here, you can manage and set up new webhooks.`]}),`\n`,_jsxs(Steps,{children:[_jsxs(Step,{title:`Add webhook π`,children:[_jsxs(_components.p,{children:[`Click on the `,_jsx(_components.code,{children:`Add Webhook`}),` button. This opens a modal where you can enter\nthe URL that will receive the webhook POST requests.`]}),_jsx(Frame,{caption:`Add webhook`,children:_jsx(OptimizedImage,{className:`mint-border mint-rounded-xl mint-shadow`,src:`https://mintcdn.com/bharatkumarramesh/nLZLyDfnObVs3JXO/api-reference/assets/add-webhook.png?fit=max\u0026auto=format\u0026n=nLZLyDfnObVs3JXO\u0026q=85\u0026s=bae52a80c246813de5bd03d07a5a8bc0`,alt:`Step 1`,\"data-og-width\":`2318`,width:`2318`,\"data-og-height\":`1465`,height:`1465`,\"data-path\":`api-reference/assets/add-webhook.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/bharatkumarramesh/nLZLyDfnObVs3JXO/api-reference/assets/add-webhook.png?w=280\u0026fit=max\u0026auto=format\u0026n=nLZLyDfnObVs3JXO\u0026q=85\u0026s=00bc7d998ddc65defc971a204700ac9c 280w, https://mintcdn.com/bharatkumarramesh/nLZLyDfnObVs3JXO/api-reference/assets/add-webhook.png?w=560\u0026fit=max\u0026auto=format\u0026n=nLZLyDfnObVs3JXO\u0026q=85\u0026s=fa408324fcc4b3862d992730d92fb2d0 560w, https://mintcdn.com/bharatkumarramesh/nLZLyDfnObVs3JXO/api-reference/assets/add-webhook.png?w=840\u0026fit=max\u0026auto=format\u0026n=nLZLyDfnObVs3JXO\u0026q=85\u0026s=acfa7fd17d34257694374a64b67996ca 840w, https://mintcdn.com/bharatkumarramesh/nLZLyDfnObVs3JXO/api-reference/assets/add-webhook.png?w=1100\u0026fit=max\u0026auto=format\u0026n=nLZLyDfnObVs3JXO\u0026q=85\u0026s=71c5052128e52206cfa3def0ed272816 1100w, https://mintcdn.com/bharatkumarramesh/nLZLyDfnObVs3JXO/api-reference/assets/add-webhook.png?w=1650\u0026fit=max\u0026auto=format\u0026n=nLZLyDfnObVs3JXO\u0026q=85\u0026s=9802993036bba176e91041d096cfc051 1650w, https://mintcdn.com/bharatkumarramesh/nLZLyDfnObVs3JXO/api-reference/assets/add-webhook.png?w=2500\u0026fit=max\u0026auto=format\u0026n=nLZLyDfnObVs3JXO\u0026q=85\u0026s=614b060ea1c84ef3e03e9fba42e507ce 2500w`})})]}),_jsx(Step,{title:`Choose events π`,children:_jsx(_components.p,{children:`Choose the events you want to subscribe to from the list below. Each event\ncorresponds to different actions or changes in Periskope and whatsapp that\nyou can receive notifications for.`})}),_jsxs(Step,{title:`Create a Signing Key π`,children:[_jsx(Frame,{caption:`Generate a Signing Key`,children:_jsx(OptimizedImage,{className:`mint-border mint-rounded-xl mint-shadow`,src:`https://mintcdn.com/bharatkumarramesh/nLZLyDfnObVs3JXO/api-reference/assets/signing-key.png?fit=max\u0026auto=format\u0026n=nLZLyDfnObVs3JXO\u0026q=85\u0026s=26be578898ba3132b7601c1590fbc2e3`,alt:`Step 3`,\"data-og-width\":`1530`,width:`1530`,\"data-og-height\":`406`,height:`406`,\"data-path\":`api-reference/assets/signing-key.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/bharatkumarramesh/nLZLyDfnObVs3JXO/api-reference/assets/signing-key.png?w=280\u0026fit=max\u0026auto=format\u0026n=nLZLyDfnObVs3JXO\u0026q=85\u0026s=1902acb9a23152604f619d6b292f18b2 280w, https://mintcdn.com/bharatkumarramesh/nLZLyDfnObVs3JXO/api-reference/assets/signing-key.png?w=560\u0026fit=max\u0026auto=format\u0026n=nLZLyDfnObVs3JXO\u0026q=85\u0026s=7de05bf44ed5a77ffc1b5c83d4a84c67 560w, https://mintcdn.com/bharatkumarramesh/nLZLyDfnObVs3JXO/api-reference/assets/signing-key.png?w=840\u0026fit=max\u0026auto=format\u0026n=nLZLyDfnObVs3JXO\u0026q=85\u0026s=e542fca68ad6202404d173702929ed57 840w, https://mintcdn.com/bharatkumarramesh/nLZLyDfnObVs3JXO/api-reference/assets/signing-key.png?w=1100\u0026fit=max\u0026auto=format\u0026n=nLZLyDfnObVs3JXO\u0026q=85\u0026s=9c0f179c5d3e38c2f1d2f27adfc0e0f3 1100w, https://mintcdn.com/bharatkumarramesh/nLZLyDfnObVs3JXO/api-reference/assets/signing-key.png?w=1650\u0026fit=max\u0026auto=format\u0026n=nLZLyDfnObVs3JXO\u0026q=85\u0026s=c4ec19fb1710f165646f3dca87a39925 1650w, https://mintcdn.com/bharatkumarramesh/nLZLyDfnObVs3JXO/api-reference/assets/signing-key.png?w=2500\u0026fit=max\u0026auto=format\u0026n=nLZLyDfnObVs3JXO\u0026q=85\u0026s=14aa732cc4fa1a5b93515801c928139e 2500w`})}),_jsxs(_components.p,{children:[`Signing Keys are used to verify that the webhook events that you receive on your destination come from a trusted source.\nYou can generate a Signing Key on the Webhook Screen by clicking on the `,_jsx(_components.code,{children:`Generate`}),` button. After copying your Signing Key, do not\nshare it to keep it protected. Learn more about how to verify your Signing Key on your server here.`]})]}),_jsx(Step,{title:`Done β `,children:_jsx(_components.p,{children:`After configuring the URL and selecting the desired events, save your\nsettings to activate the webhook.`})})]}),`\n`,_jsx(Heading,{level:`2`,id:`result-`,children:`Result π`}),`\n`,_jsx(_components.p,{children:`Webhooks are now setted up on your Periskope account. Your endpoint will now receive HTTP POST requests whenever the subscribed events occur on the Periskope platform.`}),`\n`,_jsx(Tip,{children:_jsx(_components.p,{children:`You can test your webhook by triggering any selected event from the Periskope platform.`})}),`\n`,_jsx(Heading,{level:`3`,id:`event-structure-`,children:`Event structure π¦`}),`\n`,_jsx(_components.p,{children:`Youβll be receiving the data in the following format:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`6`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`6`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"event_type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"\u003cevent-type>\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"data\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"\u003cevent-data>\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// complete data object as mentioned in Objects section`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"org_id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"\u003cyour-organisation-id>\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"timestamp\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"\u003ctimestamp>\"`}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // timestamp of the event creation`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`verifying-your-signing-key`,children:`Verifying your Signing Key`}),`\n`,_jsxs(_components.p,{children:[`A signing key is used to verify that the events received in your webhook endpoints are from a trusted source. Periskope generates an\nencrypted HMAC key for every request and sends the key in the `,_jsx(_components.code,{children:`x-periskope-signature`}),` header. On your webhook endpoint, you can check\nthis signature by decrypting the secret key and verifying the legitimacy of a request.`]}),`\n`,_jsxs(_components.p,{children:[`You can generate your Singing Key from `,_jsx(_components.code,{children:`Settings > Webhooks`}),` screen.`]}),`\n`,_jsx(Frame,{caption:`Your Signing Key`,children:_jsx(OptimizedImage,{className:`mint-border mint-rounded-xl mint-shadow`,src:`https://mintcdn.com/bharatkumarramesh/nLZLyDfnObVs3JXO/api-reference/assets/signing-key-unrevealed.png?fit=max\u0026auto=format\u0026n=nLZLyDfnObVs3JXO\u0026q=85\u0026s=1c227c81b6770527e1860beb77b54a8c`,alt:`Step 3`,\"data-og-width\":`1548`,width:`1548`,\"data-og-height\":`356`,height:`356`,\"data-path\":`api-reference/assets/signing-key-unrevealed.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/bharatkumarramesh/nLZLyDfnObVs3JXO/api-reference/assets/signing-key-unrevealed.png?w=280\u0026fit=max\u0026auto=format\u0026n=nLZLyDfnObVs3JXO\u0026q=85\u0026s=9d41837ef94f853fdbc797edb132a4c2 280w, https://mintcdn.com/bharatkumarramesh/nLZLyDfnObVs3JXO/api-reference/assets/signing-key-unrevealed.png?w=560\u0026fit=max\u0026auto=format\u0026n=nLZLyDfnObVs3JXO\u0026q=85\u0026s=31eef4d02a71f9fcd5e6fd769bf8dcf9 560w, https://mintcdn.com/bharatkumarramesh/nLZLyDfnObVs3JXO/api-reference/assets/signing-key-unrevealed.png?w=840\u0026fit=max\u0026auto=format\u0026n=nLZLyDfnObVs3JXO\u0026q=85\u0026s=dde2e4bc2f29c49281ad594f008906c4 840w, https://mintcdn.com/bharatkumarramesh/nLZLyDfnObVs3JXO/api-reference/assets/signing-key-unrevealed.png?w=1100\u0026fit=max\u0026auto=format\u0026n=nLZLyDfnObVs3JXO\u0026q=85\u0026s=c436e8f1dc78eea4c56780f5b2d9283f 1100w, https://mintcdn.com/bharatkumarramesh/nLZLyDfnObVs3JXO/api-reference/assets/signing-key-unrevealed.png?w=1650\u0026fit=max\u0026auto=format\u0026n=nLZLyDfnObVs3JXO\u0026q=85\u0026s=ce6e7deef9e411e6ef46a93e13c621b1 1650w, https://mintcdn.com/bharatkumarramesh/nLZLyDfnObVs3JXO/api-reference/assets/signing-key-unrevealed.png?w=2500\u0026fit=max\u0026auto=format\u0026n=nLZLyDfnObVs3JXO\u0026q=85\u0026s=0b317539c6a260d72b407c54a00452d1 2500w`})}),`\n`,_jsx(_components.p,{children:`Follow the code snippet below to verify your signing key on your server:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`53`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`53`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` *`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` express`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"express\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`createHmac`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"crypto\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Replace this with your actual signing key obtained from the Periskope dashboard (to be stored in .env)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` SHARED_SECRET`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"YOUR_SIGNING_SECRET\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`; `})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` app`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` express`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`app`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`use`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`express`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`json`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`());`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Verification function to check the signature of the request`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`function`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` verifySignature`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`rawBody`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` Record`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`string`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`any`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`>, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`signature`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` string`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Create an HMAC SHA256 hash using the shared secret key`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` hmac`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` createHmac`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"sha256\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`SHARED_SECRET`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Update the HMAC hash with the stringified payload`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` hmac`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`update`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`JSON`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`stringify`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`rawBody`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`));`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Calculate the HMAC digest in hexadecimal format`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` digest`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` hmac`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`digest`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"hex\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` `})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Compare the calculated digest with the signature provided in the header`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` digest`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ===`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` signature`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Webhook endpoint handler for POST requests to /webhook`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`app`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`post`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"/webhook\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, (`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`req`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` express`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`Request`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`res`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` express`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`Response`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Extract the signature from the 'x-periskope-signature' header`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` signature`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` req`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`headers`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"x-periskope-signature\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`] `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`as`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` string`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Verify the signature of the incoming request.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // It's important to use the raw request body before any parsing/modification`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // if your framework modifies the body.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:\" // Here, we assume `req.body` contains the parsed JSON object.\"})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` isValid`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` verifySignature`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`req`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`body`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`signature`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // If the signature is invalid, respond with an Unauthorized status`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`!`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`isValid`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` res`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`status`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`401`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`).`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`send`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Invalid signature\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // If the signature is valid, process the webhook event`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`log`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Received valid webhook event:\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`req`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`body`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Add your custom logic here to handle the event (e.g., update database, send notifications)`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` res`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`status`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`200`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`).`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`send`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"ok\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` PORT`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 3000`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`app`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`listen`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`PORT`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, () `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`log`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`Webhook server listening on port \"}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`PORT`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`]})})})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Introduction","description":"Listen to events on Periskope and build your custom integrations","href":"/api-reference/webhooks/introduction"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Prerequisites","slug":"prerequisites","depth":2,"children":[]},{"title":"Setting up webhooks on Periskope π§","slug":"setting-up-webhooks-on-periskope-","depth":2,"children":[]},{"title":"Result π","slug":"result-","depth":2,"children":[{"title":"Event structure π¦","slug":"event-structure-","depth":3,"children":[]}]},{"title":"Verifying your Signing Key","slug":"verifying-your-signing-key","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"dynamicCss":".mint-rounded-xl {\n border-radius: 0.75rem\n}\n.mint-border {\n border-width: 1px\n}\n.mint-shadow {\n --tw-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);\n --tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)\n}","subdomain":"bharatkumarramesh","siteName":"Periskope Docs","title":"Introduction - Periskope Docs","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-08-10T12:40:19.613Z","originalFileLocation":"api-reference/webhooks/introduction.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Listen to events on Periskope and build your custom integrations\">\u003cmeta data-mint-head name=\"application-name\" content=\"Periskope Docs\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/bharatkumarramesh/xEFzGZM_csru_Nms/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/bharatkumarramesh/xEFzGZM_csru_Nms/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/bharatkumarramesh/xEFzGZM_csru_Nms/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/bharatkumarramesh/xEFzGZM_csru_Nms/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/bharatkumarramesh/xEFzGZM_csru_Nms/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/bharatkumarramesh/xEFzGZM_csru_Nms/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/bharatkumarramesh/xEFzGZM_csru_Nms/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/bharatkumarramesh/xEFzGZM_csru_Nms/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/bharatkumarramesh/xEFzGZM_csru_Nms/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Introduction - Periskope Docs\">\u003cmeta data-mint-head property=\"og:description\" content=\"Listen to events on Periskope and build your custom integrations\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Periskope Docs\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.periskope.app/api-reference/webhooks/introduction\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Introduction - Periskope Docs\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Listen to events on Periskope and build your custom integrations\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/bharatkumarramesh/xEFzGZM_csru_Nms/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Periskope Docs\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#15803D\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.periskope.app/api-reference/webhooks/introduction\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/api-reference/webhooks/introduction.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.periskope.app/#organization\",\"name\":\"Periskope Docs\",\"url\":\"https://docs.periskope.app\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/bharatkumarramesh/Sq5VlnE2OgDOCH8s/logo/periskope-logo-full.svg?fit=max\u0026auto=format\u0026n=Sq5VlnE2OgDOCH8s\u0026q=85\u0026s=cace2e822ea7c0cd2a98b9d946baa593\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.periskope.app#website\",\"name\":\"Periskope Docs\",\"url\":\"https://docs.periskope.app\",\"publisher\":{\"@id\":\"https://docs.periskope.app/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.periskope.app/api-reference/webhooks/introduction#webpage\",\"url\":\"https://docs.periskope.app/api-reference/webhooks/introduction\",\"name\":\"Introduction\",\"description\":\"Listen to events on Periskope and build your custom integrations\",\"dateModified\":\"2026-08-10T12:40:19.613Z\",\"isPartOf\":{\"@id\":\"https://docs.periskope.app#website\"},\"breadcrumb\":{\"@id\":\"https://docs.periskope.app/api-reference/webhooks/introduction#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.periskope.app/api-reference/webhooks/introduction#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Periskope Docs\",\"item\":\"https://docs.periskope.app\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Introduction\",\"item\":\"https://docs.periskope.app/api-reference/webhooks/introduction\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.periskope.app/api-reference/webhooks/introduction#article\",\"headline\":\"Introduction\",\"name\":\"Introduction\",\"description\":\"Listen to events on Periskope and build your custom integrations\",\"url\":\"https://docs.periskope.app/api-reference/webhooks/introduction\",\"mainEntityOfPage\":{\"@id\":\"https://docs.periskope.app/api-reference/webhooks/introduction#webpage\"},\"dateModified\":\"2026-08-10T12:40:19.613Z\",\"publisher\":{\"@id\":\"https://docs.periskope.app/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.periskope.app#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Periskope Docs\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Periskope Docs","nav":{"global":null,"anchors":[{"anchor":"Documentation","icon":"book-open","pages":[{"title":"Documentation","href":"/get-started/introduction"}]},{"anchor":"APIs \u0026 Webhooks","icon":"webhook","groups":[{"group":"API","pages":[{"title":"Introduction","href":"/api-reference/introduction"},{"title":"Authorization","href":"/api-reference/authorization"},{"title":"SDK","href":"/api-reference/sdk"},{"group":"Objects","pages":[{"title":"The Chat Object","href":"/api-reference/objects/the-chat-object"},{"title":"The Chat Notification Object","href":"/api-reference/objects/the-chat-notification-object"},{"title":"The Reaction Object","href":"/api-reference/objects/the-reaction-object"},{"title":"The Message Object","href":"/api-reference/objects/the-message-object"},{"title":"The Contact Object","href":"/api-reference/objects/the-contact-object"},{"title":"The Ticket Info Object","href":"/api-reference/objects/the-ticket-info-object"},{"title":"The Task Object","href":"/api-reference/objects/the-task-object"},{"title":"The Phone Object","href":"/api-reference/objects/the-phone-object"},{"title":"The Note Object","href":"/api-reference/objects/the-note-object"}]},{"title":"WhatsApp Message Ack Status","href":"/api-reference/delivery-status"}]},{"group":"Chat APIs","icon":"comments","pages":[{"title":"Get Chat By ID","openapi":"api-reference/openapi-generated.json GET /v1/chats/{chat_id}","href":"/api-reference/chat/get-chat-by-id"},{"title":"Get Messages in a Chat","openapi":"api-reference/openapi-generated.json GET /v1/chats/{chat_id}/messages","href":"/api-reference/chat/get-messages-in-chat"},{"title":"Get Private Notes in a Chat","openapi":"api-reference/openapi-generated.json GET /v1/chats/{chat_id}/notes","href":"/api-reference/chat/get-private-notes-in-chat"},{"title":"Get Notifications in a Chat","openapi":"api-reference/openapi-generated.json GET /v1/chats/{chat_id}/notifications","href":"/api-reference/chat/get-notifications-in-chat"},{"title":"List All Chats","openapi":"api-reference/openapi-generated.json GET /v1/chats","href":"/api-reference/chat/list-all-chats"},{"title":"List All Messages","openapi":"api-reference/openapi-generated.json GET /v1/chats/messages","href":"/api-reference/chat/list-all-messages"},{"title":"List All Notifications","openapi":"api-reference/openapi-generated.json GET /v1/chats/notifications","href":"/api-reference/chat/list-all-notifications"},{"title":"Update Chat Labels","openapi":"api-reference/openapi-generated.json PATCH /v1/chats/labels","href":"/api-reference/chat/update-chat-labels"},{"title":"Update Chat","openapi":"api-reference/openapi-generated.json PATCH /v1/chats/{chat_id}","href":"/api-reference/chat/update-chat"},{"title":"Mark chat as read","openapi":"api-reference/openapi-generated.json POST /v1/chats/{chat_id}/read","href":"/api-reference/chat/mark-read"},{"title":"Update Chat Access","openapi":"api-reference/openapi-generated.json PATCH /v1/chats/access","href":"/api-reference/chat/override-chat-access"},{"title":"Get Chat Audit Logs","openapi":"api-reference/openapi-generated.json GET /v1/chats/{chat_id}/audit-logs","href":"/api-reference/chat/get-chat-audit-logs"},{"title":"Update Chat AI Settings","openapi":"api-reference/openapi-generated.json PATCH /v1/chats/{chat_id}/ai","href":"/api-reference/chat/update-chat-ai-settings"}]},{"group":"Group Settings APIs","pages":[{"title":"Create Group","openapi":"api-reference/openapi-generated.json POST /v1/chats/create","href":"/api-reference/chat/create-group"},{"title":"Generate a new invite link for a chat","openapi":"api-reference/openapi-generated.json POST /v1/chats/{chat_id}/invite","href":"/api-reference/chat/refresh-invite"},{"title":"Add Participant to Group","openapi":"api-reference/openapi-generated.json POST /v1/chats/{chat_id}/add","href":"/api-reference/chat/add-participant"},{"title":"Remove Participant from Group","openapi":"api-reference/openapi-generated.json POST /v1/chats/{chat_id}/remove","href":"/api-reference/chat/remove-participant"},{"title":"Promote Participant to Admin","openapi":"api-reference/openapi-generated.json POST /v1/chats/{chat_id}/promote","href":"/api-reference/chat/promote-participant-to-admin"},{"title":"Demote Participant to Member","openapi":"api-reference/openapi-generated.json POST /v1/chats/{chat_id}/demote","href":"/api-reference/chat/demote-participant-to-member"},{"title":"Update Group Settings","openapi":"api-reference/openapi-generated.json POST /v1/chats/{chat_id}/settings","href":"/api-reference/chat/update-group-settings"},{"title":"Accept Group Invite","openapi":"api-reference/openapi-generated.json POST /v1/chats/accept-invite","href":"/api-reference/chat/accept-group-invite"},{"title":"Leave Group","openapi":"api-reference/openapi-generated.json POST /v1/chats/{chat_id}/leave","href":"/api-reference/chat/leave-group"}]},{"group":"Message APIs","icon":"comment","pages":[{"title":"Send Message","openapi":"api-reference/openapi-generated.json POST /v1/message/send","href":"/api-reference/message/send-message"},{"title":"Send Sync Message","openapi":"api-reference/openapi-generated.json POST /v1/message/send-sync","href":"/api-reference/message/send-message-sync"},{"title":"Broadcast Message","openapi":"api-reference/openapi-generated.json POST /v1/message/broadcast","href":"/api-reference/message/broadcast-message"},{"title":"Delete a Broadcast","openapi":"api-reference/openapi-generated.json DELETE /v1/message/broadcast/{broadcast_id}","href":"/api-reference/message/delete-broadcast"},{"title":"Delete Message","openapi":"api-reference/openapi-generated.json POST /v1/message/{message_id}/delete","href":"/api-reference/message/delete-message"},{"title":"Edit Message","openapi":"api-reference/openapi-generated.json POST /v1/message/{message_id}/edit","href":"/api-reference/message/edit-message"},{"title":"Forward Message","openapi":"api-reference/openapi-generated.json POST /v1/message/{message_id}/forward","href":"/api-reference/message/forward-message"},{"title":"Get Message","openapi":"api-reference/openapi-generated.json GET /v1/message/{message_id}","href":"/api-reference/message/get-message"},{"title":"React to Message","openapi":"api-reference/openapi-generated.json POST /v1/message/{message_id}/react","href":"/api-reference/message/react-to-message"},{"title":"Pin Message","openapi":"api-reference/openapi-generated.json POST /v1/message/{message_id}/pin","href":"/api-reference/message/pin-message"},{"title":"Get Message Status","openapi":"api-reference/openapi-generated.json GET /v1/message/{unique_id}/status","href":"/api-reference/message/message-status"},{"title":"List All Message Queues","openapi":"api-reference/openapi-generated.json POST /v1/message/queues","href":"/api-reference/message/list-queue-jobs"},{"title":"Get Status of Message Queues","openapi":"api-reference/openapi-generated.json GET /v1/message/queues/health","href":"/api-reference/message/queue-health"},{"title":"Purge Message Queues","openapi":"api-reference/openapi-generated.json POST /v1/message/queues/purge","href":"/api-reference/message/purge-queue-jobs"}]},{"group":"Scheduled Message APIs","pages":[{"title":"List Scheduled Messages","openapi":"api-reference/openapi-generated.json GET /v1/message/scheduled","href":"/api-reference/scheduled-messages/list-scheduled-messages"},{"title":"Schedule a Message","openapi":"api-reference/openapi-generated.json POST /v1/message/scheduled","href":"/api-reference/scheduled-messages/schedule-message"},{"title":"Get Scheduled Message","openapi":"api-reference/openapi-generated.json GET /v1/message/scheduled/{scheduled_id}","href":"/api-reference/scheduled-messages/get-scheduled-message"},{"title":"Update Scheduled Message","openapi":"api-reference/openapi-generated.json PATCH /v1/message/scheduled/{scheduled_id}","href":"/api-reference/scheduled-messages/update-scheduled-message"},{"title":"Delete Scheduled Message","openapi":"api-reference/openapi-generated.json DELETE /v1/message/scheduled/{scheduled_id}","href":"/api-reference/scheduled-messages/delete-scheduled-message"},{"title":"List Scheduled Message Runs","openapi":"api-reference/openapi-generated.json GET /v1/message/scheduled/{scheduled_id}/occurrences","href":"/api-reference/scheduled-messages/list-scheduled-message-occurrences"}]},{"group":"Media APIs","icon":"photo-film","pages":[{"title":"Migrate Media URL","api":"POST https://api.periskope.app/v1/media/migrate-url","href":"/api-reference/media/migrate-url"},{"title":"Migrate Media URLs (Batch)","api":"POST https://api.periskope.app/v1/media/migrate-url/batch","href":"/api-reference/media/migrate-url-batch"}]},{"group":"Contact APIs","icon":"phone","pages":[{"title":"Get Contact By ID","openapi":"api-reference/openapi-generated.json GET /v1/contacts/{contact_id}","href":"/api-reference/contacts/get-contact-by-id"},{"title":"Get Contacts","openapi":"api-reference/openapi-generated.json GET /v1/contacts","href":"/api-reference/contacts/get-contacts"},{"title":"Update Contact Labels","openapi":"api-reference/openapi-generated.json PATCH /v1/contacts/labels","href":"/api-reference/contacts/update-contact-labels"},{"title":"Update Contact","openapi":"api-reference/openapi-generated.json PATCH /v1/contacts/{contact_id}","href":"/api-reference/contacts/update-contact"},{"title":"Create Contact","openapi":"api-reference/openapi-generated.json POST /v1/contacts/create","href":"/api-reference/contacts/create-contact"},{"title":"Check Contact Exists","openapi":"api-reference/openapi-generated.json POST /v1/contacts/check","href":"/api-reference/contacts/check-contact"}]},{"group":"Ticket APIs","icon":"ticket","pages":[{"title":"Get Ticket By ID","openapi":"api-reference/openapi-generated.json GET /v1/tickets/{ticket_id}","href":"/api-reference/tickets/get-ticket-by-id"},{"title":"Get Tickets","openapi":"api-reference/openapi-generated.json GET /v1/tickets","href":"/api-reference/tickets/get-tickets"},{"title":"Update Ticket","openapi":"api-reference/openapi-generated.json PATCH /v1/tickets/{ticket_id}","href":"/api-reference/tickets/update-ticket"},{"title":"Create Ticket","openapi":"api-reference/openapi-generated.json POST /v1/tickets/create","href":"/api-reference/tickets/create-ticket"},{"title":"Get Ticket Audit Logs","openapi":"api-reference/openapi-generated.json GET /v1/tickets/{ticket_id}/audit-logs","href":"/api-reference/tickets/get-ticket-audit-logs"}]},{"group":"Custom Property APIs","icon":"list-dropdown","pages":[{"title":"Get All Custom Properties","openapi":"api-reference/openapi-generated.json GET /v1/properties","href":"/api-reference/properties/get-all-custom-properties"},{"title":"Get Custom Property","openapi":"api-reference/openapi-generated.json GET /v1/properties/{property_id}","href":"/api-reference/properties/get-custom-property"},{"title":"Create Custom Property","openapi":"api-reference/openapi-generated.json POST /v1/properties/create","href":"/api-reference/properties/create-custom-property"},{"title":"Update Custom Property","openapi":"api-reference/openapi-generated.json POST /v1/properties/{property_id}","href":"/api-reference/properties/update-custom-property"},{"title":"Update Property Options","openapi":"api-reference/openapi-generated.json POST /v1/properties/{property_id}/options","href":"/api-reference/properties/update-property-options"},{"title":"Delete Custom Properties","openapi":"api-reference/openapi-generated.json DELETE /v1/properties","href":"/api-reference/properties/delete-custom-property"}]},{"group":"Task APIs","icon":"list-check","pages":[{"title":"Get Task By ID","openapi":"api-reference/openapi-generated.json GET /v1/tasks/{task_id}","href":"/api-reference/tasks/get-task-by-id"},{"title":"Get All Tasks","openapi":"api-reference/openapi-generated.json GET /v1/tasks","href":"/api-reference/tasks/get-tasks"},{"title":"Create Task","openapi":"api-reference/openapi-generated.json POST /v1/tasks/create","href":"/api-reference/tasks/create-task"},{"title":"Update Task","openapi":"api-reference/openapi-generated.json PATCH /v1/tasks/{task_id}","href":"/api-reference/tasks/update-task"}]},{"group":"Queue APIs","icon":"list","pages":[{"title":"Fetch Queue Jobs","openapi":"api-reference/openapi-generated.json GET /v1/queue/jobs","href":"/api-reference/queues/fetch-queue-jobs"},{"title":"Get Broadcast Status","openapi":"api-reference/openapi-generated.json GET /v1/queue/broadcast","href":"/api-reference/queues/get-broadcast-status"},{"title":"Get Queue Status","openapi":"api-reference/openapi-generated.json GET /v1/queue","href":"/api-reference/queues/get-queue-status"},{"title":"Purge Queue","openapi":"api-reference/openapi-generated.json DELETE /v1/queue/purge","href":"/api-reference/queues/purge-queue"}]},{"group":"Phone APIs","icon":"phone","pages":[{"title":"Get phone","openapi":"api-reference/openapi-generated.json GET /v1/phones","href":"/api-reference/phones/get-phone"},{"title":"Get All Phones","openapi":"api-reference/openapi-generated.json GET /v1/phones/all","href":"/api-reference/phones/get-all-phones"},{"title":"Get QR","openapi":"api-reference/openapi-generated.json GET /v1/phones/qr","href":"/api-reference/phones/get-qr"},{"title":"Reset Phone","openapi":"api-reference/openapi-generated.json POST /v1/phones/reset","href":"/api-reference/phones/reset-phone"},{"title":"Restart Phone","openapi":"api-reference/openapi-generated.json POST /v1/phones/restart","href":"/api-reference/phones/restart-phone"},{"title":"Resync Phone","openapi":"api-reference/openapi-generated.json POST /v1/phones/resync","href":"/api-reference/phones/resync-phone"},{"title":"Update phone","openapi":"api-reference/openapi-generated.json PATCH /v1/phones/update","href":"/api-reference/phones/update-phone"},{"title":"Create Phone","openapi":"api-reference/openapi-generated.json POST /v1/phones/create","href":"/api-reference/phones/create-phone"},{"title":"Delete Phone","openapi":"api-reference/openapi-generated.json DELETE /v1/phones/delete","href":"/api-reference/phones/delete-phone"}]},{"group":"Notes APIs","icon":"comment","pages":[{"title":"Send Private Notes","openapi":"api-reference/openapi-generated.json POST /v1/notes/create","href":"/api-reference/notes/create-private-notes"},{"title":"Get Private Note","openapi":"api-reference/openapi-generated.json GET /v1/notes/{note_id}","href":"/api-reference/notes/get-private-note"},{"title":"List All Private Notes","openapi":"api-reference/openapi-generated.json GET /v1/notes","href":"/api-reference/notes/list-all-private-notes"}]},{"group":"Reaction APIs","icon":"comment","pages":[{"title":"Get Reactions","openapi":"api-reference/openapi-generated.json GET /v1/reactions","href":"/api-reference/reactions/get-reactions"}]},{"group":"Knowledge Base APIs","icon":"brain","pages":[{"title":"Get All Knowledge Base Items","openapi":"api-reference/openapi-generated.json GET /v1/knowledge-base","href":"/api-reference/knowledge-base/get-all-knowledge-base"},{"title":"Get FAQ by ID","openapi":"api-reference/openapi-generated.json GET /v1/knowledge-base/faq/{context_id}","href":"/api-reference/knowledge-base/get-faq-by-id"},{"title":"Create FAQ","openapi":"api-reference/openapi-generated.json POST /v1/knowledge-base/faq/create","href":"/api-reference/knowledge-base/create-faq"},{"title":"Update FAQ","openapi":"api-reference/openapi-generated.json PATCH /v1/knowledge-base/faq/{context_id}","href":"/api-reference/knowledge-base/update-faq"},{"title":"Delete FAQ","openapi":"api-reference/openapi-generated.json DELETE /v1/knowledge-base/faq/{context_id}","href":"/api-reference/knowledge-base/delete-faq"},{"title":"Get Document by ID","openapi":"api-reference/openapi-generated.json GET /v1/knowledge-base/document/{document_id}","href":"/api-reference/knowledge-base/get-document-by-id"},{"title":"Create Document","openapi":"api-reference/openapi-generated.json POST /v1/knowledge-base/document/create","href":"/api-reference/knowledge-base/create-document"},{"title":"Delete Document","openapi":"api-reference/openapi-generated.json DELETE /v1/knowledge-base/document/{document_id}","href":"/api-reference/knowledge-base/delete-document"}]},{"group":"Member APIs","icon":"user-group","pages":[{"title":"Invite Members","openapi":"api-reference/openapi-generated.json POST /v1/members/invite","href":"/api-reference/members/invite-members"},{"title":"Update Member Access","openapi":"api-reference/openapi-generated.json PATCH /v1/members/access","href":"/api-reference/members/update-member-access"},{"title":"Delete Member","openapi":"api-reference/openapi-generated.json DELETE /v1/members/{email_id}","href":"/api-reference/members/delete-member"}]},{"group":"AI APIs","icon":"robot","pages":[{"title":"Trigger AI Reply","openapi":"api-reference/openapi-generated.json POST /v1/ai/reply","href":"/api-reference/ai/trigger-ai-reply"}]},{"group":"Webhook APIs","icon":"webhook","pages":[{"title":"List Webhooks","openapi":"api-reference/openapi-generated.json GET /v1/webhooks","href":"/api-reference/webhooks/list-webhooks"},{"title":"Create Webhook","openapi":"api-reference/openapi-generated.json POST /v1/webhooks","href":"/api-reference/webhooks/create-webhook"},{"title":"Get Webhook by ID","openapi":"api-reference/openapi-generated.json GET /v1/webhooks/{id}","href":"/api-reference/webhooks/get-webhook-by-id"},{"title":"Update Webhook","openapi":"api-reference/openapi-generated.json PATCH /v1/webhooks/{id}","href":"/api-reference/webhooks/update-webhook"},{"title":"Delete Webhook","openapi":"api-reference/openapi-generated.json DELETE /v1/webhooks/{id}","description":"Permanently deletes a webhook subscription row by id. Its sibling rows (same create call) are marked unsubscribed β to pause without deleting, use PATCH with isSubscribed: false.","href":"/api-reference/webhooks/delete-webhook"}]},{"group":"Webhooks","pages":[{"title":"Introduction","href":"/api-reference/webhooks/introduction"},{"title":"chat.created","description":"The `chat.created` webhook is triggered when a new group or individual chat is created on whatsapp.","icon":"comments","href":"/api-reference/webhooks/chat.created"},{"title":"chat.notification.created","icon":"comments","href":"/api-reference/webhooks/chat.notification.created"},{"title":"chat.custom-properties.updated","icon":"comments","href":"/api-reference/webhooks/chat.custom-properties.updated"},{"title":"message.created","icon":"comment","href":"/api-reference/webhooks/message.created"},{"title":"message.updated","icon":"comment","href":"/api-reference/webhooks/message.updated"},{"title":"message.deleted","icon":"comment","href":"/api-reference/webhooks/message.deleted"},{"title":"message.ack.updated","icon":"comment","href":"/api-reference/webhooks/message.ack.updated"},{"title":"message.ticket.attached","icon":"comment","href":"/api-reference/webhooks/message.ticket.attached"},{"title":"message.flagged","icon":"comment","href":"/api-reference/webhooks/message.flagged"},{"title":"message.unflagged","icon":"comment","href":"/api-reference/webhooks/message.unflagged"},{"title":"note.created","icon":"comment","href":"/api-reference/webhooks/note.created"},{"title":"reaction.created","icon":"face-smile","href":"/api-reference/webhooks/reaction.created"},{"title":"reaction.updated","icon":"face-smile","href":"/api-reference/webhooks/reaction.updated"},{"title":"ticket.created","icon":"tag","href":"/api-reference/webhooks/ticket.created"},{"title":"ticket.updated","icon":"tag","href":"/api-reference/webhooks/ticket.updated"},{"title":"ticket.deleted","icon":"tag","href":"/api-reference/webhooks/ticket.deleted"},{"title":"org.phone.updated","icon":"phone","href":"/api-reference/webhooks/org.phone.updated"},{"title":"org.phone.connected","icon":"phone","href":"/api-reference/webhooks/org.phone.connected"},{"title":"org.phone.disconnected","icon":"phone","href":"/api-reference/webhooks/org.phone.disconnected"},{"title":"org.phone.qr","icon":"phone","href":"/api-reference/webhooks/org.phone.qr"}]}]},{"anchor":"Free Tools","icon":"toolbox","href":"https://tools.periskope.app"}]},"title":"Introduction - Periskope Docs","buildId":"dpl_CUnGQP1HgFUzoxatVC37y4zP83Vx","deploymentId":"dpl_CUnGQP1HgFUzoxatVC37y4zP83Vx","dynamics":["07c022d89b","a74be98ba7"],"chunks":["Frame-BCFzRGe_.js","DynamicMarkdown-BUuAYxJE.js","zoom-image-lightbox-DQ5W4Q2v.js","PlusIcon-jZ8vgk6R.js","lightbox-handle-r17bVUz3.js"]}