Suretriggers.com custom API requests

How to Use the API App to Send Messages, Files, and Update Chat Labels on TimelinesAI via Suretriggers.com

Integrating TimelinesAI with Suretriggers.com unlocks powerful automation capabilities for communication tasks on WhatsApp, including sending messages, sharing files, updating chat labels, and much more. While Suretriggers.com offers built-in actions for standard message sending, the API App extends this functionality, providing advanced flexibility to send custom API requests such as personalized text messages, media files, and other tailored interactions via TimelinesAI.

This guide explains how to use the API App in Suretriggers.com to send text messages, media files, and update labels in chats using TimelinesAI.

Step 1: Create an API App Module



In Suretriggers.com, select the API App and choose the API request event.




Step 2: Setting Up the API to Send Messages and Files in an Existing Chat



Navigate to the Configure tab and select the New API tab.

Configure the following settings:

- Method: POST

- Payload Type: Raw JSON

- Endpoint URL:

https://app.timelines.ai/integrations/api/chats/{chat_id}/messages

(*Replace {chat_id} with the actual chat ID from the address bar in your browser when you have an open WhatsApp chat in TimelinesAI. This ID can also be found in the payload of the outbound webhook).

- Wrap Request in Array?: No

- Select Authentication: Bearer Token

- Bearer Token: Copy the token from this page in your TimelinesAI account (e.g., e7c698cd-5751-4e42-afa9-2e65fe5fbgge).

- Data:
Here is an example of the data structure, where you can add your text or label:

{
       "text": "hello, world!",
       "label": "customer"
     }


If you wish to send a file with the text message, include the body schema as shown below, replacing "file_uid" with the UID of the file (copy this from here):

{
     "text": "hello, world!",
     "file_uid": "afa9d4dd-978d-4a14-aa1b-bd65c272e645",
     "label": "customer"
   }




Step 3: Updating Chat Labels



To update chat labels, follow the steps below:

Endpoint URL:

https://app.timelines.ai/integrations/api/chats/{chat_id}/labels

(*Again, replace {chat_id} with the actual chat ID, found as explained above).

Data:
To update the labels, enter the following data structure:

{
     "labels": [
       "label1",
       "label2",
       "label3"
     ]
   }

Replace "label1", "label2", and "label3" with the labels you wish to assign to the chat.

Step 4: Testing the API Action



After completing the configuration, go to the Test tab and click the Test Action button.

Once the action is complete, you will see the performed action reflected in the selected chat on TimelinesAI.



Learn More About the TimelinesAI Public API



The API App in Suretriggers.com is a powerful tool for automating communications via TimelinesAI, offering flexibility for sending personalized responses, media files, or updating labels. For more detailed information about using the TimelinesAI Public API, visit the TimelinesAI Public API documentation.

By following the steps above, you can easily automate message sending, file sharing, and label updates, ensuring efficient and timely communication with your clients.

For additional reference, visit TimelinesAI Public API Redoc to explore further API calls.

Updated on: 16/11/2024

Was this article helpful?

Share your feedback

Cancel

Thank you!