Client | line-bot | line bot sdk nodejs
![Client | line-bot](https://i.imgur.com/axBPWDg.jpg)
Clientistosendmessages,getuserorcontentinformation,orleavechats.AclientinstanceprovidesfunctionsformessagingAPIs(opensnewwindow)[1],sothatyoudonotneedtoworryaboutHTTPrequestsandcanfocusondata.Fortypesignaturesofthemethods,pleaserefertoitsAPIreference[2].CreateaclientTheClientclassisprovidedbythemainmodule.Tocreateaclientinstance:Andnowyoucancallclientfunctionsasusual:RetrievingparametersfromwebhookManyofdatausedintheclientfunctions,suchasuserIDsorreplytokens,canbeobtainedfromnowherebutwebhoo...
![Client | line-bot](https://i.imgur.com/H8YKUrg.jpg)
Client is to send messages, get user or content information, or leave chats. A client instance provides functions for messaging APIs(opens new window)[1], so that you do not need to worry about HTTP requests and can focus on data. For type signatures of the methods, please refer to its API reference[2].
Create a clientThe Client class is provided by the main module.
To create a client instance:
And now you can call client functions as usual:
Retrieving parameters from webhookMany of data used in the client functions, such as user IDs or reply tokens, can be obtained from nowhere but webhook.
Webhook event objects are just plain JSON objects, sent as request body, so you can easily access and use it.
For more detail of building webhook and retrieve event objects, please refer to its guide[3].
Error handlingThere are 4 types of errors caused by client usage.
RequestError: A request fails by, for example, wrong domain or serve...