Rocket.chat: Livechat

Created on 26 Feb 2019  路  12Comments  路  Source: RocketChat/Rocket.Chat

Hi,
Livechat Rest APi does not have the option to send images, files and audios, there is some possibildiade, today I use the command below but only sends a message
curl -X POST -H "Content-type: application / json" http: // localhost: 3000 / api / v1 / livechat / message -d "{\" token \ ": \" $ token\ ", \" rid \ ": \" $ roomid \ ", \" msg \ ": \" $ msg \ "}"

livechat

Most helpful comment

Enviar Arquivo pelo Livechat resolvido segue os passos abaixo para quem precisar:
general -> Rest api -> ativar CORS
rid=RGaWhZ47PYb7dBNjS
curl -X POST http://localhost:3000/api/v1/livechat/upload/RGaWhZ47PYb7dBNjS -H 'x-visitor-token: xqAsBbsNJ5ft' -F 'file=@/usr/src/rocketchat-realtime/whatsapp/imagem.jpeg'

All 12 comments

Every feature does not work.

Will it be deployed soon? Directing to a department is also not available in the api

hey @josep112 actually we send files over rest api

please look here:
https://github.com/RocketChat/Rocket.Chat.js.SDK/blob/multiple-clients/src/lib/api/Livechat.ts#L53

and here is a place that I know we are using that method:
https://github.com/RocketChat/Rocket.Chat.Livechat/blob/45b025726052084eed77a9a9fb4dfb7be28cc382/src/routes/Chat/container.js#L133

the javascript way to do that:

    const headers = {
      'x-visitor-token': this.credentials.token
    }
    const formData = new FormData()
    formData.append('file', params.file)
    return this.post(`livechat/upload/${params.rid}`, formData, false, undefined, { customHeaders: headers })

Will it be deployed soon? Directing to a department is also not available in the api

@josep112

I didnt get this one, the user cant change the department over restapi or the agent?

Will it be deployed soon? Directing to a department is also not available in the api

@josep112

You don't send messages to departments, you send messages to rooms that may be assigned to a department(or not).

You can achieve it easily by using our Livechat REST API endpoints:

1 - Registering Livechat Visitors(When you pass the department field)
https://rocket.chat/docs/developer-guides/rest-api/livechat/visitor/#register-a-new-livechat-visitor
2 - Get a new Livechat Room
https://rocket.chat/docs/developer-guides/rest-api/livechat/room/#query-parameters
3 - Send Livechat Messages
https://rocket.chat/docs/developer-guides/rest-api/livechat/message/#payload

Guilherme, obrigado pela resposta!
Seria poss铆vel usar via curl tentei algo do tipo abaixo mas sem sucesso
curl -X POST -H "Content-type: application/json" http://localhost: 3000/api/v1/livechat/upload -d '{"rid": "$roomid", "file": "imagen.jpg"}'

Will it be deployed soon? Directing to a department is also not available in the api

@josep112

You don't send messages to departments, you send messages to rooms that may be assigned to a department(or not).

You can achieve it easily by using our Livechat REST API endpoints:

1 - Registering Livechat Visitors(When you pass the department field)
https://rocket.chat/docs/developer-guides/rest-api/livechat/visitor/#register-a-new-livechat-visitor
2 - Get a new Livechat Room
https://rocket.chat/docs/developer-guides/rest-api/livechat/room/#query-parameters
3 - Send Livechat Messages
https://rocket.chat/docs/developer-guides/rest-api/livechat/message/#payload

Renato, j谩 fa莽o dessa forma!
No Livechat eu adiciona Departamentos e neles os agentes, Por exemplo tenho um departamento Suporte com o agente Jose e um Departamento Atendimento com o agente Joao, gostaria de direcionar o atendimento para o departamento e n茫o para a sala onde os 2 agentes nesse caso podem atender a mesma chamada

It is possible! (脡 poss铆vel)

// Send to Department A
curl -X POST \
-H "Content-type:application/json" \
http://localhost:3000/api/v1/livechat/room.transfer \
-d '{"rid": "n5MvWu8BLxbuPAQdJ", "token": "CjKEmxqAsBbsNJ5ft", "department": "yB8MwM7oZ2FsKyHzM"}'

//send to Department B
curl -X POST \
-H "Content-type:application/json" \
http://localhost:4000/api/v1/livechat/room.transfer \
-d '{"rid": "n5MvWu8BLxbuPAQdJ", "token": "CjKEmxqAsBbsNJ5ft", "department": "cohN55MkQE24wH8K3"}'

Enviar Arquivo pelo Livechat resolvido segue os passos abaixo para quem precisar:
general -> Rest api -> ativar CORS
rid=RGaWhZ47PYb7dBNjS
curl -X POST http://localhost:3000/api/v1/livechat/upload/RGaWhZ47PYb7dBNjS -H 'x-visitor-token: xqAsBbsNJ5ft' -F 'file=@/usr/src/rocketchat-realtime/whatsapp/imagem.jpeg'

It is possible! (脡 poss铆vel)

// Send to Department A
curl -X POST
-H "Content-type:application/json"
http://localhost:3000/api/v1/livechat/room.transfer
-d '{"rid": "n5MvWu8BLxbuPAQdJ", "token": "CjKEmxqAsBbsNJ5ft", "department": "yB8MwM7oZ2FsKyHzM"}'

//send to Department B
curl -X POST
-H "Content-type:application/json"
http://localhost:4000/api/v1/livechat/room.transfer
-d '{"rid": "n5MvWu8BLxbuPAQdJ", "token": "CjKEmxqAsBbsNJ5ft", "department": "cohN55MkQE24wH8K3"}'

Juliomac vou testar, obrigado

@josep112, is your case resolved?
If so, please close this issue, thanks.

Yes, in parts, now I have the problem of when I send the pdf it adds pdf.ini, but on what we say acim already I will close

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dennis-f picture dennis-f  路  62Comments

mitar picture mitar  路  68Comments

HammyHavoc picture HammyHavoc  路  52Comments

oliver-bowman picture oliver-bowman  路  55Comments

AmShaegar13 picture AmShaegar13  路  74Comments