Clickatell API to send SMS

Glad you’ve got it working. I’m just building/testing an adaptation of @Teodor’s Working with Arrays guide which should give you a way of adding a list of numbers that you can then pass to the Server Connect action as the ‘to’ input when the submit button is clicked. It will need a slight change to the Server Connect action to receive it.

1 Like

Thank you again, you have been very kind!

You’re welcome.
Could I be a pain and ask you to change the solution to my post?

As promissed, to add multiple phone numbers, you can use @Teodor’s guide mentioned above altering the following:

  1. The repeat part should be placed inside the form.

  2. When creating the buttons to show them add a hidden text field (to hold the phone numbers for POSTing to the Server Connect)
    image

  3. give the hidden text input Name to[] (use something like to_add for the text input where you enter the number)

  4. Give the hidden field a dynamic attribute for Value of the $value of the repeat

  5. Change the API Action properties to : image

The Post globals remain as they were, as do the Header/input options of the API action

Thanks for altering the solution. I hope it all works well for you.

2 Likes

Hi guys, I m here again for more complex problem:
while Clickatell with SMS is working thank your help, I m getting stuck with Clicaktell business whatsapp api.

While in the SMS api input are as follow:

-d ‘{“content”: “Test Message Text”, “to”: [“393347453271”]}’ \

in the whatsapp api is:

-d ‘{“messages”: [{ “to”: “1234567890”, “content”: “Test Message Text” }]}’ \

I suppose it is an array but how can I do with Wappler I don’t understand. Someone can help me please ?

Thank you Roberto

You should be able to change the input names (in the form) to messages[to] and messages[content]
(use messages[][to] and messages[][content] if planning to allow multiple messages in one Server Connect call)

Change the Globals (in Server Connect) to just be messages (rather than separate to and content)
Change the Input Data in the Server Connect API Action to map messages to the messages POST variable

thank you @bpj, as I did like you said in the Globals messages I got to and content as part of the array.

31

But when I go to fetch the api schema I got the following message:
01

it makes me crazy

You don’t need to arrange the POST inputs (as you are sending as a JSON string). Simply create one POST input:
image
for messages
Then in Input Data (in API Action) create the link to the messages POST:
image

I haven’t tried the WhatsApp API and haven’t applied for it so can’t verify the steps, but in principle they should work.