DocumentationIntegrations

SMS with Zenvia

How to connect your Zenvia account so the app sends SMS (alerts, reminders, confirmations) and to unlock login by phone.

Costs no credits: no step in this guide uses AI credits.

Zenvia plays the same role as Twilio: it is the provider the app's SMS go out through. Either one connected is enough for automations with the SMS channel to deliver and for login by phone to be available.

Zenvia or Twilio

The app has a single SMS channel, and both cards answer for it:

  • only Zenvia connected: every SMS goes out through Zenvia;
  • only Twilio connected: every SMS goes out through Twilio, as in SMS with Twilio;
  • both connected: SMS keep going out through Twilio. To start sending through Zenvia, disconnect the Twilio card.

When you switch from one to the other, screens, automations and login by phone do not change: they use the SMS channel, without knowing which provider is behind it.

The exception is an app where you asked in the chat, by name, to send through Zenvia. That send always uses the Zenvia card, even with Twilio connected, and stops working if the Zenvia card is disconnected.

Before you start

  • Plan: any, Free included;
  • A Zenvia account with the SMS channel contracted and active;
  • Cost in two places:
    • Zenvia charges for each SMS, on your account, according to your contract with it;
    • each SMS sent by the app consumes the platform's integration credits, and SMS is the most expensive notification channel in credits. That includes every SMS login code. The charge only happens when Zenvia accepts the send.

Step by step

Card fields: API token and Sender (SMS account alias).

  1. sign in to your account at app.zenvia.com;
  2. under Integrations → API, generate a token. Copy it right away: it is the password that lets the app send on your behalf;
  3. on the same screen, note the alias of your SMS account. It is a short name (for example, my-sms-account), not a phone number;
  4. in the app's editor, Integrations tab, Notifications category, open the SMS (Zenvia) card;
  5. paste the token into API token and the alias into Sender;
  6. click Save and activate.

The recipient's number

Zenvia only accepts the complete number, with the country code. The app accepts the destination in two formats:

  • international with +, for example +5511988887777 (this is what the app's phone field already stores);
  • Brazilian, already starting with 55, for example 5511988887777.

A number with no country code, such as 11988887777, is refused, not completed with 55: that same number is a valid North American phone, and guessing would deliver the message to a stranger. If the app's contacts were imported without the country code, fix the numbers before sending.

Each message can have up to 1,520 characters. Above that, the send is refused before it reaches Zenvia.

Login by phone

With Zenvia connected, the app can offer sign-in with a phone number and a code received by SMS, and password recovery the same way. This is not switched on in the Authentication tab: the presence of an SMS provider (Zenvia or Twilio) is what unlocks it. The rest is in Sign-up and login in your app.

It is worth planning the balance: each SMS login attempt is a paid SMS at Zenvia and a charge in integration credits. With the credit balance at zero, the code is not sent and the person cannot sign in by phone.

How to know it worked

On save, the card tests the token with Zenvia, without sending any message:

  • Connected: Zenvia recognized the token;
  • Configuration error: the test did not pass, and the window shows the reason. It can be the token refused by Zenvia (check the token and paste it again), the Sender field left blank, or Zenvia unavailable at that moment (save again in a few moments, without changing the token).

The test does not check the sender: only a real send shows whether the alias is right. So the final proof is a real SMS:

  • if the app has login by phone, request a code with your number;
  • or ask in the chat for a test button that sends you an SMS (that costs AI credits, like any building).

When Zenvia refuses a send, the app receives the reason it gave (invalid number, unknown sender, no balance), and no integration credit is charged.

Common problems

  • The card stays on "Configuration error". Read the reason the window shows on save. If Zenvia refused the token, it is wrong, was deleted at Zenvia or was pasted incomplete: paste it again, or generate another one (a blank field keeps its saved value). If the message says Zenvia could not be reached, the token may be right: save again in a few moments;
  • The card is Connected, but no SMS arrives. The sender is wrong. It has to be exactly the SMS account alias shown at Zenvia, not a phone number;
  • The send is refused because of the number. The country code is missing. See "The recipient's number", above;
  • I connected Zenvia and SMS still go out through Twilio. That is expected when both cards are connected. Disconnect Twilio;
  • It stopped sending out of nowhere. Check the integration credit balance, in the panel under Billing, and the balance of the Zenvia account itself.
Open Fabapp
Related
SMS with TwilioActivating integrationsSign-up and login in your app