יצירת איש קשר במקס + עדכון משתנים +שליחת הודעה + קובץ בAPI

להלן העתק הקוד כפי שמוצג בסרטון:

כמובן יש לשנות את הטוקן בהתאם לטוקן שלכם במערכת מקס

curl –location ‘https://chat.maxchats.com/api/integrations/send-message’ \
–header ‘Accept: application/json’ \
–header ‘Content-Type: application/json’ \
–header ‘Authorization: Bearer QMB75fo05gFVGz14rRHgLtuxPqZHVdfg5b1dDnAZJblFoCzJIOMUfuI3LwhaLV’ \
–data ‘{
“phone”: “972525787657”,
“text”: “- ניתן לכתוב כל הודעה – לצרף קובץ או תמונה וכמובן לינק לדוגמה: https://maxchats.com *ליצור ולעדכן איש קשר * במקס בוט עם משתנים.* ההודעה נכתבה ונשלחה מפוסטמן*,”,
“attachment”: {
“type”: “1”,
“mime”: “1”,
“url”: “https://maxchats.com/wp-content/uploads/2023/06/%D7%A2%D7%99%D7%A6%D7%95%D7%91-%D7%9C%D7%9C%D7%90-%D7%A9%D7%9D-6.png”
},
“variables”: {
“city”: “תל אביב”
}
}’

 explanation of each part:

  1. --location: Follow redirects when making requests.
  2. --header 'Accept: application/json': Set the “Accept” header to indicate that the client expects JSON.
  3. --header 'Content-Type: application/json': Set the “Content-Type” header to indicate that the data being sent is in JSON format.
  4. --header 'Authorization: Bearer QMB75fo05gFVGz14rRHgLtuxPqZNGPCsHXCb1dDnAZJblFoCzJIOMUfuI3LwhaLV': Include the Authorization header with the provided Bearer token.
  5. --data '{...}': Send a POST request with the JSON data enclosed in single quotes.

The JSON data contains the parameters for the MaxChats API:

  • phone: The phone number to send the message to.
  • text: The message text in Hebrew.
  • attachment: An object with information about the attachment (image in this case).
    • type: Attachment type.
    • mime: MIME type of the attachment.
    • url: URL of the attachment (an image in this case).
  • variables: Additional variables, in this case, the city is set to “תל אביב”.

Make sure to replace the placeholder token, phone number, and any other details with the actual values you want to use.