API - SISTEMA | BAILEYS | OFIC...
Criar Agendamento
1min
PHP
1<?php
2
3$curl = curl_init();
4
5curl_setopt_array($curl, array(
6 CURLOPT_URL => 'https://{BACKEND_URL}/api/schedules',
7 CURLOPT_RETURNTRANSFER => true,
8 CURLOPT_ENCODING => '',
9 CURLOPT_MAXREDIRS => 10,
10 CURLOPT_TIMEOUT => 0,
11 CURLOPT_FOLLOWLOCATION => true,
12 CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
13 CURLOPT_CUSTOMREQUEST => 'POST',
14 CURLOPT_POSTFIELDS =>'{
15 "body":"Teste de Agendamento",
16 "sendAt":"2023-12-17T22:00:00.000Z",
17 "contactId":"24294",
18 "userId":"34",
19 "openTicket":"0",
20 "queueId":"0",
21 "whatsappId":"2",
22 "repetir":"0", //0 = Não Repetir, 999 = Todo Dia (repetirTodo)
23 "repetirTodo":"0", //0 = Não Repetir, 999 = Aniversário
24 "quantasVezes":"0"
25}',
26 CURLOPT_HTTPHEADER => array(
27 'Content-Type: application/json',
28 'Authorization: Bearer tokenmeu'
29 ),
30));
31
32$response = curl_exec($curl);
33
34curl_close($curl);
35echo $response;
36
JSON
1{
2 "id": 57,
3 "body": "Teste de Agendamento",
4 "sendAt": "2023-12-17T22:00:00.000Z",
5 "sentAt": null,
6 "contactId": 24294,
7 "ticketId": null,
8 "userId": 34,
9 "companyId": 1,
10 "status": "PENDENTE",
11 "geral": false,
12 "queueId": 0,
13 "whatsappId": 2,
14 "mediaPath": null,
15 "mediaName": null,
16 "repetir": 0,
17 "repetirTodo": 0,
18 "quantasVezes": 0,
19 "createdAt": "2023-12-17T14:34:07.751Z",
20 "updatedAt": "2023-12-17T14:34:07.751Z"
21}
Updated 17 Dec 2023
Did this page help you?