[{"data":1,"prerenderedAt":720},["ShallowReactive",2],{"navigation":3,"\u002Fwebhooks":43,"\u002Fwebhooks-surround":716},[4,8,13,18,23,28,33,38],{"title":5,"path":6,"stem":7},"Getting started","\u002F","index",{"title":9,"path":10,"stem":11,"order":12},"Numbers","\u002Fnumbers","numbers",1,{"title":14,"path":15,"stem":16,"order":17},"Rent","\u002Frent","rent",2,{"title":19,"path":20,"stem":21,"order":22},"User","\u002Fuser","user",3,{"title":24,"path":25,"stem":26,"order":27},"Free numbers","\u002Ffree","free",4,{"title":29,"path":30,"stem":31,"order":32},"Webhooks","\u002Fwebhooks","webhooks",5,{"title":34,"path":35,"stem":36,"order":37},"Testing","\u002Ftesting","testing",6,{"title":39,"path":40,"stem":41,"order":42},"Changelog","\u002Fchangelog","changelog",7,{"id":44,"title":29,"body":45,"description":710,"extension":711,"meta":712,"navigation":713,"path":30,"seo":714,"stem":31,"__hash__":715},"docs\u002Fwebhooks.md",{"type":46,"value":47,"toc":706},"minimark",[48,80,85,88,119,130,449,453,702],[49,50,51,52,60,61,64,65,68,69,72,73,79],"p",{},"Set a URL with ",[53,54,56],"a",{"href":55},"\u002Fuser#setwebhookurl",[57,58,59],"code",{},"client.user.setWebhookUrl",". For each SMS the server POSTs a JSON body to it: ",[57,62,63],{},"webhook_type"," ",[57,66,67],{},"receiving_sms"," for numbers, ",[57,70,71],{},"rent_sms"," for rents. Delivery attempts are listed by ",[53,74,76],{"href":75},"\u002Fuser#webhooklogs",[57,77,78],{},"client.user.webhookLogs",".",[81,82,84],"h2",{"id":83},"parsewebhook","parseWebhook",[49,86,87],{},"Parse an inbound webhook body from a JSON string or an already decoded map.",[89,90,95],"pre",{"className":91,"code":92,"language":93,"meta":94,"style":94},"language-dart shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","WebhookPayload parseWebhook(Object payload)\n","dart","",[57,96,97],{"__ignoreMap":94},[98,99,101,105,109,113,116],"span",{"class":100,"line":12},"line",[98,102,104],{"class":103},"sBMFI","WebhookPayload",[98,106,108],{"class":107},"s2Zo4"," parseWebhook",[98,110,112],{"class":111},"sTEyZ","(",[98,114,115],{"class":103},"Object",[98,117,118],{"class":111}," payload)\n",[49,120,121,122,125,126,129],{},"Lenient: numeric fields may arrive as strings, missing or malformed fields become ",[57,123,124],{},"null",", unknown fields are dropped. It throws ",[57,127,128],{},"WebhookFormatException"," only when the input is not a JSON object.",[89,131,133],{"className":91,"code":132,"language":93,"meta":94,"style":94},"import 'dart:convert';\nimport 'dart:io';\n\nimport 'package:onlinesim\u002Fonlinesim.dart';\n\nFuture\u003Cvoid> main() async {\n  final server = await HttpServer.bind(InternetAddress.anyIPv4, 8080);\n  await for (final request in server) {\n    final hook = parseWebhook(await utf8.decoder.bind(request).join());\n    if (hook.webhookType == WebhookType.receivingSms) {\n      print('${hook.operationId} ${hook.code}');\n    }\n    request.response.write('ok');\n    await request.response.close();\n  }\n}\n",[57,134,135,149,158,164,173,177,205,248,272,315,340,383,389,414,437,443],{"__ignoreMap":94},[98,136,137,141,145],{"class":100,"line":12},[98,138,140],{"class":139},"sbssI","import",[98,142,144],{"class":143},"sfazB"," 'dart:convert'",[98,146,148],{"class":147},"sMK4o",";\n",[98,150,151,153,156],{"class":100,"line":17},[98,152,140],{"class":139},[98,154,155],{"class":143}," 'dart:io'",[98,157,148],{"class":147},[98,159,160],{"class":100,"line":22},[98,161,163],{"emptyLinePlaceholder":162},true,"\n",[98,165,166,168,171],{"class":100,"line":27},[98,167,140],{"class":139},[98,169,170],{"class":143}," 'package:onlinesim\u002Fonlinesim.dart'",[98,172,148],{"class":147},[98,174,175],{"class":100,"line":32},[98,176,163],{"emptyLinePlaceholder":162},[98,178,179,182,185,189,192,195,198,202],{"class":100,"line":37},[98,180,181],{"class":103},"Future",[98,183,184],{"class":111},"\u003C",[98,186,188],{"class":187},"spNyl","void",[98,190,191],{"class":111},"> ",[98,193,194],{"class":107},"main",[98,196,197],{"class":111},"() ",[98,199,201],{"class":200},"s7zQu","async",[98,203,204],{"class":111}," {\n",[98,206,207,210,213,216,219,222,224,227,229,232,234,237,240,243,246],{"class":100,"line":42},[98,208,209],{"class":187},"  final",[98,211,212],{"class":111}," server ",[98,214,215],{"class":147},"=",[98,217,218],{"class":200}," await",[98,220,221],{"class":103}," HttpServer",[98,223,79],{"class":147},[98,225,226],{"class":107},"bind",[98,228,112],{"class":111},[98,230,231],{"class":103},"InternetAddress",[98,233,79],{"class":147},[98,235,236],{"class":111},"anyIPv4",[98,238,239],{"class":147},",",[98,241,242],{"class":139}," 8080",[98,244,245],{"class":111},")",[98,247,148],{"class":147},[98,249,251,254,257,260,263,266,269],{"class":100,"line":250},8,[98,252,253],{"class":200},"  await",[98,255,256],{"class":200}," for",[98,258,259],{"class":111}," (",[98,261,262],{"class":187},"final",[98,264,265],{"class":111}," request ",[98,267,268],{"class":200},"in",[98,270,271],{"class":111}," server) {\n",[98,273,275,278,281,283,285,287,290,293,295,298,300,302,305,307,310,313],{"class":100,"line":274},9,[98,276,277],{"class":187},"    final",[98,279,280],{"class":111}," hook ",[98,282,215],{"class":147},[98,284,108],{"class":107},[98,286,112],{"class":111},[98,288,289],{"class":200},"await",[98,291,292],{"class":111}," utf8",[98,294,79],{"class":147},[98,296,297],{"class":111},"decoder",[98,299,79],{"class":147},[98,301,226],{"class":107},[98,303,304],{"class":111},"(request)",[98,306,79],{"class":147},[98,308,309],{"class":107},"join",[98,311,312],{"class":111},"())",[98,314,148],{"class":147},[98,316,318,321,324,326,329,332,335,337],{"class":100,"line":317},10,[98,319,320],{"class":200},"    if",[98,322,323],{"class":111}," (hook",[98,325,79],{"class":147},[98,327,328],{"class":111},"webhookType ",[98,330,331],{"class":147},"==",[98,333,334],{"class":103}," WebhookType",[98,336,79],{"class":147},[98,338,339],{"class":111},"receivingSms) {\n",[98,341,343,346,348,351,354,358,360,363,366,369,371,373,375,377,379,381],{"class":100,"line":342},11,[98,344,345],{"class":107},"      print",[98,347,112],{"class":111},[98,349,350],{"class":143},"'",[98,352,353],{"class":111},"${",[98,355,357],{"class":356},"sHdIc","hook",[98,359,79],{"class":111},[98,361,362],{"class":356},"operationId",[98,364,365],{"class":111},"}",[98,367,368],{"class":111}," ${",[98,370,357],{"class":356},[98,372,79],{"class":111},[98,374,57],{"class":356},[98,376,365],{"class":111},[98,378,350],{"class":143},[98,380,245],{"class":111},[98,382,148],{"class":147},[98,384,386],{"class":100,"line":385},12,[98,387,388],{"class":111},"    }\n",[98,390,392,395,397,400,402,405,407,410,412],{"class":100,"line":391},13,[98,393,394],{"class":111},"    request",[98,396,79],{"class":147},[98,398,399],{"class":111},"response",[98,401,79],{"class":147},[98,403,404],{"class":107},"write",[98,406,112],{"class":111},[98,408,409],{"class":143},"'ok'",[98,411,245],{"class":111},[98,413,148],{"class":147},[98,415,417,420,423,425,427,429,432,435],{"class":100,"line":416},14,[98,418,419],{"class":200},"    await",[98,421,422],{"class":111}," request",[98,424,79],{"class":147},[98,426,399],{"class":111},[98,428,79],{"class":147},[98,430,431],{"class":107},"close",[98,433,434],{"class":111},"()",[98,436,148],{"class":147},[98,438,440],{"class":100,"line":439},15,[98,441,442],{"class":111},"  }\n",[98,444,446],{"class":100,"line":445},16,[98,447,448],{"class":111},"}\n",[81,450,452],{"id":451},"payload-fields","Payload fields",[454,455,456,475],"table",{},[457,458,459],"thead",{},[460,461,462,466,469,472],"tr",{},[463,464,465],"th",{},"Field",[463,467,468],{},"Wire name",[463,470,471],{},"Type",[463,473,474],{},"Description",[476,477,478,504,526,545,564,601,622,640,661,683],"tbody",{},[460,479,480,486,490,495],{},[481,482,483],"td",{},[57,484,485],{},"webhookType",[481,487,488],{},[57,489,63],{},[481,491,492],{},[57,493,494],{},"WebhookType?",[481,496,497,500,501,79],{},[57,498,499],{},"receivingSms"," or ",[57,502,503],{},"rentSms",[460,505,506,510,515,520],{},[481,507,508],{},[57,509,362],{},[481,511,512],{},[57,513,514],{},"operation_id",[481,516,517],{},[57,518,519],{},"int?",[481,521,522,525],{},[57,523,524],{},"tzid"," of the operation or rent.",[460,527,528,533,538,542],{},[481,529,530],{},[57,531,532],{},"userId",[481,534,535],{},[57,536,537],{},"user_id",[481,539,540],{},[57,541,519],{},[481,543,544],{},"Account id.",[460,546,547,552,557,561],{},[481,548,549],{},[57,550,551],{},"countryCode",[481,553,554],{},[57,555,556],{},"country_code",[481,558,559],{},[57,560,519],{},[481,562,563],{},"Country code of the number.",[460,565,566,571,575,580],{},[481,567,568],{},[57,569,570],{},"number",[481,572,573],{},[57,574,570],{},[481,576,577],{},[57,578,579],{},"String?",[481,581,582,583,586,587,590,591,594,595,259,597,600],{},"Numbers: ",[57,584,585],{},"+"," and the full number (",[57,588,589],{},"+79001234567","), or ",[57,592,593],{},"hidden",". Rent: the full number in digits without ",[57,596,585],{},[57,598,599],{},"79001234567",").",[460,602,603,608,612,616],{},[481,604,605],{},[57,606,607],{},"sender",[481,609,610],{},[57,611,607],{},[481,613,614],{},[57,615,579],{},[481,617,618,619,79],{},"Sender of the SMS, e.g. ",[57,620,621],{},"VK",[460,623,624,629,633,637],{},[481,625,626],{},[57,627,628],{},"message",[481,630,631],{},[57,632,628],{},[481,634,635],{},[57,636,579],{},[481,638,639],{},"Full SMS text.",[460,641,642,646,650,654],{},[481,643,644],{},[57,645,57],{},[481,647,648],{},[57,649,57],{},[481,651,652],{},[57,653,579],{},[481,655,656,657,660],{},"Code extracted from the SMS; ",[57,658,659],{},"''"," when none was found.",[460,662,663,668,673,677],{},[481,664,665],{},[57,666,667],{},"timeStart",[481,669,670],{},[57,671,672],{},"time_start",[481,674,675],{},[57,676,579],{},[481,678,679,680,79],{},"Numbers: when the operation was ordered. Rent: when the SMS arrived. ",[57,681,682],{},"YYYY-MM-DD HH:MM:SS",[460,684,685,690,695,699],{},[481,686,687],{},[57,688,689],{},"timeLeft",[481,691,692],{},[57,693,694],{},"time_left",[481,696,697],{},[57,698,519],{},[481,700,701],{},"Time left: seconds for numbers, minutes for rent.",[703,704,705],"style",{},"html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}html pre.shiki code .sHdIc, html code.shiki .sHdIc{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic}",{"title":94,"searchDepth":17,"depth":17,"links":707},[708,709],{"id":83,"depth":17,"text":84},{"id":451,"depth":17,"text":452},"Receive SMS as HTTP callbacks and parse them with parseWebhook.","md",{},{"order":32},{"title":29,"description":710},"llo5Fp4eWIrQdWwTxviZXR7M1b6-w0mWzfprBe1vYpk",[717,719],{"title":19,"path":20,"stem":21,"description":718,"order":22},"Balance, profile, payments and the webhook URL — client.user.",null,1795164323296]