ዌብሁክዎች
የZealy አቅሞችን በዌብሁክ ግንኙነቶች ያሳድጉ።
በ louis, Fredrika, benjamin

በዚህ ገጽ ላይ
የZealy ዌብሁክ ከዘጠኙ የማህበረሰብ ክስተቶች አንዱ ሲከሰት ወደ መረጡት URL የHTTP POST ይልካል፤ ከእነዚህም መካከል አባል መቀላቀል፣ የተግባር ጥያቄ መሳካት ወይም አለመሳካት፣ ስፕሪንት መጀመር እና ተጠቃሚ መታገድ ይገኙበታል። እያንዳንዱ ጭነት የክስተት መለያ፣ አይነት፣ ውሂብ፣ በሚሊሰከንድ የተገለጸ የጊዜ ማህተም እና ጥያቄው እውነተኛ መሆኑን የሚያረጋግጥ ምስጢር ይይዛል።
መሰረታዊ ነገሮች
Zealy ያቀርባል ዌብሁክዎች ይህም ውሂብ በሚፈጠር ወይም በሚዘመን ቁጥር የHTTP ግፋ ማሳወቂያዎችን እንዲቀበሉ ያስችልዎታል። ይህ በZealy ላይ ውህደቶችን እንዲገነቡ ያስችልዎታል። የCI ግንባታዎችን ማስነሳት፣ በተግባር ውሂብ ላይ ስሌቶችን ማከናወን ወይም በተወሰኑ ሁኔታዎች መልዕክቶችን መላክ ይችላሉ – ሌላው በእርስዎ ላይ ነው።
እባክዎ ዌብሁክዎችዎን ለማዘጋጀት Settings > Integrations > Zapier & Webhooks ይጎብኙ።
Webhook እንዴት ይሠራል?
የWebhook ግፊት በቀላሉ HTTP POST የሚል ጥያቄ ነው፣ ወደሚመርጡት URL ይላካል። ግፊቱ መረጃ ሲዘመን በLinear በራስ-ሰር ይቀሰቀሳል። የመልእክቱ ይዘት ምሳሌ ለማየት ይመልከቱ የWebhook መልእክት ይዘት.
የእርስዎ webhook ተቀባይ ቀላል የHTTP መጨረሻ ነጥብ ነው። የሚከተሉትን ሁኔታዎች ማሟላት አለበት፦
- በይፋ ተደራሽ በሆነ HTTPS፣ localhost ያልሆነ URL ውስጥ ይገኛል
- ለZealy Webhook ግፊት (HTTP POST ጥያቄ) በ
HTTP 200("OK") ምላሽ ይመልሳል
የማድረስ ሙከራ ካልተሳካ (ለምሳሌ ሰርቨሩ የማይገኝ ከሆነ፣ ምላሹ ከ5 ሰከንድ በላይ ከፈጀ፣ የምላሹ አካል ከ5000 ባይት በላይ ከሆነ ወይም ከ200 ያልሆነ የHTTP ሁኔታ ኮድ ከመለሰ)፣ ግፋው 15 ጊዜ እንደገና ይሞከራል። እዚህ ጊዜው እየጨመረ የሚሄድ የመጠባበቂያ ጊዜ ጥቅም ላይ ይውላል፦ ሙከራው ከ10 ደቂቃ ገደማ በኋላ፣ ከዚያም ከ30 ደቂቃ በኋላ፣ እና በዚሁ መልኩ እንደገና ይሞከራል። የዌብሁክ አድራሻው ምላሽ አለመስጠቱ ከቀጠለ ዌብሁኩ በZealy ሊሰናከል ይችላል፣ እንደገናም በእጅ ማንቃት ይኖርብዎታል።
ዌብሁክ POST በእውነት በZealy መፈጠሩን ለማረጋገጥ፣ በጥያቄው አካል ላይ የሚያያዝ የዘፈቀደ ምስጢር እናመንጭበታለን፣ በ secret መስክ።
ስለ ዌብሁኮች ተጨማሪ መረጃ ለማግኘት፣ ጥሩ ምንጮች በርካታ ናቸው፦
- RequestBin፦ ዌብሁኮች – የመጨረሻው መመሪያ
- requestbin.com ዌብሁኮችን ለመፈተሽ ጥሩ መሣሪያ ነው
- የGitHub ገንቢ መመሪያ፦ ዌብሁኮች
ለምን ልጠቀምበት እችላለሁ?
- ከZapier ጋር ያገናኙ
- ብጁ ሽልማቶችን በራስ-ሰር ያስተዳድሩ
- በTelegram ላይ ግምገማ የሚጠብቁ ተግባራትን ያሳውቁ
እና ሌሎችም ብዙ!
በZealy ዌብሁኮች መጀመር
- ለመከታተል የሚፈልጓቸውን ክስተቶች ይለዩ።
- የክስተት ውሂብ POST ጥያቄዎችን ለመቀበል የዌብሁክ ኤንድፖይንት ተግባር ይገንቡ።
- ኤንድፖይንትዎን በZealy ውስጥ በSettings > Integrations > Zapier & Webhooks ውስጥ ያለውን የWebhooks ዳሽቦርድ በመጠቀም ይመዝግቡ።
- የዌብሁክ ኤንድፖይንትዎን ደህንነቱ የተጠበቀ ያድርጉ።
ቀላል የዌብሁክ ተጠቃሚ መፍጠር
ቀላል HTTP(S) ኤንድፖይንቶችን ለማሰማራት ቀጥተኛ መንገድ የሚሰጥ Netlify Functions የመሰለ ነገር ለመጠቀም ሊያስቡ ይችላሉ፦ https://www.netlify.com/blog/2018/09/13/how-to-run-express.js-apps-with-netlify-functions/.
// server.js
//
// Use this sample code to handle webhook events in your integration.
//
// 1) Paste this code into a new file (server.js)
//
// 2) Install dependencies
// npm install express
//
// 3) Run the server on http://localhost:4242
// node server.js
// The library needs to be configured with your account's secret key.
// Ensure the key is kept out of any version control system you might be using.
const express = require('express');
const app = express();
// This is your Zealy webhook secret for testing your endpoint locally.
const endpointSecret = '5888a6800dbac634e52d8504f097e064';
app.post('/webhook', express.raw({ type: 'application/json' }), (request, response) => {
const payload = req.body;
// Does createdAt make more sense than time?
const { id, type, data, time, secret } = payload;
if (secret === endpointSecret) {
// Do something neat with the data received!
}
// Return a 200 response to acknowledge receipt of the event
response.send();
});
app.listen(4242, () => console.log('Running on port 4242'));በቅንብሮች ውስጥ ማዋቀር
ዌብሁክን እና ሊከታተላቸው የሚገቡትን ክስተቶች በSettings > Integrations > Webhooks ውስጥ ያዘጋጁ።
የዌብሁክ ጭነት
የዌብሁክ HTTP ጭነት መረጃውን በHTTP ራስጌዎቹም ሆነ በጥያቄ አካሉ ውስጥ ያካትታል።
ጭነቱ በሚከተሉት HTTP ራስጌዎች ይላካል፦
User-Agent: Zealy-Webhook
Content-Type: application/json; charset=utf-8
{
id: string // unique ID for this event (UUID v4)
type: "JOINED_COMMUNITY" | "LEFT_COMMUNITY" | "QUEST_SUCCEEDED" | "QUEST_CLAIMED" | "QUEST_FAILED" | "QUEST_CLAIM_STATUS_UPDATED" | "SPRINT_STARTED" | "SPRINT_ENDED" | "USER_BANNED", // event type
data: EventData, // event data, see below
time: number, // timestamp, in milliseconds
secret: string, // secret generated when you created your webhook, used for checking origin
}የEventData መስክ ለእያንዳንዱ ክስተት፦
// JOINED_COMMUNITY
type JoinedCommunityEventData = {
community: WebhookCommunityPayload;
user: WebhookUserPayload;
};
// LEFT_COMMUNITY
type LeftCommunityEventData = {
community: WebhookCommunityPayload;
user: WebhookUserPayload;
};
// QUEST_SUCCEEDED
type QuestSucceededEventData = {
community: WebhookCommunityPayload;
user: WebhookUserPayload;
quest: WebhookQuestPayload;
taskInputs?: Array<{
taskId: string, // task ID (uuid v4)
taskType: 'number' | 'date' | 'api' | 'text' | 'discord' | 'url' | 'telegram' | 'quiz' | 'invites' | 'visitLink' | 'file' | 'poll' | 'opinion' | 'twitterFollow' | 'twitterSpace' | 'tweetReact' | 'tweet',
input: WebhookQuestTaskInputPayload,
}>;
status: 'success';
};
// QUEST_CLAIMED
type QuestClaimedEventData = {
community: WebhookCommunityPayload;
user: WebhookUserPayload;
quest: WebhookQuestPayload;
taskInputs?: Array<{
taskId: string, // task ID (uuid v4)
taskType: 'number' | 'date' | 'api' | 'text' | 'discord' | 'url' | 'telegram' | 'quiz' | 'invites' | 'visitLink' | 'file' | 'poll' | 'opinion' | 'twitterFollow' | 'twitterSpace' | 'tweetReact' | 'tweet',
input: WebhookQuestTaskInputPayload,
}>;
};
// QUEST_FAILED
type QuestFailedEventData = {
community: WebhookCommunityPayload;
user: WebhookUserPayload;
quest: WebhookQuestPayload;
taskInputs?: Array<{
taskId: string, // task ID (uuid v4)
taskType: 'number' | 'date' | 'api' | 'text' | 'discord' | 'url' | 'telegram' | 'quiz' | 'invites' | 'visitLink' | 'file' | 'poll' | 'opinion' | 'twitterFollow' | 'twitterSpace' | 'tweetReact' | 'tweet',
input: WebhookQuestTaskInputPayload,
}>;
};
// QUEST_CLAIM_STATUS_UPDATED
type QuestClaimStatusUpdatedEventData = {
community: WebhookCommunityPayload;
user: WebhookUserPayload;
quest: WebhookQuestPayload;
taskInputs?: Array<{
taskId: string, // task ID (uuid v4)
taskType: 'number' | 'date' | 'api' | 'text' | 'discord' | 'url' | 'telegram' | 'quiz' | 'invites' | 'visitLink' | 'file' | 'poll' | 'opinion' | 'twitterFollow' | 'twitterSpace' | 'tweetReact' | 'tweet',
input: WebhookQuestTaskInputPayload,
}>;
status: 'success' | 'pending' | 'failed';
};
// SPRINT_STARTED
type SprintStartedEventData = {
community: WebhookCommunityPayload;
sprint: WebhookSprintPayload;
};
// SPRINT_ENDED
type SprintEndedEventData = {
community: WebhookCommunityPayload;
sprint: WebhookSprintPayload;
};
// USER_BANNED
type UserBannedEventData = {
community: WebhookCommunityPayload;
user: WebhookUserPayload;
};የተለመዱ አካላት፦
type WebhookCommunityPayload = {
id: string; // community ID (uuid V4)
name: string; // community name
subdomain: string; // community subdomain
blockchain: string;
discord: string | null; // discord URI of the community, e.g., https://discord.gg/zealy
twitter: string | null; // twitter handle of the community, e.g., zealy_io
website: string | null; // website URI of the community
};type WebhookUserPayload = {
id: string; // user ID (uuid V4)
name: string | null; // user display name
twitter: {
id: string; // user twitter ID
username: string | null; // user twitter handle
} | null;
discord: {
id: string; // user discord ID
handle: string | null; // user discord handle
} | null;
email: string | null; // user email
addresses: Dict<string>; // key/value dictionary for wallets
verifiedAddresses: Dict<string>; // key/value dictionary for all users verified wallets
};type WebhookQuestPayload = {
id: string; // quest ID (uuid V4)
name: string; // quest display name
categoryId: string; // category ID (uuid V4)
categoryName: string | null; // category display name
xp: number | null; // XP reward
published: boolean | null; // true if quest is published, false otherwise
autoValidate: boolean | null;
tasks: TaskPayload[];
lastReviewerId: string; // user ID (uuid V4)
};type WebhookQuestTaskInputPayload =
| { } // for task type 'visitLink', 'invites', 'discord', 'telegram', 'twitterFollow', 'twitterSpace'
| { value: string } // for task type 'text', 'date', 'url', 'opinion'
| { value: number } // for task type 'number'
| { values: string[] } // for task type 'poll', 'quiz'
| { fileUrls: string[] } // for task type 'fileUrls'
| { tweetId?: string } // for task type 'tweetReact', 'tweet'
| { requestId: string, statusCode: number } // for task type 'api'type WebhookSprintPayload = {
id: string; // sprint ID (uuid V4)
startingAt: ISOString; // sprint starting date - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString
endingAt: ISOString; // sprint ending date
};ዌብሁኮችን ደህንነታቸውን ማረጋገጥ
ዌብሁክ መፍጠር ጥያቄው ከZealy ዌብሁኮች መምጣቱን ለማረጋገጥ የሚጠቀሙበት የዘፈቀደ ምስጢር ይፈጥራል። ምስጢሩን በዌብሁክ መመርመሪያ ፓነል የላይኛው ቀኝ ጥግ ላይ ይቅዱ እና በPOST ጥያቄው አካል ውስጥ የተቀመጠው ምስጢር ተመሳሳይ መሆኑን ያረጋግጡ።
ምስጢሩ ከተጋለጠ ከዚያው ገጽ እንደገና ማመንጨት ይችላሉ።

ዌብሁኮችን መሞከር
ከዌብሁክ መመርመሪያ ፓነል የሙከራ ክስተትን በእጅ ማስነሳት ይችላሉ። በላይኛው ቀኝ ያለውን አዝራር ጠቅ ያድርጉ እና ‘Send test event’ ይምረጡ። ከሚከታተሉት የክስተት ዓይነቶች መካከል የክስተት ዓይነት መምረጥ ይችላሉ። ክስተት በማስመሰያ ውሂብ ይነሳል እና ሁኔታው ይታያል።
ማረም
በWebhooks ገጽ ላይ ዌብሁኩን ጠቅ ካደረጉ በዌብሁክ የተነሱ ያለፉ ክስተቶችን ሁሉ መዝገቦች ማየት ይችላሉ። በሁኔታ በማጣራት የተሳሳተ ነገር ካለ ለማረም መዝገቦቹን መጠቀም ይችላሉ። ለእያንዳንዱ ክስተት የተቀበሉትን የስህተት መልእክት እና የተላከውን ጥያቄ ማየት ይችላሉ።
ከዚህ ገጽ ማንኛውንም ክስተት እንደገና መሞከርም ይችላሉ።
