MadelineProto/old_docs/API_docs_v71/methods/bots_answerWebhookJSONQuery.md

79 lines
1.6 KiB
Markdown
Raw Normal View History

2017-10-14 11:50:46 +02:00
---
title: bots.answerWebhookJSONQuery
2018-03-23 16:23:49 +01:00
description: Send webhook request via bot API
2017-10-14 11:50:46 +02:00
---
## Method: bots.answerWebhookJSONQuery
[Back to methods index](index.md)
2018-03-23 16:23:49 +01:00
Send webhook request via bot API
2017-10-14 11:50:46 +02:00
### Parameters:
2018-03-23 16:23:49 +01:00
| Name | Type | Required | Description |
|----------|---------------|----------|-------------|
|query\_id|[CLICK ME long](../types/long.md) | Yes|The query ID|
|data|[CLICK ME DataJSON](../types/DataJSON.md) | Yes|The parameters|
2017-10-14 11:50:46 +02:00
### Return type: [Bool](../types/Bool.md)
### Can bots use this method: **YES**
2017-11-03 17:39:50 +01:00
### Errors this method can return:
| Error | Description |
|----------|---------------|
|QUERY_ID_INVALID|The query ID is invalid|
|USER_BOT_INVALID|This method can only be called by a bot|
2018-03-20 19:57:36 +01:00
### MadelineProto Example:
2017-10-14 11:50:46 +02:00
```
if (!file_exists('madeline.php')) {
copy('https://phar.madelineproto.xyz/madeline.php', 'madeline.php');
2017-10-14 11:50:46 +02:00
}
include 'madeline.php';
$MadelineProto = new \danog\MadelineProto\API('session.madeline');
$MadelineProto->start();
2017-10-14 11:50:46 +02:00
$Bool = $MadelineProto->bots->answerWebhookJSONQuery(['query_id' => long, 'data' => DataJSON, ]);
```
2018-03-20 19:57:36 +01:00
### [PWRTelegram HTTP API](https://pwrtelegram.xyz) example (NOT FOR MadelineProto):
2017-10-14 11:50:46 +02:00
### As a bot:
POST/GET to `https://api.pwrtelegram.xyz/botTOKEN/madeline`
Parameters:
* method - bots.answerWebhookJSONQuery
* params - `{"query_id": long, "data": DataJSON, }`
### As a user:
POST/GET to `https://api.pwrtelegram.xyz/userTOKEN/bots.answerWebhookJSONQuery`
Parameters:
query_id - Json encoded long
data - Json encoded DataJSON
Or, if you're into Lua:
```
Bool = bots.answerWebhookJSONQuery({query_id=long, data=DataJSON, })
```