# Zipwhip Zipwhip's API relies on a sessionKey to perform all actions. This is a GUID representation of an authenticated user. >Tip: SessionKeys do not expire, they can be obtained once and then used for all future actions. A sessionKey is obtained from perfomring a `user/login` webcall for the account. ### It all begins with user/login ``` Sh $ curl -i https://api.zipwhip.com/user/login \ -d username=[phone number] \ -d password=[account password] ``` ```json { "success":true, "response":"3d0f1dde-aaff-4ce8-b61a-af212a860abc:123456789" } ``` **I think we will have a couple issues related to autoscaling. Eache instance will make request for getting session key, but I am not sure that previous key won't be canceled. To be sure we need to get credentials for having posibility two test webhooks** >In this case the `response` is the sessionKey for the account. Next you'll want to send a message. To do so, we will use the the sessionKey retrieved from `user/login`. ```sh $ curl -i https://api.zipwhip.com/message/send \ -d session=3d0f1dde-aaff-4ce8-b61a-af212a860abc:123456789 -d --data-rulencode contacts='+18559479447' -d --data-urlencode body='Hello World, from Zipwhip!' ``` ```json { "response": { "fingerprint": "4236521183", "root": "327559093363723008", "tokens": [ { "contact": 1989548603, "device": 309626613, "fingerprint": "42336654183", "message": "327545678963723008" } ] }, "success": true } ``` >`message` is the ID of the unique this can be used in `message/get`, `message/read`, `message/delete` ## Adding Web Hooks Install a Web Hook onto the text-enabled phone number. When an event occurs the details of the message will be delivered to the URL specified. ### Parameters |Parameter|Required|Description |:---------|:--------|:---------- |session|True|Session is the response of user/login. |type|True|For now, the available options is 'message' |event|True|Events listed above. i.e. send, receive, etc. |url|True|The destination when the event fires. |method|False|HTTP Method used for Web Hook. i.e. POST, PUT, GET ### Example Request ```sh $ curl -X POST https://api.zipwhip.com/webhook/add \ -d session=[sessionKey] \ -d type=message \ -d event=receive \ -d url=https://test.zipwhip.com/message/receive \ -d method=POST ``` ### Example Response ```JSON { "success": true, "response": [ { "webhookId": 687557714, "type": "message", "event": "receive", "url": "https://test.zipwhip.com/message/receive", "method": "POST" } ] } ``` # Zipwhip CODE PART ### record in a platform collection ``` { "name" : "Zipwhip", "platformId" : 9, "reportColor" : "#ffffff", ??? "systemName" : "zipWhip", "endSessionMessage" : "Your session with {{agentName}} has ended.", "userApp" : { "name" : "Zipwhip" } } ``` ### zipWhip_configurations ``` { "zipWhipConfigurationId": Number, "name": String, "phoneNumber": String "password": String } ``` **We use phoneNumber + password for getting sessionKey which we use in all our queries** ### zipWhip_Bots ``` { "zipWhipBotId": Number, "botId": Number, "name": "String", "zipWhipConfigurationId": Number "name": String } ```